Open roenyroeny opened 3 years ago
Actually, GLSL function arguments are NOT by reference, but value-return ie copy to/from local memory. The atomicAdd in foo should therefore cause a compilation error, given the following text from the GLSL spec: Atomic memory functions perform atomic operations on an individual signed or unsigned integer stored in buffer object or shared variable storage.
So glslangValidator is missing a compilation error for this case.
If someone wishes to submit a fix, please contact me before you start coding.
The following piece of code produces invalid spirv calling atomicAdd(dst, 1); directly from
main
instead of fromfoo
works as intendedchecking the spirv using spirv-val produces the following output
I'm not entirely sure if taking a reference to a buffer member is legal, but i suppose it shouldn't produce invalid spirv :)