bgfx
bgfx copied to clipboard
stencil write mask
I find that the stencil write mask in DX(StencilWriteMask) and OpenGL(glStencilMask not called) are all set to 0xff in bgfx.
Is there any way I can change this stencil write mask?
In fact, I came across a problem because this stencil write mask. I want to implement a clipRect in clipRect UI, at most 8(each a stencil value bit) nested clipRects. The stencil value I set to each clipRect is 2^n(1, 2, 4...128), with the stencil write mask set to the same value, the value in stencil buffer after replace will be(1, 3, 7...255):
stencil value in buffer= (ref(2^n) & stencil write mask) | (stencil value in buffer now) & (~stencil write mask)
Then I will set stencil op to Equal to (1, 3, 7...255) and keep to do stencil test. That will be all right.
But I can't change the stencil write mask through bgfx(maybe I do not find it), so if the inner clipRect is smaller than the outer, there will be no problem with the stencil write mask being 0xff, I can test stencil by set stencil value to 2^n and Ref the same, but if the inner clipRect is bigger than the outer one, then the inner one will not be clip by the outer one.
I'm sorry that I don't know whether I express the problem clearly, and if there is something wrong, please forgive my ignorance about that.
Any news on this?
Practically all platforms support stencil write masks. How come BGFX doesn't? :-)
Metal: https://developer.apple.com/documentation/metal/mtlstencildescriptor/1462496-writemask Vulkan: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkStencilOpState.html OpenGL: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glStencilMask.xhtml
Any news on this?
No news.
Practically all platforms support stencil write masks. How come BGFX doesn't? :-)
It wasn't really requested hard by users.
I noticed it is in the opengl codebase but it was commented out any particular reason why this is the case? doesn't seem like it would be too much to support.