Support the RG32F texture format on WebGL - #9218
Merged
Merged
Conversation
The case for it existed only to report the format as unsupported, which left the GL format, internal format and pixel type undefined - a texture using it failed to upload with an invalid format, and a render target it was attached to came out incomplete with an attachment of zero size. WebGL2 does support it: an internal format of RG32F, a format of RG and a type of FLOAT, colour renderable through the same EXT_color_buffer_float that R32F already relies on. Mapped alongside R32F, matching the RG16F entry a few cases above it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Build size reportThis PR changes the size of the minified bundles.
|
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.
Summary
PIXELFORMAT_RG32Fhad a case in the WebGL texture backend that existed only to report it as unsupported. It broke without assigning_glFormat,_glInternalFormator_glPixelType, so those stayedundefined— uploading a texture with that format failed withtexImage2D: invalid format, and a render target it was attached to came out incomplete:WebGL2 does support the format — internal format
RG32F, formatRG, typeFLOAT, colour renderable through the sameEXT_color_buffer_floatthatR32Falready relies on. This maps it alongsideR32F, matching theRG16Fentry a few cases above.Notes
getRenderableHdrFormatanswers from the generic capability flags (textureFloatRenderable,textureFloatFilterable,textureFloatBlendable) and never consults the backend's format table, so it happily returnedRG32Fon WebGL and produced the failure above. That is what made this reachable rather than merely absent.PIXELFORMAT_BGRA8andSBGRA8remain in the table with the same error-and-fall-through shape, so a preference list naming either would fail the same way — left alone here as a separate concern.Note that on a WebGL2 device without
EXT_float_blend, a request for a blendable format still correctly skips the 32 bit formats and falls back to half float.Testing
Verified on WebGL2 and WebGPU by a caller requesting a two channel float scene depth target, which previously failed on WebGL with the errors above and now renders on both.
🤖 Generated with Claude Code