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

@@ -7,9 +7,9 @@ gl_FragCoord origin is upper left
0:12 'pos' (in uint)
0:? Sequence
0:13 move second child to first child (temp float)
0:13 indirect index (layout(row_major std430 ) temp float)
0:13 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:13 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:13 indirect index (layout(row_major std430 ) buffer float)
0:13 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:13 'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float @data})
0:13 Constant:
0:13 0 (const uint)
0:13 add (temp uint)
@@ -22,8 +22,8 @@ gl_FragCoord origin is upper left
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:17 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
@@ -33,9 +33,9 @@ gl_FragCoord origin is upper left
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:19 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:19 indirect index (layout(row_major std430 ) buffer structure{temp 3-component vector of float color, temp bool test})
0:19 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
@@ -46,17 +46,17 @@ gl_FragCoord origin is upper left
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:20 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:20 indirect index (layout(row_major std430 ) buffer structure{temp 3-component vector of float color, temp bool test})
0:20 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:20 indirect index (layout(row_major std430 ) buffer float)
0:20 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:20 'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float @data})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
@@ -80,8 +80,8 @@ gl_FragCoord origin is upper left
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:? 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:? 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:? 'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float @data})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
@@ -97,9 +97,9 @@ gl_FragCoord origin is upper left
0:12 'pos' (in uint)
0:? Sequence
0:13 move second child to first child (temp float)
0:13 indirect index (layout(row_major std430 ) temp float)
0:13 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:13 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:13 indirect index (layout(row_major std430 ) buffer float)
0:13 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:13 'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float @data})
0:13 Constant:
0:13 0 (const uint)
0:13 add (temp uint)
@@ -112,8 +112,8 @@ gl_FragCoord origin is upper left
0:17 move second child to first child (temp uint)
0:17 'size' (temp uint)
0:17 array length (temp uint)
0:17 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:17 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:17 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:17 Constant:
0:17 0 (const uint)
0:17 move second child to first child (temp uint)
@@ -123,9 +123,9 @@ gl_FragCoord origin is upper left
0:19 Test condition and select (temp void)
0:19 Condition
0:19 test: direct index for structure (temp bool)
0:19 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:19 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:19 indirect index (layout(row_major std430 ) buffer structure{temp 3-component vector of float color, temp bool test})
0:19 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:19 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:19 Constant:
0:19 0 (const uint)
0:19 'pos' (in uint)
@@ -136,17 +136,17 @@ gl_FragCoord origin is upper left
0:? Construct vec4 (temp 4-component vector of float)
0:20 add (temp 3-component vector of float)
0:20 color: direct index for structure (temp 3-component vector of float)
0:20 indirect index (layout(row_major std430 ) temp structure{temp 3-component vector of float color, temp bool test})
0:20 sbuf: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:20 indirect index (layout(row_major std430 ) buffer structure{temp 3-component vector of float color, temp bool test})
0:20 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test})
0:20 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
0:20 Constant:
0:20 0 (const int)
0:20 indirect index (layout(row_major std430 ) temp float)
0:20 sbuf2: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:20 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:20 indirect index (layout(row_major std430 ) buffer float)
0:20 @data: direct index for structure (layout(row_major std430 ) buffer implicitly-sized array of float)
0:20 'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float @data})
0:20 Constant:
0:20 0 (const uint)
0:20 'pos' (in uint)
@@ -170,8 +170,8 @@ gl_FragCoord origin is upper left
0:12 Function Call: @main(u1; (temp 4-component vector of float)
0:? 'pos' (temp uint)
0:? Linker Objects
0:? 'anon@0' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} sbuf})
0:? 'anon@1' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float sbuf2})
0:? 'sbuf' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test} @data})
0:? 'sbuf2' (layout(row_major std430 ) buffer block{layout(row_major std430 ) buffer implicitly-sized array of float @data})
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
0:? 'pos' (layout(location=0 ) in uint)
@@ -188,15 +188,15 @@ gl_FragCoord origin is upper left
Name 12 "@main(u1;"
Name 11 "pos"
Name 15 "sbuf2"
MemberName 15(sbuf2) 0 "sbuf2"
Name 17 ""
MemberName 15(sbuf2) 0 "@data"
Name 17 "sbuf2"
Name 26 "size"
Name 28 "sb_t"
MemberName 28(sb_t) 0 "color"
MemberName 28(sb_t) 1 "test"
Name 30 "sbuf"
MemberName 30(sbuf) 0 "sbuf"
Name 32 ""
MemberName 30(sbuf) 0 "@data"
Name 32 "sbuf"
Name 34 "stride"
Name 69 "pos"
Name 71 "pos"
@@ -205,13 +205,13 @@ gl_FragCoord origin is upper left
Decorate 14 ArrayStride 4
MemberDecorate 15(sbuf2) 0 Offset 0
Decorate 15(sbuf2) BufferBlock
Decorate 17 DescriptorSet 0
Decorate 17(sbuf2) DescriptorSet 0
MemberDecorate 28(sb_t) 0 Offset 0
MemberDecorate 28(sb_t) 1 Offset 12
Decorate 29 ArrayStride 16
MemberDecorate 30(sbuf) 0 Offset 0
Decorate 30(sbuf) BufferBlock
Decorate 32 DescriptorSet 0
Decorate 32(sbuf) DescriptorSet 0
Decorate 71(pos) Location 0
Decorate 74(@entryPointOutput) Location 0
2: TypeVoid
@@ -224,7 +224,7 @@ gl_FragCoord origin is upper left
14: TypeRuntimeArray 8(float)
15(sbuf2): TypeStruct 14
16: TypePointer Uniform 15(sbuf2)
17: 16(ptr) Variable Uniform
17(sbuf2): 16(ptr) Variable Uniform
18: TypeInt 32 1
19: 18(int) Constant 0
21: 6(int) Constant 1
@@ -235,7 +235,7 @@ gl_FragCoord origin is upper left
29: TypeRuntimeArray 28(sb_t)
30(sbuf): TypeStruct 29
31: TypePointer Uniform 30(sbuf)
32: 31(ptr) Variable Uniform
32(sbuf): 31(ptr) Variable Uniform
35: 6(int) Constant 16
37: 18(int) Constant 1
38: TypePointer Uniform 6(int)
@@ -266,23 +266,23 @@ gl_FragCoord origin is upper left
34(stride): 7(ptr) Variable Function
20: 6(int) Load 11(pos)
22: 6(int) IAdd 20 21
25: 24(ptr) AccessChain 17 19 22
25: 24(ptr) AccessChain 17(sbuf2) 19 22
Store 25 23
33: 18(int) ArrayLength 32 0
33: 18(int) ArrayLength 32(sbuf) 0
Store 26(size) 33
Store 34(stride) 35
36: 6(int) Load 11(pos)
39: 38(ptr) AccessChain 32 19 36 37
39: 38(ptr) AccessChain 32(sbuf) 19 36 37
40: 6(int) Load 39
43: 41(bool) INotEqual 40 42
SelectionMerge 45 None
BranchConditional 43 44 61
44: Label
46: 6(int) Load 11(pos)
48: 47(ptr) AccessChain 32 19 46 19
48: 47(ptr) AccessChain 32(sbuf) 19 46 19
49: 27(fvec3) Load 48
50: 6(int) Load 11(pos)
51: 24(ptr) AccessChain 17 19 50
51: 24(ptr) AccessChain 17(sbuf2) 19 50
52: 8(float) Load 51
53: 27(fvec3) CompositeConstruct 52 52 52
54: 27(fvec3) FAdd 49 53