Skip to content

Support the RG32F texture format on WebGL - #9218

Merged
mvaligursky merged 1 commit into
mainfrom
mv-webgl-rg32f
Aug 24, 2026
Merged

Support the RG32F texture format on WebGL#9218
mvaligursky merged 1 commit into
mainfrom
mv-webgl-rg32f

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Summary

PIXELFORMAT_RG32F had a case in the WebGL texture backend that existed only to report it as unsupported. It broke without assigning _glFormat, _glInternalFormat or _glPixelType, so those stayed undefined — uploading a texture with that format failed with texImage2D: invalid format, and a render target it was attached to came out incomplete:

RG32F texture format is not supported by WebGL.
WebGL: INVALID_ENUM: texImage2D: invalid format
ASSERT FAILED: Framebuffer creation failed with error code FRAMEBUFFER_INCOMPLETE_ATTACHMENT
GL_INVALID_FRAMEBUFFER_OPERATION: glClear: Framebuffer is incomplete: Attachment has zero size.

WebGL2 does support the format — internal format RG32F, format RG, type FLOAT, colour renderable through the same EXT_color_buffer_float that R32F already relies on. This maps it alongside R32F, matching the RG16F entry a few cases above.

Notes

getRenderableHdrFormat answers from the generic capability flags (textureFloatRenderable, textureFloatFilterable, textureFloatBlendable) and never consults the backend's format table, so it happily returned RG32F on WebGL and produced the failure above. That is what made this reachable rather than merely absent. PIXELFORMAT_BGRA8 and SBGRA8 remain 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

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>
@github-actions

Copy link
Copy Markdown

Build size report

This PR changes the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2377.3 KB (+0.1 KB, +0.00%) 610.9 KB (+0.0 KB, +0.00%) 474.1 KB (−0.2 KB, −0.05%)
playcanvas.min.mjs 2374.7 KB (+0.1 KB, +0.00%) 609.7 KB (+0.0 KB, +0.00%) 473.5 KB (−0.0 KB, −0.01%)

@mvaligursky mvaligursky added the area: graphics Graphics related issue label Aug 24, 2026
@mvaligursky
mvaligursky merged commit 420cbc8 into main Aug 24, 2026
10 checks passed
@mvaligursky
mvaligursky deleted the mv-webgl-rg32f branch August 24, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant