From d558ec01776d048c7fbbdfee48388df336292b68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Sat, 4 Jan 2014 13:20:25 +0100
Subject: wined3d: Discard implicit surfaces on unload.

---
 dlls/wined3d/surface.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f8a360b..ee4a422 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1124,24 +1124,9 @@ static void surface_unload(struct wined3d_resource *resource)
         /* Default pool resources are supposed to be destroyed before Reset is called.
          * Implicit resources stay however. So this means we have an implicit render target
          * or depth stencil. The content may be destroyed, but we still have to tear down
-         * opengl resources, so we cannot leave early.
-         *
-         * Put the surfaces into sysmem, and reset the content. The D3D content is undefined,
-         * 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 */
-        if (resource->usage & WINED3DUSAGE_DEPTHSTENCIL)
-        {
-            wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED);
-            wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DISCARDED);
-        }
-        else
-        {
-            surface_prepare_system_memory(surface);
-            memset(surface->resource.heap_memory, 0, surface->resource.size);
-            wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_SYSMEM);
-            wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_SYSMEM);
-        }
+         * opengl resources, so we cannot leave early. */
+        wined3d_resource_validate_location(&surface->resource, WINED3D_LOCATION_DISCARDED);
+        wined3d_resource_invalidate_location(&surface->resource, ~WINED3D_LOCATION_DISCARDED);
     }
     else
     {
-- 
2.6.2

