WIP: HLSL: add structuredbuffer pass by reference in fn params

This PR adds the ability to pass structuredbuffer types by reference
as function parameters.

It also changes the representation of structuredbuffers from anonymous
blocks with named members, to named blocks with pseudonymous members.
That should not be an externally visible change.
This commit is contained in:
steve-lunarg
2017-02-23 18:04:12 -07:00
parent 4a57dced66
commit dd8287a109
15 changed files with 975 additions and 558 deletions

View File

@@ -10,8 +10,8 @@ gl_FragCoord origin is upper left
0:7 move second child to first child (temp uint)
0:7 'size' (temp uint)
0:7 array length (temp uint)
0:7 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:7 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:7 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:7 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:7 Constant:
0:7 0 (const uint)
0:12 Branch: Return with expression
@@ -19,9 +19,9 @@ gl_FragCoord origin is upper left
0:10 add (temp 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:9 Convert uint to float (temp float)
0:9 indirect index (layout(row_major std430 ) readonly buffer uint)
0:9 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:9 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:9 indirect index (layout(row_major std430 ) buffer uint)
0:9 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:9 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:9 Constant:
0:9 0 (const uint)
0:9 right-shift (temp int)
@@ -42,14 +42,14 @@ gl_FragCoord origin is upper left
0:10 2 (const int)
0:? Construct vec2 (temp 2-component vector of uint)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 'byteAddrTemp' (temp int)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 add (temp int)
@@ -74,14 +74,14 @@ gl_FragCoord origin is upper left
0:11 2 (const int)
0:? Construct vec3 (temp 3-component vector of uint)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 'byteAddrTemp' (temp int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
@@ -89,8 +89,8 @@ gl_FragCoord origin is upper left
0:11 Constant:
0:11 1 (const int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
@@ -112,14 +112,14 @@ gl_FragCoord origin is upper left
0:12 2 (const int)
0:? Construct vec4 (temp 4-component vector of uint)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 'byteAddrTemp' (temp int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
@@ -127,8 +127,8 @@ gl_FragCoord origin is upper left
0:12 Constant:
0:12 1 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
@@ -136,8 +136,8 @@ gl_FragCoord origin is upper left
0:12 Constant:
0:12 2 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
@@ -155,7 +155,7 @@ gl_FragCoord origin is upper left
0:5 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:? 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
@@ -174,8 +174,8 @@ gl_FragCoord origin is upper left
0:7 move second child to first child (temp uint)
0:7 'size' (temp uint)
0:7 array length (temp uint)
0:7 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:7 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:7 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:7 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:7 Constant:
0:7 0 (const uint)
0:12 Branch: Return with expression
@@ -183,9 +183,9 @@ gl_FragCoord origin is upper left
0:10 add (temp 4-component vector of float)
0:9 add (temp 4-component vector of float)
0:9 Convert uint to float (temp float)
0:9 indirect index (layout(row_major std430 ) readonly buffer uint)
0:9 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:9 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:9 indirect index (layout(row_major std430 ) buffer uint)
0:9 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:9 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:9 Constant:
0:9 0 (const uint)
0:9 right-shift (temp int)
@@ -206,14 +206,14 @@ gl_FragCoord origin is upper left
0:10 2 (const int)
0:? Construct vec2 (temp 2-component vector of uint)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 'byteAddrTemp' (temp int)
0:10 indirect index (temp float)
0:10 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:10 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:10 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:10 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:10 Constant:
0:10 0 (const uint)
0:10 add (temp int)
@@ -238,14 +238,14 @@ gl_FragCoord origin is upper left
0:11 2 (const int)
0:? Construct vec3 (temp 3-component vector of uint)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 'byteAddrTemp' (temp int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
@@ -253,8 +253,8 @@ gl_FragCoord origin is upper left
0:11 Constant:
0:11 1 (const int)
0:11 indirect index (temp float)
0:11 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:11 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:11 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:11 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:11 Constant:
0:11 0 (const uint)
0:11 add (temp int)
@@ -276,14 +276,14 @@ gl_FragCoord origin is upper left
0:12 2 (const int)
0:? Construct vec4 (temp 4-component vector of uint)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 'byteAddrTemp' (temp int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
@@ -291,8 +291,8 @@ gl_FragCoord origin is upper left
0:12 Constant:
0:12 1 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
@@ -300,8 +300,8 @@ gl_FragCoord origin is upper left
0:12 Constant:
0:12 2 (const int)
0:12 indirect index (temp float)
0:12 sbuf: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of uint)
0:12 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:12 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of uint)
0:12 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:12 Constant:
0:12 0 (const uint)
0:12 add (temp int)
@@ -319,7 +319,7 @@ gl_FragCoord origin is upper left
0:5 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of uint sbuf})
0:? 'sbuf' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) buffer implicitly-sized array of uint @data})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
@@ -337,8 +337,8 @@ gl_FragCoord origin is upper left
Name 11 "pos"
Name 14 "size"
Name 16 "sbuf"
MemberName 16(sbuf) 0 "sbuf"
Name 18 ""
MemberName 16(sbuf) 0 "@data"
Name 18 "sbuf"
Name 30 "byteAddrTemp"
Name 53 "byteAddrTemp"
Name 78 "byteAddrTemp"
@@ -350,7 +350,7 @@ gl_FragCoord origin is upper left
MemberDecorate 16(sbuf) 0 NonWritable
MemberDecorate 16(sbuf) 0 Offset 0
Decorate 16(sbuf) BufferBlock
Decorate 18 DescriptorSet 0
Decorate 18(sbuf) DescriptorSet 0
Decorate 107(pos) Location 0
Decorate 110(@entryPointOutput) Location 0
2: TypeVoid
@@ -363,7 +363,7 @@ gl_FragCoord origin is upper left
15: TypeRuntimeArray 6(int)
16(sbuf): TypeStruct 15
17: TypePointer Uniform 16(sbuf)
18: 17(ptr) Variable Uniform
18(sbuf): 17(ptr) Variable Uniform
19: TypeInt 32 1
21: 19(int) Constant 0
23: 19(int) Constant 2
@@ -403,11 +403,11 @@ gl_FragCoord origin is upper left
30(byteAddrTemp): 29(ptr) Variable Function
53(byteAddrTemp): 29(ptr) Variable Function
78(byteAddrTemp): 29(ptr) Variable Function
20: 19(int) ArrayLength 18 0
20: 19(int) ArrayLength 18(sbuf) 0
Store 14(size) 20
22: 6(int) Load 11(pos)
24: 19(int) ShiftRightLogical 22 23
26: 25(ptr) AccessChain 18 21 24
26: 25(ptr) AccessChain 18(sbuf) 21 24
27: 6(int) Load 26
28: 8(float) ConvertUToF 27
31: 6(int) Load 11(pos)
@@ -415,11 +415,11 @@ gl_FragCoord origin is upper left
34: 19(int) ShiftRightLogical 33 23
Store 30(byteAddrTemp) 34
35: 19(int) Load 30(byteAddrTemp)
36: 25(ptr) AccessChain 18 21 35
36: 25(ptr) AccessChain 18(sbuf) 21 35
37: 6(int) Load 36
38: 19(int) Load 30(byteAddrTemp)
40: 19(int) IAdd 38 39
41: 25(ptr) AccessChain 18 21 40
41: 25(ptr) AccessChain 18(sbuf) 21 40
42: 6(int) Load 41
44: 43(ivec2) CompositeConstruct 37 42
46: 45(fvec2) ConvertUToF 44
@@ -433,15 +433,15 @@ gl_FragCoord origin is upper left
57: 19(int) ShiftRightLogical 56 23
Store 53(byteAddrTemp) 57
58: 19(int) Load 53(byteAddrTemp)
59: 25(ptr) AccessChain 18 21 58
59: 25(ptr) AccessChain 18(sbuf) 21 58
60: 6(int) Load 59
61: 19(int) Load 53(byteAddrTemp)
62: 19(int) IAdd 61 39
63: 25(ptr) AccessChain 18 21 62
63: 25(ptr) AccessChain 18(sbuf) 21 62
64: 6(int) Load 63
65: 19(int) Load 53(byteAddrTemp)
66: 19(int) IAdd 65 23
67: 25(ptr) AccessChain 18 21 66
67: 25(ptr) AccessChain 18(sbuf) 21 66
68: 6(int) Load 67
70: 69(ivec3) CompositeConstruct 60 64 68
72: 71(fvec3) ConvertUToF 70
@@ -455,19 +455,19 @@ gl_FragCoord origin is upper left
82: 19(int) ShiftRightLogical 81 23
Store 78(byteAddrTemp) 82
83: 19(int) Load 78(byteAddrTemp)
84: 25(ptr) AccessChain 18 21 83
84: 25(ptr) AccessChain 18(sbuf) 21 83
85: 6(int) Load 84
86: 19(int) Load 78(byteAddrTemp)
87: 19(int) IAdd 86 39
88: 25(ptr) AccessChain 18 21 87
88: 25(ptr) AccessChain 18(sbuf) 21 87
89: 6(int) Load 88
90: 19(int) Load 78(byteAddrTemp)
91: 19(int) IAdd 90 23
92: 25(ptr) AccessChain 18 21 91
92: 25(ptr) AccessChain 18(sbuf) 21 91
93: 6(int) Load 92
94: 19(int) Load 78(byteAddrTemp)
96: 19(int) IAdd 94 95
97: 25(ptr) AccessChain 18 21 96
97: 25(ptr) AccessChain 18(sbuf) 21 96
98: 6(int) Load 97
100: 99(ivec4) CompositeConstruct 85 89 93 98
101: 9(fvec4) ConvertUToF 100