diff --git a/src/library_webgpu.js b/src/library_webgpu.js index d128e8be44d4f..522bdb1ee170f 100644 --- a/src/library_webgpu.js +++ b/src/library_webgpu.js @@ -2431,6 +2431,9 @@ var LibraryWebGPU = { var selectorPtr = {{{ makeGetValue('descriptorFromCanvasHTMLSelector', C_STRUCTS.WGPUSurfaceDescriptorFromCanvasHTMLSelector.selector, '*') }}}; {{{ gpu.makeCheck('selectorPtr') }}} var canvas = findCanvasEventTarget(selectorPtr); +#if OFFSCREENCANVAS_SUPPORT + if (canvas.offscreenCanvas) canvas = canvas.offscreenCanvas; +#endif var context = canvas.getContext('webgpu'); #if ASSERTIONS assert(context); diff --git a/test/test_browser.py b/test/test_browser.py index 82cb6ca0acd21..7962199f76994 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -4689,17 +4689,19 @@ def test_webgl_simple_extensions(self, simple_enable_extensions, webgl_version): def test_webgpu_basic_rendering(self, args): self.btest_exit('webgpu_basic_rendering.cpp', args=['-sUSE_WEBGPU'] + args) + # TODO(#19645): Extend this test to proxied WebGPU when it's re-enabled. @requires_graphics_hardware @requires_threads def test_webgpu_basic_rendering_pthreads(self): - self.btest_exit('webgpu_basic_rendering.cpp', args=['-sUSE_WEBGPU', '-pthread', '-sPROXY_TO_PTHREAD']) + self.btest_exit('webgpu_basic_rendering.cpp', args=['-sUSE_WEBGPU', '-pthread', '-sOFFSCREENCANVAS_SUPPORT']) def test_webgpu_get_device(self): self.btest_exit('webgpu_get_device.cpp', args=['-sUSE_WEBGPU', '-sASSERTIONS', '--closure=1']) + # TODO(#19645): Extend this test to proxied WebGPU when it's re-enabled. @requires_threads def test_webgpu_get_device_pthreads(self): - self.btest_exit('webgpu_get_device.cpp', args=['-sUSE_WEBGPU', '-pthread', '-sPROXY_TO_PTHREAD']) + self.btest_exit('webgpu_get_device.cpp', args=['-sUSE_WEBGPU', '-pthread']) # Tests the feature that shell html page can preallocate the typed array and place it # to Module.buffer before loading the script page.