Closed mwyrzykowski closed 2 weeks ago
cc @shaoboyan , do you know if this is expected?
Premultiplication only applies to the RGB channels. I assume the test case you mentioned is
SemitransparentWhite: { R: 1.0, G: 1.0, B: 1.0, A: 0.6 }
That's written as unpremultiplied, equal to CSS color(srgb 1.0 1.0 1.0 / 0.6)
.
When premultiplied it should be represented as [0.6, 0.6, 0.6, 0.6].
If you premultiply all channels you'd get [0.6, 0.6, 0.6, 0.36] though, not [0.6, 0.6, 0.6, 1.0].
The canvas spec has some examples as well as a brief explanation of what R/G/B/A mean in unpremultiplied vs premultiplied colors. https://html.spec.whatwg.org/multipage/canvas.html#premultiplied-alpha-and-the-2d-rendering-context
Indeed, nothing to see here, closing this one out as expected. Sorry for the noise!
No worries, happy to provide pointers!
In the following CTS test: https://gpuweb.github.io/cts/standalone/?q=webgpu:web_platform,copyToTexture,ImageBitmap:from_ImageData:alpha=%22none%22;orientation=%22none%22;colorSpaceConversion=%22none%22;srcFlipYInCopy=true;dstFormat=%22rgba8unorm%22;dstPremultiplied=true
, I see a failure running locally on ToT WebKit:
but if
dstPremultiplied=true
, why is the expected result 0.6 for alpha? After premultiplying the alpha channel by its alpha channel, the result should always be 1.Or do I misunderstand the behavior here and the alpha channel should be left unmodified? That would seem unexpected.