In opengl it is possible to clear some bits in the stencil buffer and keep other bits unchanged when I call
glStencilMask(mask ); before
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
In Vulkan when I have a stencil buffer with some pixels = 0x80
and call
vkCmdSetStencilWriteMask with a mask = 0x7f
vkCmdClearAttachment with clearvalue = 0,
then each bit will be cleared to 0. It seems, that the stencil write mask is ignored.
The last bounded pipeline has VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
enabled, but
I’m not sure, that vkCmdSetStencilWriteMask
works only for draw commands or also for vkCmdClearAttachment
.
Is it possible to clear only specified bits in the stencil buffer in Vulkan similarly to opengl, without a draw command ?