wined3d_swapchain_present() will invalidate everything except WINED3D_LOCATION_DRAWABLE, which means a partial blit to the front-buffer afterwards might need to read the drawable contents back to the texture. For P8 front-buffers that's problematic, because the original palette indices are lost. We may want to improve the wined3d side of this to avoid reading back the drawable, but copying the entire surface in ddraw in this situation seems like a good idea regardless.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/ddraw_private.h | 1 + dlls/ddraw/surface.c | 9 +++++++++ 2 files changed, 10 insertions(+)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index a9632de502f..b8552af2871 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -59,6 +59,7 @@ struct FvfToDecl #define DDRAW_NO3D 0x00000008 #define DDRAW_SCL_DDRAW1 0x00000010 #define DDRAW_SCL_RECURSIVE 0x00000020 +#define DDRAW_SWAPPED 0x00000040
#define DDRAW_STRIDE_ALIGNMENT 8
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 2d200493c95..cb837b1f903 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -50,6 +50,12 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, BOOL ret; RECT r;
+ if (surface->ddraw->flags & DDRAW_SWAPPED && !read) + { + surface->ddraw->flags &= ~DDRAW_SWAPPED; + rect = NULL; + } + if (!rect) { SetRect(&r, 0, 0, surface->surface_desc.dwWidth, surface->surface_desc.dwHeight); @@ -78,7 +84,10 @@ HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
if (SUCCEEDED(hr = wined3d_texture_blt(dst_texture, 0, rect, surface->wined3d_texture, surface->sub_resource_idx, rect, 0, NULL, WINED3D_TEXF_POINT)) && swap_interval) + { hr = wined3d_swapchain_present(surface->ddraw->wined3d_swapchain, rect, rect, NULL, swap_interval, 0); + surface->ddraw->flags |= DDRAW_SWAPPED; + } return hr; }