Jan Sikorski : wined3d: Check for stencil reference change in vulkan backend.
Alexandre Julliard
julliard at winehq.org
Wed Feb 3 15:39:29 CST 2021
Module: wine
Branch: master
Commit: 433aaccc1fd424108f19075f4b464c05b1a8cbc7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=433aaccc1fd424108f19075f4b464c05b1a8cbc7
Author: Jan Sikorski <jsikorski at codeweavers.com>
Date: Wed Feb 3 14:12:48 2021 +0100
wined3d: Check for stencil reference change in vulkan backend.
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>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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..f24f6bec6df 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -1493,6 +1493,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context
context_invalidate_state(&context_vk->c, STATE_STREAMSRC);
context_invalidate_state(&context_vk->c, STATE_INDEXBUFFER);
context_invalidate_state(&context_vk->c, STATE_BLEND_FACTOR);
+ context_invalidate_state(&context_vk->c, STATE_STENCIL_REF);
VK_CALL(vkEndCommandBuffer(buffer->vk_command_buffer));
@@ -1701,6 +1702,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 +2078,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 +2085,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 +3031,12 @@ 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) && dsv)
+ {
+ VK_CALL(vkCmdSetStencilReference(vk_command_buffer, VK_STENCIL_FACE_FRONT_AND_BACK,
+ state->stencil_ref & ((1 << dsv->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);
More information about the wine-cvs
mailing list