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@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2015-11-22 01:00:59 +01:00 committed by Alexandre Julliard
parent 61ad9284d0
commit 369956a6fd
1 changed files with 12 additions and 4 deletions

View File

@ -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