bool add_particle(inout ParticleBufferHeader header, out uint index) {
index = atomicAdd(header.count, 1);
if (index >= header.capacity) {
return false;
} else {
atomicMax(
header.update_workgroups,
1 + index / PARTICLE_UPDATE_LOCAL_SIZE
);
return true;
}
}
that causes this error in shaderc:
shaderc: internal error: compilation succeeded but failed to optimize: AtomicIAdd: Function storage class forbidden when the Shader capability is declared.
%74 = OpAtomicIAdd %uint %71 %uint_1 %uint_0 %uint_1
only when compiling with optimization. I'm not sure whether this is legal in glsl or not, if I change this function to a macro and call it directly on the SSBO field then the error disappears, this is only when trying to call atomics on an inout parameter.
I'm using shaderc through rust through the shaderc-rs crate, so I believe the version here of shaderc is 06b6db68ff7e20d4f097a132dd56a1c6482e8c25. I'm sorry this isn't a more isolated example, if necessary I can make one available.
Hey, I have the following glsl function:
that causes this error in shaderc:
only when compiling with optimization. I'm not sure whether this is legal in glsl or not, if I change this function to a macro and call it directly on the SSBO field then the error disappears, this is only when trying to call atomics on an inout parameter.
I'm using shaderc through rust through the shaderc-rs crate, so I believe the version here of shaderc is 06b6db68ff7e20d4f097a132dd56a1c6482e8c25. I'm sorry this isn't a more isolated example, if necessary I can make one available.