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

Alexandre Julliard julliard at winehq.org
Fri Mar 30 12:32:36 CDT 2018


Module: wine
Branch: master
Commit: a362daeaf56e054c96d463edb2ae87e8956a6875
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a362daeaf56e054c96d463edb2ae87e8956a6875

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Mar 30 17:39:11 2018 +0430

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 a9632de..b8552af 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 2d20049..cb837b1 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;
     }
 




More information about the wine-cvs mailing list