Closed Bug 1751915 Opened 2 years ago Closed 2 years ago

WebGLRenderingContext.texImage2D and .texSubImage2D do not accept OffscreenCanvas as a source

Categories

(Core :: Graphics: CanvasWebGL, defect, P3)

defect

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

Details

Attachments

(1 file)

We have set of texImage2D and texSubImage2D variants here, and OffscreenCanvas is missing from the list:

https://searchfox.org/mozilla-central/rev/02bd3e02b72d431f2c600a7328697a521f87d9b6/dom/webidl/WebGLRenderingContext.webidl#744

In the WebGL conformance suite, we may use OffscreenCanvas as the canvas type if it is available:

https://searchfox.org/mozilla-central/rev/02bd3e02b72d431f2c600a7328697a521f87d9b6/dom/canvas/test/webgl-conf/checkout/js/tests/tex-image-and-sub-image-2d-with-canvas.js#403

And we attempt to use it with texImage2D and texSubImage2D:

https://searchfox.org/mozilla-central/rev/02bd3e02b72d431f2c600a7328697a521f87d9b6/dom/canvas/test/webgl-conf/checkout/js/tests/tex-image-and-sub-image-2d-with-canvas.js#265
https://searchfox.org/mozilla-central/rev/02bd3e02b72d431f2c600a7328697a521f87d9b6/dom/canvas/test/webgl-conf/checkout/js/tests/tex-image-and-sub-image-2d-with-canvas.js#263

This is likely causing some/all of the WebGL conformance suite test failures, including dom/canvas/test/webgl-conf/checkout/conformance/extensions/oes-texture-float-with-canvas.html.

Note this also applies to WebGL2RenderingContext's variants as well.

We can confirm Chrome is shipping this as the TexImageSource accepts an OffscreenCanvas object:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/interfaces/webgl1.idl;l=89

This patch adds OffscreenCanvas as a texture source for texImage2D,
texSubImage2D and texSubImage2D. This applies to both
WebGLRenderingContext and WebGL2RenderingContext. This was causing
several test failures in the WebGL conformance suite with
OffscreenCanvas.

Depends on D136836

Pushed by aosmond@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/820859114930
Ensure WebGLRenderingContext texImage/etc support OffscreenCanvas as a source. r=jgilbert,webidl,smaug
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Regressions: 1755578
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: