Skip to content

WebGLRenderer: Only clear when bit mask is set.#33010

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
Philipp-M:only-clear-if-mask-is-set
Feb 16, 2026
Merged

WebGLRenderer: Only clear when bit mask is set.#33010
Mugen87 merged 1 commit into
mrdoob:devfrom
Philipp-M:only-clear-if-mask-is-set

Conversation

@Philipp-M

Copy link
Copy Markdown
Contributor

Firefox outputs this warning:

WebGL warning: clear: Calling gl.clear(0) has no effect.

Chrome this:

Performance warning: clear() called with no buffers in bitmask

When gl.clear is called with 0

This can happen, e.g. when using integer buffers and only clearing the color buffer, as then gl.clearBuffer(u)iv is called instead.

To prevent this, just don't call gl.clear when no mask is set...

@github-actions

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 359.14
85.24
359.15
85.24
+7 B
+2 B
WebGPU 623.31
173.4
623.31
173.4
+0 B
+0 B
WebGPU Nodes 621.89
173.15
621.89
173.15
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 490.87
119.65
490.88
119.65
+7 B
+4 B
WebGPU 696.88
188.4
696.88
188.4
+0 B
+0 B
WebGPU Nodes 646.08
175.79
646.08
175.79
+0 B
+0 B

@Mugen87 Mugen87 added this to the r183 milestone Feb 16, 2026
@Mugen87 Mugen87 changed the title Only clear when bit mask is set in WebGLRenderer WebGLRenderer: Only clear when bit mask is set. Feb 16, 2026
@Mugen87 Mugen87 merged commit b1e12f4 into mrdoob:dev Feb 16, 2026
10 checks passed
@Philipp-M Philipp-M deleted the only-clear-if-mask-is-set branch February 16, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants