KhronosGroup / KhronosGroup/glslang
missing error message for atomicAdd on non-global storage
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
The following piece of code produces invalid spirv
calling atomicAdd(dst, 1); directly from ```main``` instead of from ```foo``` works as intended
```
#version 460
#extension GL_EXT_shader_explicit_arithmetic_types : require
layout(binding = 0) buffer myStorageBuffer { uint dst; };
void foo(inout uint a)
{
atomicAdd(a, 1);
}
void main()
{
foo(dst);
// atomicAdd(dst, 1); //
}
```
checking the spirv using spirv-val produces the following output
```
$ spirv-val.exe comp.spv
error: line 47: AtomicIAdd: Function storage class forbidden when the Shader capability is declared.
%14 = OpAtomicIAdd %uint %a %uint_1 %uint_0 %uint_1
```
I'm not entirely sure if taking a reference to a buffer member is legal, but i suppose it shouldn't produce invalid spirv :)
Contributor guide
Assessment
This issue has not been assessed yet.