You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the loop length is dependent on a specialization constant that is initialized to zero, slangc reports that the "loop runs for 0 iterations and will be removed. It shouldn't, since the value of the specialization constant isn't actually known at compile time. Luckily, even with -O2, it doesn't actually appear to get removed, judging from -target glsl output still emitting the loop anyway. So it's probably just the diagnostics.
It appears that this is incredibly easy to work around; just not using the const keyword with the specialization constant is enough. Since basically all GLSL shaders with specialization constants use the const keyword, I'll submit a PR to fix this anyway.
When the loop length is dependent on a specialization constant that is initialized to zero, slangc reports that the "loop runs for 0 iterations and will be removed. It shouldn't, since the value of the specialization constant isn't actually known at compile time. Luckily, even with -O2, it doesn't actually appear to get removed, judging from
-target glsl
output still emitting the loop anyway. So it's probably just the diagnostics.Source for replicating:
(The output buffer is only there to prevent the compiler from optimizing the loop away, it is not particularly necessary to replicate this bug.)
Output:
The text was updated successfully, but these errors were encountered: