[PATCH 3/4] wined3d: Invalidate the depth/stencil view if the depth/stencil state may be written.

Zebediah Figura zfigura at codeweavers.com
Thu Jun 2 20:23:49 CDT 2022


This allows menu items to be rendered in Snowrunner.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
The mentioned graphical error is probably a regression caused by the recent
clear patches, but I haven't verified that.

 dlls/wined3d/state.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 228b4901c00..a732182d6c5 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -146,9 +146,25 @@ void * CDECL wined3d_depth_stencil_state_get_parent(const struct wined3d_depth_s
     return state->parent;
 }
 
+static bool stencil_op_writes_ds(const struct wined3d_stencil_op_desc *desc)
+{
+    return desc->fail_op != WINED3D_STENCIL_OP_KEEP
+            || desc->depth_fail_op != WINED3D_STENCIL_OP_KEEP
+            || desc->pass_op != WINED3D_STENCIL_OP_KEEP;
+}
+
 static bool depth_stencil_state_desc_writes_ds(const struct wined3d_depth_stencil_state_desc *desc)
 {
-    return desc->depth_write;
+    if (desc->depth_write)
+        return true;
+
+    if (desc->stencil && desc->stencil_write_mask)
+    {
+        if (stencil_op_writes_ds(&desc->front) || stencil_op_writes_ds(&desc->back))
+            return true;
+    }
+
+    return false;
 }
 
 HRESULT CDECL wined3d_depth_stencil_state_create(struct wined3d_device *device,
-- 
2.36.1




More information about the wine-devel mailing list