Commit a362daea authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Copy the entire front-buffer surface after a buffer swap.

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: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 733a3ec1
......@@ -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
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment