OffscreenCanvas.transferFromImageBitmap() and other canvas-reading broken with WebGPU
Categories
(Core :: Graphics: WebGPU, defect)
Tracking
()
People
(Reporter: huscar, Assigned: sotaro)
References
(Depends on 1 open bug)
Details
Steps to reproduce:
Tried to use OffscreenCanvas.transferFromImageBitmap()
to transfer a bitmap of WebGPU output to another canvas. Was unsure about whether this was me or Firefox, so I went looking for conformance tests, Firefox appears to be failing them: https://gpuweb.github.io/cts/standalone/?q=webgpu:web_platform,canvas,readbackFromWebGPUCanvas:*
Comment 1•1 month ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•1 month ago
|
Updated•1 month ago
|
Assignee | ||
Comment 2•1 month ago
•
|
||
Looked into the following one test failure. (Test is for onscreenCanvas)
In the test, snapshot seemed to get invalid data(just zero).
initWebGPUCanvasContent() function in https://gpuweb.github.io/cts/out/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.js submit the test data to current texture. But the current texture was not presented to screen.
WebGPUParent::GetFrontBufferSnapshot() implementation has a problem. The GetFrontBufferSnapshot() expects that the texture is already presented by WebGPUParent::RecvSwapChainPresent(). The GetFrontBufferSnapshot() does not handle a case that the texture is not yet presented by the RecvSwapChainPresent().
Assignee | ||
Comment 3•1 month ago
|
||
With current D233473, the following test got valid data, but the data seemed to be swapped.
Updated•23 days ago
|
Comment 4•11 days ago
|
||
:sotaro: I'm still getting just zero for the snapshots in that test you've linked on my Windows 11 machine. What platform were you testing from?
Assignee | ||
Comment 5•11 days ago
•
|
||
When pref dom.webgpu.allow-present-without-readback = false, the readback worked on Windows. When ExternalExture was still being used by wgpu, ExternalTexture::GetSnapshot() did not work as expected.
Conformed bug 1945708 fix addressed the problem.
Comment 6•4 days ago
|
||
Sotaro, does that mean that this bug can be closed?
Assignee | ||
Comment 7•3 days ago
|
||
Sorry, comment 5 was not clear. This bug is not addressed.
bug 1945708 fix changed the test result like the following.
From
actual == 0x: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
failed -> xx xx xx xx xx xx xx xx xx
expected == 00 66 ff 00 66 00 ff 66 00 00 ff 66 66 00 ff
To
actual == 0x: 00 ff 66 00 ff 00 66 ff 00 00 66 ff ff 00 66
failed -> xx xx xx xx xx xx xx xx xx
expected == 00 66 ff 00 66 00 ff 66 00 00 ff 66 66 00 ff
Comment 8•2 days ago
|
||
Hmm, this might have some platform-specific pieces.
On my M1 MacBook Pro, I'm still getting zero-data failures for, e.g., webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,uploadToWebGL:format="bgra8unorm";alphaMode="opaque";webgl="webgl";upload="texImage2D"
:
EXPECTATION FAILED: Array had unexpected contents at indices 2 through 15.
Starting at index 1:
actual == 0x: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
failed -> xx xx xx xx xx xx xx xx xx
expected == 00 66 ff 00 66 00 ff 66 00 00 ff 66 66 00 ff
ErrorWithExtra@https://gpuweb.github.io/cts/out/common/util/util.js:23:5
failCheckElements@https://gpuweb.github.io/cts/out/webgpu/util/check_contents.js:265:10
checkElementsEqual@https://gpuweb.github.io/cts/out/webgpu/util/check_contents.js:66:10
@https://gpuweb.github.io/cts/out/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.js:427:14
I'm also seeing an error I've never seen before for webgpu:web_platform,canvas,readbackFromWebGPUCanvas:onscreenCanvas,snapshot:format="rgba8unorm";alphaMode="premultiplied";colorSpace="srgb";snapshotType="toDataURL"
and similar tests:
EXCEPTION: EncodingError: Invalid encoded image data.
Assignee | ||
Updated•2 days ago
|
Description
•