shader-slang / slang

Making it easier to work with shaders
http://shader-slang.com
MIT License
2.16k stars 186 forks source link

variable created inside scope, then used outside of it #3838

Closed GDBobby closed 6 months ago

GDBobby commented 7 months ago

!flag is set to a variable inside the loop, which is fine, but then it uses that variable outside of the scope it was created in, which causes an error glslang: OceanFFT.slang(70): error : '_S14' : undeclared identifier glslang: OceanFFT.slang(70): error : '' : compilation terminated Line 150 and 183 in the generated glsl file Error happens when compiling to spirv directly from slangc, in both optimization level 0 and 3 OceanFFT_slang.txt

OceanFFT_slang_glsl.txt

csyonghe commented 7 months ago

Does it work if you compile with -emit-spirv-directly?

GDBobby commented 7 months ago

yes, it compiles, thank you