[naga] [glsl-in] Crashes when we go over a certain nested stack depth (including if/else chains)
magcius opened this issue · 1 comments
Description
It seems that glsl-in crashes after a certain recursion limit; the call stack is blown.
Repro steps
https://gist.github.com/magcius/b53f33c9135355fe7fed542a748c60b3
Expected vs observed behavior
I'd expect a successful parse, or at least an error, rather than a crash.
Extra materials
This was found when trying to translate this shader to WGSL for noclip.website, which uses Naga to transform GLSL to WGSL for the WebGPU backend. https://github.com/magcius/noclip.website/blob/fe8dd8f74d93579296e7d087147de0b3a1bfcebd/src/MarioKart8Deluxe/Render.ts#L534-L597
Platform
wgpu commit bdf30fa. This was found with a version of Naga compiled to WebAssembly, but it crashes anywhere.
Some relevant Naga community chat about solutions: https://matrix.to/#/!fjjkgHFcwtkREywzfk:matrix.org/$hfLitnms2hGFLbFiwC6t2ZJ6Yd-51HHj9WEmKol7RoI?via=matrix.org&via=mozilla.org&via=ralith.com