- Added a ForceRehash flag to the resource information structure
- Lock2DSurface now is a trampoline which calls the xbox function, but also marks our resource as needs rehash. If a title calls Lock2DSurface, we can assume it's to modify a resource.
This massively improves the framerate in many titles, for example the
title screen on Turok sees a jump from ~2fps to 160fps with this alone.
I understand this isn't the best solution, but it is the best tradeoff
so far between not hashing resources at all (texture updates by xbox won't
propegate to host textures) or hashing every usage (extremely slow).
A better method would be dirty pages/memory watches, but it's not easily
possible with the current Cxbx-Reloaded design.
This is incorrect when compared to real hardware, but both our previous
approach and using the same method as real hardware are insufficient
right now, so this approach can be a suitable interim fix.
Our previous method breaks in some titles such as Kingdom Under Fire
that uses a higher than 0xFFFF value for an FVF
The real hardware method (checking D3DFVD_RESERVED0) fixes Kingdom Under
Fire but breaks rendering in many titles: This cannot be made to work
properly until we unpatch CreateVertexShader, which is outside the scope
of this current experimental branch
This reverts commit b3a6f1156276949caa277b1ca229920e7ba1831d.
This is how the Xbox does things, however, due to our patching of
CreateVertexShader and other related functions, the same approach
doesn't work too well for us here. We'll have to do something a little
more smart.
It turns out the D3DFVF_RESERVED0 bit is used for this, making our old method unreliable.
This fixes a crash in Kingdom Under Fire (and likely other titles too)
Also refactored D3DResource_Release to store an iterator, no longer
need to hackily store a backup of the surface data as we call
GetHostResource before the XB_D3DResource_Release now.
D3DDevice_PersistDisplay
D3DDevice_GetPersistedSurface is a wrapper around
AvGetSavedDataAddress() and does not need to be patched.
D3DDevice_PersistDisplay needs to be patched for now, as it depends on
CMiniport::IsFlipPending, which only works with LLE NV2A at this moment
in time.