Henri Verbeet : wined3d: Update the depth/ stencil resource location for stencil clears as well.

Alexandre Julliard julliard at winehq.org
Fri Feb 9 14:51:44 CST 2018


Module: wine
Branch: master
Commit: 1b7f06acb121fe90dd694ea5508d6050cc3df23c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1b7f06acb121fe90dd694ea5508d6050cc3df23c

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Feb  9 01:46:45 2018 +0330

wined3d: Update the depth/stencil resource location for stencil clears as well.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/device.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 78610fc..7881bca 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -288,16 +288,22 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
                 depth_stencil->texture_level);
     }
 
-    if (depth_stencil && render_offscreen)
-        wined3d_texture_prepare_location(depth_stencil->container,
-                dsv->sub_resource_idx, context, dsv->resource->draw_binding);
-
-    if (flags & WINED3DCLEAR_ZBUFFER)
+    if (depth_stencil)
     {
-        DWORD location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
+        DWORD ds_location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
+        struct wined3d_texture *ds = wined3d_texture_from_resource(dsv->resource);
+
+        if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)
+                && !is_full_clear(depth_stencil, draw_rect, rect_count ? clear_rect : NULL))
+            wined3d_texture_load_location(ds, dsv->sub_resource_idx, context, ds_location);
+        else
+            wined3d_texture_prepare_location(ds, dsv->sub_resource_idx, context, ds_location);
 
-        wined3d_texture_load_location(depth_stencil->container,
-                dsv->sub_resource_idx, context, location);
+        if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
+        {
+            wined3d_texture_validate_location(ds, dsv->sub_resource_idx, ds_location);
+            wined3d_texture_invalidate_location(ds, dsv->sub_resource_idx, ~ds_location);
+        }
     }
 
     if (!context_apply_clear_state(context, state, rt_count, fb))
@@ -324,11 +330,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
 
     if (flags & WINED3DCLEAR_ZBUFFER)
     {
-        DWORD location = render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
-
-        wined3d_texture_validate_location(depth_stencil->container, dsv->sub_resource_idx, location);
-        wined3d_texture_invalidate_location(depth_stencil->container, dsv->sub_resource_idx, ~location);
-
         gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE);
         context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZWRITEENABLE));
         gl_info->gl_ops.gl.p_glClearDepth(depth);




More information about the wine-cvs mailing list