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;