ImageData does not support color space
Categories
(Core :: Graphics: Color Management, defect)
Tracking
()
People
(Reporter: sotaro, Unassigned, NeedInfo)
References
(Depends on 2 open bugs, Blocks 3 open bugs)
Details
During running test in Bug 1940072, the following code caused exception.
const srcImgData = new ImageData(2, 2, { colorSpace: srcColorSpace });
convertRGBA8UnormBytesToColorSpace - readbackFromWebGPUCanvas.spec.ts:83:21
TypeError: ImageData constructor: Argument 1 is not an object.
ImageData.webidl does not have color space.
https://html.spec.whatwg.org/multipage/canvas.html#imagedata
Comment 1•6 months ago
|
||
This was added in https://github.com/whatwg/html/pull/6562 (which points to bug 1703654 as our implementation bug, but that was only used to implement support in the WebGL canvas).
Comment 2•6 months ago
|
||
This is more gfx issue, I think. Sure, there is some minor webidl bindings changes needed too.
Comment 3•5 months ago
|
||
Simply adding the field to the ImageData
webidl does in fact "fix" the tests, but is certainly not what we want to do. (I assume the tests end up working by accident because neither webgpu nor canvas2d handle colorspaces correctly.)
Kelsey, do you know what work would be involved to support this? The test appears to call Canvas2D.drawImage
where the canvas has a different colorspace than the webgpu context. It then does the conversion by hand by creating an ImageData
with one colorspace and a canvas2d with another, and calling putImageData()
then getImageData()
. Then it compares the resulting pixel values of these two operations to ensure they match.
I'm not sure I understand how this is testing webgpu functionality as opposed to canvas 2d. Ideally the CTS would have variants of these tests that avoid doing these conversions, allowing us to still test the readback functionality despite not supporting these APIs.
Updated•5 months ago
|
Updated•2 months ago
|
Comment 4•1 month ago
|
||
I need to take a look at https://developer.mozilla.org/en-US/docs/Web/API/ImageData/colorSpace and the spec to see how this fits into the HDR Canvas story.
Description
•