-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Description
Description
Calls to stencil functions like gl.stencilFunc, gl.stencilOp or gl.stencilMask are ignored when gl.STENCIL_TEST is not enabled. That's how it works in webgl (Edit: no it doesn't, I was mislead by AI which lead me to a long state cache modifying misadventure and the real issue is in the comments). Regardless of that WebGLState.js is caching these values as current. preventing them from being set correctly when the stencil buffer is enabled afterwards and the value is the same as cached.
Reproduction steps
Rendering an empty scene should be enough to reproduce the issue.
Renderer clears the frame and calls this.state.buffers.stencil.setMask( 0xffffffff );
At this point the cached currentStencilMask will be set to 0xffffffff but the native call to gl.stencilMask is ignored because gl.STENCIL_TEST is not enabled. The state is now out of sync and subsequent calls with the same value will be ignored because currentStencilMask will match them.
- in WebglState.js under line
currentStencilMask = stencilMask;
add a new lineconsole.log('Stencil mask cached correctly', gl.getParameter(gl.STENCIL_WRITEMASK) === currentStencilMask)
- Create a basic scene, run and look in the console
Code
Live example
No live example, requires core modification
Screenshots
No response
Version
164
Device
Desktop
Browser
Chrome
OS
Windows