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: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-30 17:21:11 +04:30 committed by Alexandre Julliard
parent 733a3ec1b9
commit a362daeaf5
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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;
}