-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renderer: Stencil Buffer disabled in RenderContext by default #27908
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
I don't know if I agree that the default of the clear flag should be changed. If I have the stencil buffer enabled why should calling "clear" not clear the stencil buffer, as well? The flag for enabling the stencil buffer by default is separate from when it get cleared by default when it exists. |
How about not changing the default parameter in the |
This PR should not introduce a breaking change. |
Ok, what about this one? the if ( _currentRenderTarget === null ) {
stencil = this.autoClearStencil;
} else if ( _currentRenderTarget.stencilBuffer === false ) {
stencil = false;
} |
I think this looks good! |
Just to be clear - are we really worried about performance implications of setting the "clear stencil" bit when there's no stencil buffer created? This seems very much like a micro optimization that adds unnecessary code for something the driver would have to do anyway. |
I agree that adjusting the "clear stencil" bit without an existing stencil buffer likely won't impact performance, as it only modifies settings for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why clear something that’s not there? Considering how different GPUs might react, keeping things simple and logical feels like the better move.
I'll defer to other opinions here but my opinion is that defensively adding code to do things we don't know are needed isn't a great policy. It adds more code which means more to understand (and in this case the purpose or intent isn't obvious) and more points for potential bugs to arise, however simple the logic may seem. I think there are good reasons to not just add things that seem simple without an apparent need.
Regarding driver issues - I think you do have to trust the drivers to do something reasonable until it's shown they don't in some case. Otherwise what's to stop you from adding defensive code everywhere?
Alright you convinced me @gkjohnson. I will just continue the previous work and disable by default the stencil buffer in the WebGPU part too on this PR. |
Related: #27900
Description
Following #27900, this PR disable the Stencil Buffer by default in RenderContext.
This contribution is funded by Utsubo