juj/wasm_webgpu

terser.js error from wgpu_canvas_context_get_current_texture

brendan-duncan opened this issue · 6 comments

I got the not very helpful error MOZ_TO_ME[node.type] is not a function while working on updating to the current lib_webgpu.

I added a debug print statement into the terser.js from_moz function to see what was throwing it off, and saw it was a chainexpression node. Looks like terser.js doesn't support them, and the line:
{{{ wassert('!(texture.derivedObjects?.length > 1000)'); }}}
in wgpu_canvas_context_get_current_texture caused the error.

juj commented

Hmm, I think the issue is an old version of terser.js (or maybe wrong spec standard input flags passed to it). The rationale for using ?. is that it shortens code size and all browsers that will support WebGPU will also support ?.. However given that this is only an assert, code size is not important, so adjusting the code to drop this use in above commit.

juj commented

What were the Emscripten cmdline flags (build optimization flags especially) that you were running with?

I believe the optimization flags being passed are -O3 -g2 for the builds I've been doing

It does look like an old version of terser.js being used by this version of emscripten, 3.14.1, while the latest is 5.7.1

juj commented

Are you on latest Emscripten (does this look like something that needs update in upstream Emscripten repo?) - or would updating Emscripten locally help for you?