[PATCH 2/2] wined3d: Check for stencil reference change in vulkan backend.
Jan Sikorski
jsikorski at codeweavers.com
Wed Feb 3 04:00:16 CST 2021
Make stencil reference value dynamic, so it can be updated separately.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50380
Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
---
dlls/wined3d/context_vk.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index 55127e44a00..e3bf6690505 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -1701,6 +1701,7 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
static const VkDynamicState dynamic_states[] =
{
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
+ VK_DYNAMIC_STATE_STENCIL_REFERENCE,
};
key = &context_vk->graphics.pipeline_key_vk;
@@ -2076,8 +2077,6 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
key->ds_desc.front.compareOp = vk_compare_op_from_wined3d(d->desc.front.func);
key->ds_desc.front.compareMask = d->desc.stencil_read_mask;
key->ds_desc.front.writeMask = d->desc.stencil_write_mask;
- key->ds_desc.front.reference = state->stencil_ref
- & ((1 << state->fb.depth_stencil->format->stencil_size) - 1);
key->ds_desc.back.failOp = vk_stencil_op_from_wined3d(d->desc.back.fail_op);
key->ds_desc.back.passOp = vk_stencil_op_from_wined3d(d->desc.back.pass_op);
@@ -2085,8 +2084,6 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
key->ds_desc.back.compareOp = vk_compare_op_from_wined3d(d->desc.back.func);
key->ds_desc.back.compareMask = d->desc.stencil_read_mask;
key->ds_desc.back.writeMask = d->desc.stencil_write_mask;
- key->ds_desc.back.reference = state->stencil_ref
- & ((1 << state->fb.depth_stencil->format->stencil_size) - 1);
}
else
{
@@ -3033,6 +3030,13 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
VK_PIPELINE_BIND_POINT_GRAPHICS, context_vk->graphics.vk_pipeline));
}
+ if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_STENCIL_REF)
+ && state->depth_stencil_state && state->depth_stencil_state->desc.stencil)
+ {
+ VK_CALL(vkCmdSetStencilReference(vk_command_buffer, VK_STENCIL_FACE_FRONT_AND_BACK,
+ state->stencil_ref & ((1 << state->fb.depth_stencil->format->stencil_size) - 1)));
+ }
+
if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_STREAMSRC))
wined3d_context_vk_bind_vertex_buffers(context_vk, vk_command_buffer, state, vk_info);
--
2.30.0
More information about the wine-devel
mailing list