ddraw: Make sure that sysmem surfaces remain coherent when not locked.
Merge request reports
Activity
requested review from @jsikorski
I am confused - once upon a time, there would have been only a sysmem surface on the wined3d side, and wined3d does the clear directly on its system memory and reads the data from the source's system memory in the Blt() call.
Nowadays we have a video memory draw texture for sysmem surfaces because one can use them for texturing on native ddraw.
Is the issue here that ddraw accidentally made wined3d perform stuff on the vidmem draw texture rather than the 'original' system wiend3d_texture?
d2d9f713 forces us to create a separate wined3d_texture for texturing or RTV usage. I don't know why it was done this way instead of just continuing to allow CPU textures to be used as a texture/RTV; unfortunately neither the commit message nor the patches as submitted on wine-devel give any explanation.
Even at that point the offending Emperor texture wasn't created with any bind flags. (Despite the fact that a color fill uses an RTV, it wasn't created with WINED3D_BIND_RENDER_TARGET; we don't currently validate that.)
ee7d047d forces all sysmem textures to get a draw texture. That means that the color fill acts on the draw texture instead of the sysmem texture, and the subsequent blits use ddraw_surface_get_any_texture() and hence pick the draw texture since that location is valid.
It does slightly bother me that we're reimplementing all this logic on the client side, but I guess there was a reason for doing it this way...
1531 1531 src_impl ? &src_impl->IDirectDrawSurface_iface : NULL, flags); 1532 1532 } 1533 1533 1534 /* Emperor: Rise of the Middle Kingdom accesses the map pointer outside of 1535 * Lock()/Unlock(), and expects those updates to be propagated by a Blt(). 1536 * It also blits to the surface, and color-fills it. 1537 * 1538 * This function is called after a blit or color-fill that might update the GPU I'm a little confused because the comment says it's called after a blit or color fill, but in
ddraw_surface_blt
it's apparently only called after a color fill, and not after a blit.Edited by Jan Sikorskichanged this line in version 3 of the diff
added 63 commits
-
c604f214...585e9d49 - 60 commits from branch
wine:master
- 48ecde18 - ddraw/tests: Add tests for map pointer coherency.
- b712d6c8 - ddraw: Sync to sysmem after performing a color fill.
- d6204ccd - ddraw: Use the sysmem wined3d texture for sysmem surfaces if possible.
Toggle commit list-
c604f214...585e9d49 - 60 commits from branch