You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can see the test expects the returned bitmaps pixels to have an alpha value of 255. But looking at the spec (steps 1 to 3) it seems to me the returned image should be transparent black, ie alpha == 0, as the canvas is unconfigured.
Does the CTS need updated, or am I misreading the spec?
The text was updated successfully, but these errors were encountered:
…red webgpu canvas. r?#webgpu-reviewers
The spec[1] (steps 1-3) mandates we return a transparent black image
of the same size as the canvas when attempting to snapshot an
unconfigured webgpu canvas context.
Currently, CanvasContext::GetSurfaceSnapshot() returns null in such
cases. nsLayoutUtils::SurfaceFromOffscreenCanvas() then handles this
by returning a transparent black surface. This should be sufficient.
However, the relevant CTS tests[2] currently expect an *opaque* black
image to be returned. An issue[3] has been filed upstream.
This patch makes us match the CTS' expected behaviour, by specifically
handling the unconfigured case in CanvasContext::GetSurfaceSnapshot(),
and returning an opaque black surface of the required size. We clear
the pixels using libyuv::ARGBRect() for performance reasons, like we
do in BufferTexture.cpp when initializing BufferTextureData buffers.
If and when the CTS is updated to expect a transparent black surface,
we can either revert this patch in its entirety, or simply pass the
correct value for aIsOpaque to MakeFallbackImage().
[1] https://www.w3.org/TR/webgpu/#abstract-opdef-get-a-copy-of-the-image-contents-of-a-context
[2] webgpu:web_platform,canvas,readbackFromWebGPUCanvas:transferToImageBitmap_unconfigured_nonzero_size:*
[3] gpuweb/cts#4259
I'm looking at making the above test pass in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1948580)
I can see the test expects the returned bitmaps pixels to have an alpha value of 255. But looking at the spec (steps 1 to 3) it seems to me the returned image should be transparent black, ie alpha == 0, as the canvas is unconfigured.
Does the CTS need updated, or am I misreading the spec?
The text was updated successfully, but these errors were encountered: