Stencil confusion
Posted: 13 Oct 2025, 10:37
Hi
I'm integrating Noesis in our own engine currently, and are a bit confused over how the stencil buffer usage is supposed to function.
When opening up a combo-box a new Offscreen rendertarget, along with a stencil buffer is created.
Later during OnscreenRender I get first one DrawBatch which wants to draw with Stencil mode Equal_Incr, stencil ref 0, followed by a couple of draws with Equal_keep with stencil ref 1. That makes perfect sense of course, it draws the combo-background to increase the stencil ref to 1 and and draws the contents with stencil masking. check.
But there is no call to SetRenderTargets at all during the OnscreenRender scope, when I'm beginning OnscreenRender I set the rendertarget to our backbuffer as output as it says in the documentation, at that point I don't set any depthstencil target at all, I figured that was going to be handled in the OffscreenRender pass somehow as that's the only thing that sets RenderTargets (and depthstencil). So I'm just a bit confused over how it's supposed to work here, am I supposed to set and clear another depth stencil target for the OnScreenRender myself, or? We already have one of course for the rest of the frame, but in order to use it for this it would need to be cleared prior to rendering, which is an otherwise uncessesary and expensive operation in the frame.
I'm also confused over the usage of the offscreen target which is created and used during OffscreenRender, as it's never bound as input on any pass during Onscreen and seems to be completely unused.
As seen in the screenshots I'm using the xaml from one of the samples.
One thing I've yet to implement is the ResolveRendertarget function, and I really don't see the point of it currently. It is being called during OffscreenRender. But what is the purpose to resolve the Offscreen-target? That is done implicitly anyway if it was ever bound as input. No?
I'm integrating Noesis in our own engine currently, and are a bit confused over how the stencil buffer usage is supposed to function.
When opening up a combo-box a new Offscreen rendertarget, along with a stencil buffer is created.
Later during OnscreenRender I get first one DrawBatch which wants to draw with Stencil mode Equal_Incr, stencil ref 0, followed by a couple of draws with Equal_keep with stencil ref 1. That makes perfect sense of course, it draws the combo-background to increase the stencil ref to 1 and and draws the contents with stencil masking. check.
But there is no call to SetRenderTargets at all during the OnscreenRender scope, when I'm beginning OnscreenRender I set the rendertarget to our backbuffer as output as it says in the documentation, at that point I don't set any depthstencil target at all, I figured that was going to be handled in the OffscreenRender pass somehow as that's the only thing that sets RenderTargets (and depthstencil). So I'm just a bit confused over how it's supposed to work here, am I supposed to set and clear another depth stencil target for the OnScreenRender myself, or? We already have one of course for the rest of the frame, but in order to use it for this it would need to be cleared prior to rendering, which is an otherwise uncessesary and expensive operation in the frame.
I'm also confused over the usage of the offscreen target which is created and used during OffscreenRender, as it's never bound as input on any pass during Onscreen and seems to be completely unused.
As seen in the screenshots I'm using the xaml from one of the samples.
One thing I've yet to implement is the ResolveRendertarget function, and I really don't see the point of it currently. It is being called during OffscreenRender. But what is the purpose to resolve the Offscreen-target? That is done implicitly anyway if it was ever bound as input. No?