Zebediah Figura : wined3d: Store whether a depth/stencil state writes to the depth/stencil buffer in the state itself.

Alexandre Julliard julliard at winehq.org
Fri Jun 3 15:53:08 CDT 2022


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Jun  2 20:23:48 2022 -0500

wined3d: Store whether a depth/stencil state writes to the depth/stencil buffer in the state itself.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context_gl.c      | 2 +-
 dlls/wined3d/context_vk.c      | 2 +-
 dlls/wined3d/state.c           | 7 +++++++
 dlls/wined3d/wined3d_private.h | 2 ++
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c
index 5ae237db54b..5292297bb85 100644
--- a/dlls/wined3d/context_gl.c
+++ b/dlls/wined3d/context_gl.c
@@ -5172,7 +5172,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
         return;
     }
 
-    if (dsv && (!state->depth_stencil_state || state->depth_stencil_state->desc.depth_write))
+    if (dsv && (!state->depth_stencil_state || state->depth_stencil_state->writes_ds))
     {
         DWORD location = context->render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
 
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index c257b5f3c86..a9b875a132e 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -3455,7 +3455,7 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
             wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding);
         }
 
-        if (!state->depth_stencil_state || state->depth_stencil_state->desc.depth_write)
+        if (!state->depth_stencil_state || state->depth_stencil_state->writes_ds)
             invalidate_ds = true;
 
         sample_count = max(1, wined3d_resource_get_sample_count(dsv->resource));
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 56fd759e5e2..228b4901c00 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -146,6 +146,11 @@ void * CDECL wined3d_depth_stencil_state_get_parent(const struct wined3d_depth_s
     return state->parent;
 }
 
+static bool depth_stencil_state_desc_writes_ds(const struct wined3d_depth_stencil_state_desc *desc)
+{
+    return desc->depth_write;
+}
+
 HRESULT CDECL wined3d_depth_stencil_state_create(struct wined3d_device *device,
         const struct wined3d_depth_stencil_state_desc *desc, void *parent,
         const struct wined3d_parent_ops *parent_ops, struct wined3d_depth_stencil_state **state)
@@ -164,6 +169,8 @@ HRESULT CDECL wined3d_depth_stencil_state_create(struct wined3d_device *device,
     object->parent_ops = parent_ops;
     object->device = device;
 
+    object->writes_ds = depth_stencil_state_desc_writes_ds(desc);
+
     TRACE("Created depth/stencil state %p.\n", object);
     *state = object;
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7bfca0bcb88..918c1b911fe 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3778,6 +3778,8 @@ struct wined3d_depth_stencil_state
     LONG refcount;
     struct wined3d_depth_stencil_state_desc desc;
 
+    bool writes_ds;
+
     void *parent;
     const struct wined3d_parent_ops *parent_ops;
 




More information about the wine-cvs mailing list