On Wed, 3 Feb 2021 at 12:38, Jan Sikorski jsikorski@codeweavers.com wrote:
On 3 Feb 2021, at 12:14, Henri Verbeet hverbeet@gmail.com wrote: On Wed, 3 Feb 2021 at 11:01, Jan Sikorski jsikorski@codeweavers.com wrote:
- 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)));
- }
The check for stencil enable above works because we always invalidate the stencil reference when setting the depth/stencil state in wined3d_cs_exec_set_depth_stencil_state(), but it seems fragile to rely on that.
That’s what I intended, it makes sense to me. Are you proposing to always set it regardless wether it was changed? I think the same is true for STATE_BLEND_FACTOR?
Yes, I'd suggest to simply always call vkCmdSetStencilReference() if STATE_STENCIL_REF was invalidated. If that ends up becoming e.g. a performance concern, it would seem preferable to address that by reducing the number of STATE_STENCIL_REF invalidations. (I.e., doing this kind of check in wined3d_cs_exec_set_depth_stencil_state() and wined3d_context_vk_submit_command_buffer() instead.)