AST -> SPV: Add basic atomic_uint and atomic*() built-in function functionality.
This commit is contained in:
38
Test/spv.atomic.comp
Normal file
38
Test/spv.atomic.comp
Normal file
@@ -0,0 +1,38 @@
|
||||
#version 310 es
|
||||
|
||||
layout(binding = 0) uniform atomic_uint counter;
|
||||
|
||||
layout(binding = 0, offset = 4) uniform atomic_uint countArr[4];
|
||||
uniform uint value;
|
||||
|
||||
int arrX[gl_WorkGroupSize.x];
|
||||
int arrY[gl_WorkGroupSize.y];
|
||||
int arrZ[gl_WorkGroupSize.z];
|
||||
|
||||
uint func(atomic_uint c)
|
||||
{
|
||||
return atomicCounterIncrement(c);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
memoryBarrierAtomicCounter();
|
||||
func(counter);
|
||||
uint val = atomicCounter(countArr[2]);
|
||||
atomicCounterDecrement(counter);
|
||||
}
|
||||
|
||||
shared int atomi;
|
||||
shared uint atomu;
|
||||
|
||||
void atoms()
|
||||
{
|
||||
int origi = atomicAdd(atomi, 3);
|
||||
uint origu = atomicAnd(atomu, value);
|
||||
origu = atomicOr(atomu, 7u);
|
||||
origu = atomicXor(atomu, 7u);
|
||||
origu = atomicMin(atomu, value);
|
||||
origi = atomicMax(atomi, 7);
|
||||
origi = atomicExchange(atomi, origi);
|
||||
origu = atomicCompSwap(atomu, 10u, value);
|
||||
}
|
||||
Reference in New Issue
Block a user