texImage2D() with an accelerated 2D canvas source swaps red and blue (sibling of bug 2087301, still present in 160.0)
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
People
(Reporter: n.ehrhardt88, Unassigned, NeedInfo)
References
Details
Attachments
(1 file)
|
1.70 KB,
text/html
|
Details |
SUMMARY
Bug 2087301 fixed the WebGL-canvas -> drawImage() -> 2D-canvas direction.
The opposite direction is still broken in 160.0: uploading an accelerated
2D canvas into a WebGL texture with texImage2D() swaps the red and blue
channels. Same platform conditions as 2087301 (Linux, AMD, DMABuf), same
workaround (widget.dmabuf-webgl.enabled=false).
STEPS TO REPRODUCE
- Firefox 160.0 on Linux/X11, AMD GPU (amdgpu/Mesa).
- Defaults: gfx.canvas.accelerated=true, widget.dmabuf-webgl.enabled=true.
- Open the attached testcase (it needs nothing but a WebGL context).
ACTUAL RESULT
A 2D canvas -> texImage2D -> WebGL texture : 255,0,0 (red and blue swapped)
B ImageBitmap -> texImage2D -> WebGL texture: 0,0,255 (correct)
C Uint8Array -> texImage2D -> WebGL texture: 0,0,255 (correct)
The source is a canvas filled with pure blue rgb(0,0,255); getImageData()
on that same canvas returns 0,0,255, so the canvas content itself is correct.
EXPECTED RESULT
All three report 0,0,255.
NOTES
- Independent of UNPACK_FLIP_Y_WEBGL: both with and without the flag the
upload comes out swapped. - Size dependent, as in bug 2087301: an 8x8 canvas is correct, 512x512 and
1086x1448 are swapped -- consistent with gfx.canvas.accelerated.min-size
(128) deciding whether the accelerated path is taken. - Setting widget.dmabuf-webgl.enabled=false fixes it (restart required);
so does gfx.canvas.accelerated=false. - In the same build, the direction reported in bug 2087301
(drawImage of a WebGL canvas onto a 2D canvas) is CORRECT, so that fix
is present and this is a separate path. - Found in the wild: a WebGL application that decoded images via
createImageBitmap() and routed them through a 2D canvas (the usual
workaround for UNPACK_FLIP_Y_WEBGL being ignored for ImageBitmap sources)
rendered every texture with red and blue swapped -- only in Firefox on
this machine, while Chrome on the same machine and Firefox on Android
were correct.
Comment 2•6 days ago
|
||
Thanks for the very clear report and testcase. This looks like the same bug as bug 2089043, which covers texImage2D of an accelerated 2D canvas swapping red and blue on Linux with DMABuf WebGL. Its fix landed just after 160.0 was built, so it isn't in 160.0. It's in 160.0.1 and in the current Beta (161) and Nightly builds. So if you don't have the fix already you should get it very soon if you check for updates.
Which exact version are you running (Help > About Firefox, or about:support)? If it's 160.0, the testcase should be fixed once you update to 160.0.1. If you're already on 160.0.1 and still see red and blue swapped, please let us know, because then this is a different problem from bug 2089043. Testing Beta or Nightly would also help.
Comment 3•6 days ago
|
||
(In reply to Timothy Nikkel (:tnikkel) from comment #2)
Thanks for the very clear report and testcase. This looks like the same bug as bug 2089043, which covers texImage2D of an accelerated 2D canvas swapping red and blue on Linux with DMABuf WebGL. Its fix landed just after 160.0 was built, so it isn't in 160.0. It's in 160.0.1 and in the current Beta (161) and Nightly builds. So if you don't have the fix already you should get it very soon if you check for updates.
Which exact version are you running (Help > About Firefox, or about:support)? If it's 160.0, the testcase should be fixed once you update to 160.0.1. If you're already on 160.0.1 and still see red and blue swapped, please let us know, because then this is a different problem from bug 2089043. Testing Beta or Nightly would also help.
It looks like 160.0 is all that has been released, but no 160.0.1 yet according to whattrainisitnow (not till Nov 17). The fix should get released then. The easiest way to confirm would be for the reporter to just try a Nightly build, where the fix is definitely landed already.
Description
•