=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Discard depth stencils on unload.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 23 09:59:46 CST 2015


Module: wine
Branch: master
Commit: 369956a6fd140fa2176764bc036f1aee69184010
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=369956a6fd140fa2176764bc036f1aee69184010

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sun Nov 22 01:00:59 2015 +0100

wined3d: Discard depth stencils on unload.

Doing so is equivalent of setting WINED3D_LOCATION_DISCARDED when
creating new depth stencil surfaces. It will only happen on the implicit
depth stencil.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/surface.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 6a93de4..a8f7179 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1149,10 +1149,18 @@ static void surface_unload(struct wined3d_resource *resource)
          * but we can't set the sysmem INDRAWABLE because when we're rendering the swapchain
          * or the depth stencil into an FBO the texture or render buffer will be removed
          * and all flags get lost */
-        surface_prepare_system_memory(surface);
-        memset(surface->resource.heap_memory, 0, surface->resource.size);
-        surface_validate_location(surface, WINED3D_LOCATION_SYSMEM);
-        surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM);
+        if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL)
+        {
+            surface_validate_location(surface, WINED3D_LOCATION_DISCARDED);
+            surface_invalidate_location(surface, ~WINED3D_LOCATION_DISCARDED);
+        }
+        else
+        {
+            surface_prepare_system_memory(surface);
+            memset(surface->resource.heap_memory, 0, surface->resource.size);
+            surface_validate_location(surface, WINED3D_LOCATION_SYSMEM);
+            surface_invalidate_location(surface, ~WINED3D_LOCATION_SYSMEM);
+        }
 
         /* We also get here when the ddraw swapchain is destroyed, for example
          * for a mode switch. In this case this surface won't necessarily be




More information about the wine-cvs mailing list