H. Verbeet : wined3d: Set the surface location to SFLAG_INSYSMEM for depth stencils on Reset.

Alexandre Julliard julliard at winehq.org
Tue Jun 3 04:52:21 CDT 2008


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

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Mon Jun  2 21:12:54 2008 +0200

wined3d: Set the surface location to SFLAG_INSYSMEM for depth stencils on Reset.

---

 dlls/wined3d/device.c  |    8 ++++++--
 dlls/wined3d/surface.c |    6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8150c97..67d27e6 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -7048,8 +7048,12 @@ static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, WINED3DPRESENT_PARAM
     surface->resource.allocatedMemory = NULL;
     surface->resource.heapMemory = NULL;
     surface->resource.size = IWineD3DSurface_GetPitch((IWineD3DSurface *) surface) * surface->pow2Width;
-    /* INDRAWABLE is a sane place for implicit targets / depth stencil after the reset */
-    IWineD3DSurface_ModifyLocation((IWineD3DSurface *) surface, SFLAG_INDRAWABLE, TRUE);
+    /* INDRAWABLE is a sane place for implicit targets after the reset, INSYSMEM is more appropriate for depth stencils. */
+    if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) {
+        IWineD3DSurface_ModifyLocation((IWineD3DSurface *) surface, SFLAG_INSYSMEM, TRUE);
+    } else {
+        IWineD3DSurface_ModifyLocation((IWineD3DSurface *) surface, SFLAG_INDRAWABLE, TRUE);
+    }
 }
 
 static HRESULT WINAPI reset_unload_resources(IWineD3DResource *resource, void *data) {
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 684690b..adddaa9 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -572,7 +572,11 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
          * uninitialized drawable. That's pointless and we'd have to allocate the texture /
          * sysmem copy here.
          */
-        IWineD3DSurface_ModifyLocation(iface, SFLAG_INDRAWABLE, TRUE);
+        if (This->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) {
+            IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
+        } else {
+            IWineD3DSurface_ModifyLocation(iface, SFLAG_INDRAWABLE, TRUE);
+        }
     } else {
         /* Load the surface into system memory */
         IWineD3DSurface_LoadLocation(iface, SFLAG_INSYSMEM, NULL);




More information about the wine-cvs mailing list