1workgroup atomicUint wgAtomic; // valid 2workgroup atomicUint wgAtomicArray[2]; // valid 3 4atomicUint globalAtomic; // invalid 5atomicUint globalAtomicArray[2]; // invalid 6 7struct S { 8 atomicUint structMemberAtomic; // valid 9 atomicUint structMemberAtomicArray[2]; // valid 10}; 11 12struct NestedS { 13 S nestedStructWithAtomicMember; // valid 14}; 15 16workgroup S wgStructWithAtomicMember; // valid 17workgroup S wgStructWithAtomicMemberArray[2]; // valid 18workgroup NestedS wgStructWithNestedAtomicMember; // valid 19 20S globalStructWithAtomicMember; // invalid 21S globalStructWithAtomicMemberArray[2]; // invalid 22NestedS globalStructWithNestedAtomicMember; // invalid 23 24layout(metal, binding = 0) buffer ssbo { 25 atomicUint ssboAtomic; // valid 26 atomicUint ssboAtomicArray[2]; // valid 27 S ssboStructWithAtomicMember; // valid 28 S ssboStructWithAtomicMemberArray[2]; // valid 29}; 30 31layout(metal, binding = 1) uniform ubo1 { 32 atomicUint uboAtomic; // invalid 33}; 34layout(metal, binding = 2) uniform ubo2 { 35 atomicUint uboAtomicArray[2]; // invalid 36}; 37layout(metal, binding = 3) uniform ubo3 { 38 S uboStructWithAtomicMember; // invalid 39}; 40layout(metal, binding = 4) uniform ubo4 { 41 S uboStructWithAtomicMemberArray[2]; // invalid 42}; 43layout(metal, binding = 5) uniform ubo5 { 44 NestedS uboStructWithNestedAtomicMember; // invalid 45}; 46 47layout(metal, binding = 6) readonly buffer roSsbo1 { 48 atomicUint readonlySsboAtomic; // invalid 49}; 50layout(metal, binding = 7) readonly buffer roSsbo2 { 51 atomicUint readonlySsboAtomicArray[2]; // invalid 52}; 53layout(metal, binding = 8) readonly buffer roSsbo3 { 54 S readonlySsboStructWithAtomicMember; // invalid 55}; 56layout(metal, binding = 9) readonly buffer roSsbo4 { 57 S readonlySsboStructWithAtomicMemberArray[2]; // invalid 58}; 59layout(metal, binding = 10) readonly buffer roSsbo5 { 60 NestedS readonlySsboStructWithNestedAtomicMember; // invalid 61}; 62 63void main() { 64 atomicUint localAtomic; // invalid 65 atomicUint localAtomicArray[2]; // invalid 66 S localStructWithAtomicMember; // invalid 67 S localStructWithAtomicMemberArray[2]; // invalid 68} 69 70/*%%* 71atomics are only permitted in workgroup variables and writable storage blocks 72atomics are only permitted in workgroup variables and writable storage blocks 73atomics are only permitted in workgroup variables and writable storage blocks 74atomics are only permitted in workgroup variables and writable storage blocks 75atomics are only permitted in workgroup variables and writable storage blocks 76variables of type 'atomicUint' may not be uniform 77atomics are only permitted in workgroup variables and writable storage blocks 78variables of type 'atomicUint[2]' may not be uniform 79atomics are only permitted in workgroup variables and writable storage blocks 80variables of type 'atomicUint' may not be uniform 81atomics are only permitted in workgroup variables and writable storage blocks 82atomics are only permitted in workgroup variables and writable storage blocks 83variables of type 'atomicUint' may not be uniform 84atomics are only permitted in workgroup variables and writable storage blocks 85atomics are only permitted in workgroup variables and writable storage blocks 86atomics are only permitted in workgroup variables and writable storage blocks 87atomics are only permitted in workgroup variables and writable storage blocks 88atomics are only permitted in workgroup variables and writable storage blocks 89atomics are only permitted in workgroup variables and writable storage blocks 90atomics are only permitted in workgroup variables and writable storage blocks 91atomics are only permitted in workgroup variables and writable storage blocks 92atomics are only permitted in workgroup variables and writable storage blocks 93atomics are only permitted in workgroup variables and writable storage blocks 94*%%*/ 95