-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify UNPACK_PREMULTIPLY_ALPHA for floating-point and integer pixel formats #3667
Comments
I believe we should specifiy that:
|
Inf and NaN included?
Since the values are normalized, multiplication results cannot be outside of |
Notes from the WebGL concall:
Thinking: we do whatever the CPU hardware does.
Let's say that the integer math's done with 32 bits of precision and then clamp back to the 8-bit range. Or, say that clamping isn't better than masking? Not sure what's better. Meta-question, should we be premultiplying integer values at all? Consider ignoring the state for these non-normalized integer textures. More discussion to come. |
I wish we had never applied this setting to ArrayBufferView data. It really only makes sense for images, where you're trying to ensure consistency. I believe Firefox warns if you use these things (such as flip-y) on ArrayBufferView data. |
In WG, we decided that we would try to spec UNPACK_PREMULTIPLY_ALPHA as ignored for non-TexImageSources (thus excluding ArrayBufferViews). |
Additional information from WebGL WG meeting of 2024-09-19: One remaining problem is uploading canvases to RGBA8UI textures with premultiplied alpha: https://registry.khronos.org/webgl/specs/latest/2.0/#3.7.6 . That's the only problematic format in the table. The WG resolved to test this, and if browsers behave differently, carve it out from the rest of the spec update. |
The
UNPACK_PREMULTIPLY_ALPHA_WEBGL
parameter is defined in WebGL 1.0 spec that on its own supports only unsigned normalized pixel formats.The WebGL 2.0 and the related WebGL extension specs should define how this parameter works with:
RGBA
andLUMINANCE_ALPHA
formats withFLOAT
andHALF_FLOAT
types. Specifically, how floating-point overflow/underflow is handled.RGBA_INTEGER
format. Specifically, how signed/unsigned integer overflow is handled.RGBA
format withBYTE
andSHORT
(fromEXT_texture_norm16
) types.The text was updated successfully, but these errors were encountered: