perf(webgl): drop unused stencil buffer from context attributes#117
Merged
Conversation
No code path uses the stencil buffer (no stencilFunc/stencilOp/STENCIL_TEST; clipping is scissor-based and clear() only touches COLOR_BUFFER_BIT), but requesting it costs tile memory bandwidth on every flush on tile-based GPUs (Mali 400-class targets). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Change
stencil: truetostencil: falseincreateWebGLContext(src/utils.ts). One-line change.Why
A repo-wide search shows nothing uses the stencil buffer: no
stencilFunc/stencilOp/stencilMask/STENCIL_TESTanywhere, clipping is scissor-based,WebGlContextWrapper.clear()only clearsCOLOR_BUFFER_BIT, and the RTT framebuffer (WebGlCtxRenderTexture) attaches onlyCOLOR_ATTACHMENT0with no stencil renderbuffer.Per the tile-based GPU rules in CLAUDE.md, every enabled buffer costs tile memory bandwidth on every flush on Mali 400-class targets — so an unused stencil buffer is pure waste.
Verification
stencil: truein utils.ts was the only stencil reference in the repo (src/, exports/, examples/)pnpm test: 267/267 unit tests pass🤖 Generated with Claude Code