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

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-06-02 20:23:48 -05:00 committed by Alexandre Julliard
parent 67b893ac09
commit fe85514479
4 changed files with 11 additions and 2 deletions

View file

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

View file

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

View file

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

View file

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