[glsl-in][wgsl-out] Nested loop miscompilation #1935
Labels
area: front-end
Input formats for conversion
kind: bug
Something isn't working
lang: GLSL
OpenGL Shading Language
The following glsl code with a simple nested loop:
main.frag
when translated to wgsl gives
main.wgsl
Which is obviously wrong as
x
is not declared within the scope of the first nested loop, thus reusing it and summing total to -3 instead of 0.I got this bug while implementing PCF, nested loops do exist in shaders! :D
Note that trying to declare the x out of the for like so doesn't work:
main.frag
Workaround
Declare main.frag like so:
main.frag
Tested with naga-cli 8.0. I've searched through naga's issue but didn't find anything like it.
The text was updated successfully, but these errors were encountered: