AST -> SPV: Add basic atomic_uint and atomic*() built-in function functionality.
This commit is contained in:
142
Test/baseResults/spv.atomic.comp.out
Normal file
142
Test/baseResults/spv.atomic.comp.out
Normal file
@@ -0,0 +1,142 @@
|
||||
spv.atomic.comp
|
||||
Warning, version 310 is not yet complete; most version-specific features are present, but some are missing.
|
||||
|
||||
|
||||
Linked compute stage:
|
||||
|
||||
|
||||
TBD functionality: Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?
|
||||
TBD functionality: Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?
|
||||
TBD functionality: Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?
|
||||
TBD functionality: Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?
|
||||
TBD functionality: Is atomic_uint an opaque handle in the uniform storage class, or an addresses in the atomic storage class?
|
||||
// Module Version 99
|
||||
// Generated by (magic number): 51a00bb
|
||||
// Id's are bound by 75
|
||||
|
||||
Source ESSL 310
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint GLCompute 4
|
||||
Name 4 "main"
|
||||
Name 11 "func(au1;"
|
||||
Name 10 "c"
|
||||
Name 13 "atoms("
|
||||
Name 20 "counter"
|
||||
Name 21 "param"
|
||||
Name 24 "val"
|
||||
Name 28 "countArr"
|
||||
Name 38 "origi"
|
||||
Name 40 "atomi"
|
||||
Name 44 "origu"
|
||||
Name 46 "atomu"
|
||||
Name 48 "value"
|
||||
Name 72 "arrX"
|
||||
Name 73 "arrY"
|
||||
Name 74 "arrZ"
|
||||
Decorate 20(counter) PrecisionHigh
|
||||
Decorate 20(counter) Binding 0
|
||||
Decorate 24(val) PrecisionHigh
|
||||
Decorate 28(countArr) PrecisionHigh
|
||||
Decorate 28(countArr) Binding 0
|
||||
Decorate 38(origi) PrecisionHigh
|
||||
Decorate 40(atomi) PrecisionHigh
|
||||
Decorate 44(origu) PrecisionHigh
|
||||
Decorate 46(atomu) PrecisionHigh
|
||||
Decorate 48(value) PrecisionHigh
|
||||
Decorate 72(arrX) PrecisionHigh
|
||||
Decorate 72(arrX) NoStaticUse
|
||||
Decorate 73(arrY) PrecisionHigh
|
||||
Decorate 73(arrY) NoStaticUse
|
||||
Decorate 74(arrZ) PrecisionHigh
|
||||
Decorate 74(arrZ) NoStaticUse
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
7: TypeInt 32 0
|
||||
8: TypePointer Function 7(int)
|
||||
9: TypeFunction 7(int) 8(ptr)
|
||||
19: TypePointer UniformConstant 7(int)
|
||||
20(counter): 19(ptr) Variable UniformConstant
|
||||
25: 7(int) Constant 4
|
||||
26: TypeArray 7(int) 25
|
||||
27: TypePointer UniformConstant 26
|
||||
28(countArr): 27(ptr) Variable UniformConstant
|
||||
29: TypeInt 32 1
|
||||
30: 29(int) Constant 2
|
||||
37: TypePointer Function 29(int)
|
||||
39: TypePointer WorkgroupLocal 29(int)
|
||||
40(atomi): 39(ptr) Variable WorkgroupLocal
|
||||
42: 29(int) Constant 3
|
||||
45: TypePointer WorkgroupLocal 7(int)
|
||||
46(atomu): 45(ptr) Variable WorkgroupLocal
|
||||
48(value): 19(ptr) Variable UniformConstant
|
||||
52: 7(int) Constant 7
|
||||
60: 29(int) Constant 7
|
||||
66: 7(int) Constant 10
|
||||
69: 7(int) Constant 1
|
||||
70: TypeArray 29(int) 69
|
||||
71: TypePointer PrivateGlobal 70
|
||||
72(arrX): 71(ptr) Variable PrivateGlobal
|
||||
73(arrY): 71(ptr) Variable PrivateGlobal
|
||||
74(arrZ): 71(ptr) Variable PrivateGlobal
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
21(param): 8(ptr) Variable Function
|
||||
24(val): 8(ptr) Variable Function
|
||||
MemoryBarrier Device AtomicCounterMemory
|
||||
22: 7(int) Load 20(counter)
|
||||
Store 21(param) 22
|
||||
23: 7(int) FunctionCall 11(func(au1;) 21(param)
|
||||
31: 19(ptr) AccessChain 28(countArr) 30
|
||||
32: 7(int) Load 31
|
||||
33: 7(int) AtomicLoad 32 Device None
|
||||
34: 7(int) Load 31
|
||||
Store 24(val) 34
|
||||
35: 7(int) Load 20(counter)
|
||||
36: 7(int) AtomicIDecrement 35 Device None
|
||||
Branch 6
|
||||
6: Label
|
||||
Return
|
||||
FunctionEnd
|
||||
11(func(au1;): 7(int) Function None 9
|
||||
10(c): 8(ptr) FunctionParameter
|
||||
12: Label
|
||||
15: 7(int) Load 10(c)
|
||||
16: 7(int) AtomicIIncrement 15 Device None
|
||||
17: 7(int) Load 10(c)
|
||||
ReturnValue 17
|
||||
FunctionEnd
|
||||
13(atoms(): 2 Function None 3
|
||||
14: Label
|
||||
38(origi): 37(ptr) Variable Function
|
||||
44(origu): 8(ptr) Variable Function
|
||||
41: 29(int) Load 40(atomi)
|
||||
43: 29(int) AtomicIAdd 41 Device None 42
|
||||
Store 38(origi) 43
|
||||
47: 7(int) Load 46(atomu)
|
||||
49: 7(int) Load 48(value)
|
||||
50: 7(int) AtomicAnd 47 Device None 49
|
||||
Store 44(origu) 50
|
||||
51: 7(int) Load 46(atomu)
|
||||
53: 7(int) AtomicOr 51 Device None 52
|
||||
Store 44(origu) 53
|
||||
54: 7(int) Load 46(atomu)
|
||||
55: 7(int) AtomicXor 54 Device None 52
|
||||
Store 44(origu) 55
|
||||
56: 7(int) Load 46(atomu)
|
||||
57: 7(int) Load 48(value)
|
||||
58: 7(int) AtomicIMin 56 Device None 57
|
||||
Store 44(origu) 58
|
||||
59: 29(int) Load 40(atomi)
|
||||
61: 29(int) AtomicIMax 59 Device None 60
|
||||
Store 38(origi) 61
|
||||
62: 29(int) Load 40(atomi)
|
||||
63: 29(int) Load 38(origi)
|
||||
64: 29(int) AtomicExchange 62 Device None 63
|
||||
Store 38(origi) 64
|
||||
65: 7(int) Load 46(atomu)
|
||||
67: 7(int) Load 48(value)
|
||||
68: 7(int) AtomicCompareExchange 65 Device None 66 67
|
||||
Store 44(origu) 68
|
||||
Return
|
||||
FunctionEnd
|
||||
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);
|
||||
}
|
||||
@@ -78,3 +78,4 @@ spv.varyingArray.frag
|
||||
spv.varyingArrayIndirect.frag
|
||||
spv.voidFunction.frag
|
||||
spv.whileLoop.frag
|
||||
spv.atomic.comp
|
||||
|
||||
Reference in New Issue
Block a user