Add clear support for integer format color attachments - #9143
Merged
Conversation
Build size reportThis PR changes the size of the minified bundles.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Enables render-pass clears for integer-format color attachments across WebGL and WebGPU, aligning behavior with backend capabilities and adding an example-based verification path.
Changes:
- WebGL: clears integer color attachments using
gl.clearBufferiv/gl.clearBufferuivper attachment (and for single integer attachments too). - WebGPU: adds debug-time validation to prevent non-integer (and negative-for-unsigned) clear values from triggering WebGPU validation errors.
- Example: extends
test/independent-blendingwith an R32U clear-and-sample indicator panel.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/platform/graphics/webgpu/webgpu-render-target.js | Adds debug-only clear-value validation for integer-format attachments on WebGPU render passes. |
| src/platform/graphics/webgl/webgl-graphics-device.js | Routes integer attachment clears through the appropriate clearBuffer* API, including single-attachment integer RTs. |
| examples/src/examples/test/independent-blending.example.mjs | Adds an R32U render target clear + indicator panel to verify integer clear support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Allows render passes to clear integer format color attachments. Previously this was not supported - on WebGL, gl.clear has undefined results on integer buffers, which is also the reason the Picker encodes ids into an RGBA8 texture instead of using a uint32 format. For integer formats, the components of the clear color are the raw integer values.
Changes:
Examples:
test/independent-blendingexample gained an indicator panel - an R32U render target is cleared to a marker value by a clear-only render pass, and the panel samples it, showing green when it contains the expected value.Part of #5356. This also unblocks migrating the Picker to a uint32 format, which additionally needs uint fragment outputs for the pick shader variants.