-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
emsdk version 3.1.46
Building and running webgpu samples with webgpu.h works fine without the closure pass, but when trying to enable closure with the linker option --closure 1
, linking appears to work, but when running I get the following errors on the browser js console:
Uncaught (in promise) TypeError: Failed to execute 'configure' on 'GPUCanvasContext': Failed to read the 'format' property from 'GPUCanvasConfiguration': Required member is undefined.
at Da (triangle-sapp.js:54:9)
at triangle-sapp.wasm:0x1165
at triangle-sapp.wasm:0x1b7b
at triangle-sapp.js:42:369
at mc (triangle-sapp.js:27:301)
at triangle-sapp.js:42:252
onerror: Uncaught TypeError: Failed to execute 'configure' on 'GPUCanvasContext': Failed to read the 'format' property from 'GPUCanvasConfiguration': Required member is undefined.
triangle-sapp.js:54 Uncaught TypeError: Failed to execute 'configure' on 'GPUCanvasContext': Failed to read the 'format' property from 'GPUCanvasConfiguration': Required member is undefined.
at Da (triangle-sapp.js:54:9)
at triangle-sapp.wasm:0x1165
at triangle-sapp.wasm:0x3269
at Object.lb (triangle-sapp.js:18:70)
at b (triangle-sapp.js:11:46)
The JS file location triangle-sapp.js:54:9
looks like this:

The only place in library_webgpu.js
which has a configure call seems to be:
emscripten/src/library_webgpu.js
Lines 2607 to 2614 in 1311f22
var configuration = { | |
"device": device, | |
"format": WebGPU.TextureFormat[ | |
{{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.format) }}}], | |
"usage": {{{ gpu.makeGetU32('descriptor', C_STRUCTS.WGPUSwapChainDescriptor.usage) }}}, | |
"alphaMode": "opaque", | |
}; | |
context["configure"](configuration); |
I don't know what's needed to make such a JS shim closure-compatible, e.g. whether there are generally some sort of annotations missing, or only in this specific location. I could probably help with investigation and fixing if I would know where to start :)
Cheers!
(cc: @kainino0x)