[glsl-in] lost statement of multi part loop-expression #6208
Labels
area: naga front-end
lang: GLSL
OpenGL Shading Language
naga
Shader Translator
type: bug
Something isn't working
Description
If the third expression of a for loop (
loop-expression
according to the spec Chapter 6.3) contains multiple statements... naga just takes the last one and forgets the the first. I haven't looked at more than two statements.this leads to infinite loops and potential crashes. Likely root cause to finding gfx-rs/wgpu-native#416, maybe related to #4558
Repro steps
I have two semantically equivalent code snippets in glsl
the third expression contains the usual incrementor, as well as a completely unrelated statement.
translating them to wgls using naga gives me the following output for this loop
the difference is which statement is part of the continuing block. The other statement is completely lost. It is dependant on the order.
Expected vs observed behavior
A reference for this being valid in a shadertoy. Perhaps the continuing block could just include both statements?
Platform
naga 22.0.0
The text was updated successfully, but these errors were encountered: