John Kessenich | bedb1bc | 2014-08-12 03:52:51 +0000 | [diff] [blame] | 1 | #version 420 core |
| 2 | |
| 3 | layout(binding = 0) uniform atomic_uint counter; |
Chow | 5db058c | 2019-12-25 17:27:45 +0800 | [diff] [blame] | 4 | layout(binding = 0, offset = 9) uniform atomic_uint counter; |
John Kessenich | bedb1bc | 2014-08-12 03:52:51 +0000 | [diff] [blame] | 5 | |
| 6 | uint func(atomic_uint c) |
| 7 | { |
| 8 | return atomicCounterIncrement(c); |
| 9 | } |
| 10 | |
| 11 | uint func2(out atomic_uint c) // ERROR |
| 12 | { |
John Kessenich | 4d57090 | 2014-08-12 22:07:22 +0000 | [diff] [blame] | 13 | return counter; // ERROR, type mismatch |
| 14 | return atomicCounter(counter); |
John Kessenich | bedb1bc | 2014-08-12 03:52:51 +0000 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | void main() |
| 18 | { |
| 19 | atomic_uint non_uniform_counter; // ERROR |
| 20 | uint val = atomicCounter(counter); |
| 21 | atomicCounterDecrement(counter); |
| 22 | } |
John Kessenich | 265f5fb | 2014-08-13 01:04:28 +0000 | [diff] [blame] | 23 |
|
| 24 | layout(binding = 1, offset = 3) uniform atomic_uint countArr[4];
|
| 25 | uniform int i;
|
| 26 |
|
| 27 | void opac()
|
| 28 | {
|
| 29 | counter + counter; // ERROR
|
| 30 | -counter; // ERROR
|
| 31 | int a[3];
|
| 32 | a[counter]; // ERROR
|
| 33 | countArr[2];
|
| 34 | countArr[i];
|
| 35 | counter = 4; // ERROR
|
| 36 | }
|
| 37 |
|
| 38 | in atomic_uint acin; // ERROR
|
| 39 | atomic_uint acg; // ERROR
|
John Kessenich | d78ca62 | 2014-08-19 06:08:38 +0000 | [diff] [blame] | 40 | uniform atomic_uint;
|
| 41 | uniform atomic_uint aNoBind; // ERROR, no binding
|
| 42 | layout(binding=0, offset=32) uniform atomic_uint aOffset;
|
| 43 | layout(binding=0, offset=4) uniform atomic_uint;
|
| 44 | layout(binding=0) uniform atomic_uint bar3; // offset is 4
|
Chow | 5db058c | 2019-12-25 17:27:45 +0800 | [diff] [blame] | 45 | layout(binding=0) uniform atomic_uint ac[2]; // offset = 8
|
John Kessenich | d78ca62 | 2014-08-19 06:08:38 +0000 | [diff] [blame] | 46 | layout(binding=0) uniform atomic_uint ad; // offset = 20
|
| 47 | layout(offset=8) uniform atomic_uint bar4; // ERROR, no binding
|
| 48 | layout(binding = 0, offset = 12) uniform atomic_uint overlap; // ERROR, overlapping offsets
|
| 49 | layout(binding = 20) uniform atomic_uint bigBind; // ERROR, binding too big
|