wined3d: Use a separate flag for discarded surfaces.

Matteo Bruni mbruni at codeweavers.com
Thu Feb 2 08:08:58 CST 2012


It should fix regressions from c6c5c6905e87fefffd00c7d8e68df22879aefe55
(bugs 29760 and 29761).
---
 dlls/wined3d/device.c          |    2 +-
 dlls/wined3d/surface.c         |   10 +++++-----
 dlls/wined3d/swapchain.c       |    2 +-
 dlls/wined3d/wined3d_private.h |    1 +
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2d014ab..d0768aa 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4862,7 +4862,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st
         if (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
                 || prev->flags & SFLAG_DISCARD)
         {
-            surface_modify_ds_location(prev, SFLAG_LOST,
+            surface_modify_ds_location(prev, SFLAG_DISCARDED,
                     prev->resource.width, prev->resource.height);
             if (prev == device->onscreen_depth_stencil)
             {
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e6b4cd8..30dc63e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -762,7 +762,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
     }
 
     if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
-        surface->flags |= SFLAG_LOST;
+        surface->flags |= SFLAG_DISCARDED;
 
     return WINED3D_OK;
 }
@@ -5599,7 +5599,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
 {
     TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h);
 
-    if (location & ~(SFLAG_LOCATIONS | SFLAG_LOST))
+    if (location & ~(SFLAG_LOCATIONS | SFLAG_DISCARDED))
         FIXME("Invalid location (%#x) specified.\n", location);
 
     if (((surface->flags & SFLAG_INTEXTURE) && !(location & SFLAG_INTEXTURE))
@@ -5614,7 +5614,7 @@ void surface_modify_ds_location(struct wined3d_surface *surface,
 
     surface->ds_current_size.cx = w;
     surface->ds_current_size.cy = h;
-    surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_LOST);
+    surface->flags &= ~(SFLAG_LOCATIONS | SFLAG_DISCARDED);
     surface->flags |= location;
 }
 
@@ -5655,7 +5655,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
         return;
     }
 
-    if (surface->flags & SFLAG_LOST)
+    if (surface->flags & SFLAG_DISCARDED)
     {
         TRACE("Surface was discarded, no need copy data.\n");
         switch (location)
@@ -5672,7 +5672,7 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co
             default:
                 FIXME("Unhandled location %#x\n", location);
         }
-        surface->flags &= ~SFLAG_LOST;
+        surface->flags &= ~SFLAG_DISCARDED;
         surface->flags |= location;
         surface->ds_current_size.cx = surface->resource.width;
         surface->ds_current_size.cy = surface->resource.height;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 83678f8..efe2293 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -668,7 +668,7 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
         if (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
                 || fb->depth_stencil->flags & SFLAG_DISCARD)
         {
-            surface_modify_ds_location(fb->depth_stencil, SFLAG_LOST,
+            surface_modify_ds_location(fb->depth_stencil, SFLAG_DISCARDED,
                     fb->depth_stencil->resource.width,
                     fb->depth_stencil->resource.height);
             if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b218ca7..416d970 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2155,6 +2155,7 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
 #define SFLAG_INRB_MULTISAMPLE  0x00200000 /* The multisample renderbuffer is current. */
 #define SFLAG_INRB_RESOLVED     0x00400000 /* The resolved renderbuffer is current. */
 #define SFLAG_PIN_SYSMEM        0x02000000 /* Keep the surface in sysmem, at the same address. */
+#define SFLAG_DISCARDED         0x04000000 /* Surface was discarded, allocating new location is enough. */
 
 /* In some conditions the surface memory must not be freed:
  * SFLAG_CONVERTED: Converting the data back would take too long
-- 
1.7.3.4




More information about the wine-patches mailing list