Skip to content

Commit

Permalink
Proxy webgpu calls back to the main thread. NFC
Browse files Browse the repository at this point in the history
Until we have real multi-threaded webgpu support this is probable
the best we can do.

Fixes: #19645
  • Loading branch information
sbc100 committed Aug 14, 2023
1 parent 2fca90b commit a8ac628
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/library_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,7 @@ var LibraryWebGPU = {
#endif

var bundles = Array.from(HEAP32.subarray(bundlesPtr >> 2, (bundlesPtr >> 2) + count),
function(id) { return WebGPU.mgrRenderBundle.get(id); });
(id) => WebGPU.mgrRenderBundle.get(id));
pass["executeBundles"](bundles);
},

Expand Down Expand Up @@ -2582,23 +2582,22 @@ var LibraryWebGPU = {
var device = WebGPU.mgrDevice.get(deviceId);
var context = WebGPU.mgrSurface.get(surfaceId);


#if ASSERTIONS
assert({{{ gpu.PresentMode.Fifo }}} ===
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.presentMode) }}});
#endif

var canvasSize = [
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.width) }}},
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.height) }}}
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.width) }}},
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.height) }}}
];

if (canvasSize[0] !== 0) {
context["canvas"]["width"] = canvasSize[0];
context["canvas"]["width"] = canvasSize[0];
}

if (canvasSize[1] !== 0) {
context["canvas"]["height"] = canvasSize[1];
context["canvas"]["height"] = canvasSize[1];
}

var configuration = {
Expand Down Expand Up @@ -2642,6 +2641,7 @@ for (var value in LibraryWebGPU.$WebGPU.FeatureName) {

for (const key of Object.keys(LibraryWebGPU)) {
LibraryWebGPU[key + '__i53abi'] = true;
LibraryWebGPU[key + '__proxy'] = 'sync';
}

autoAddDeps(LibraryWebGPU, '$WebGPU');
Expand Down

0 comments on commit a8ac628

Please sign in to comment.