Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Getting WebGPU Context in pthread #21467

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/library_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4692,14 +4692,14 @@ def test_webgpu_basic_rendering(self, args):
@requires_graphics_hardware
kainino0x marked this conversation as resolved.
Show resolved Hide resolved
@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'])

kainino0x marked this conversation as resolved.
Show resolved Hide resolved
@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.
Expand Down