HLSL: implement 4 (of 6) structuredbuffer types
This is a partial implemention of structurebuffers supporting: * structured buffer types of: * StructuredBuffer * RWStructuredBuffer * ByteAddressBuffer * RWByteAddressBuffer * Atomic operations on RWByteAddressBuffer * Load/Load[234], Store/Store[234], GetDimensions methods (where allowed by type) * globallycoherent flag But NOT yet supporting: * AppendStructuredBuffer / ConsumeStructuredBuffer types * IncrementCounter/DecrementCounter methods Please note: the stride returned by GetDimensions is as calculated by glslang for std430, and may not match other environments in all cases.
This commit is contained in:
347
Test/baseResults/hlsl.structbuffer.frag.out
Normal file
347
Test/baseResults/hlsl.structbuffer.frag.out
Normal file
@@ -0,0 +1,347 @@
|
||||
hlsl.structbuffer.frag
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
|
||||
0:12 Function Parameters:
|
||||
0:12 'pos' (in uint)
|
||||
0:? Sequence
|
||||
0:13 Sequence
|
||||
0:13 move second child to first child (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 indirect index (layout(binding=10 row_major std430 ) readonly buffer structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:13 Constant:
|
||||
0:13 0 (const uint)
|
||||
0:13 'pos' (in uint)
|
||||
0:17 Sequence
|
||||
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(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:17 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:17 Constant:
|
||||
0:17 0 (const uint)
|
||||
0:17 move second child to first child (temp uint)
|
||||
0:17 'stride' (temp uint)
|
||||
0:17 Constant:
|
||||
0:17 32 (const uint)
|
||||
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(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:19 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:19 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:19 Constant:
|
||||
0:19 0 (const uint)
|
||||
0:19 'pos' (in uint)
|
||||
0:19 Constant:
|
||||
0:19 1 (const int)
|
||||
0:19 true case
|
||||
0:20 Branch: Return with expression
|
||||
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(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:20 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:20 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
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 ) readonly temp float)
|
||||
0:20 sbuf2: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of float)
|
||||
0:20 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
|
||||
0:20 Constant:
|
||||
0:20 0 (const uint)
|
||||
0:20 'pos' (in uint)
|
||||
0:20 Constant:
|
||||
0:20 0.000000
|
||||
0:19 false case
|
||||
0:22 Branch: Return with expression
|
||||
0:22 Construct vec4 (temp 4-component vector of float)
|
||||
0:22 add (temp float)
|
||||
0:22 add (temp float)
|
||||
0:22 direct index (temp float)
|
||||
0:22 color: direct index for structure (temp 3-component vector of float)
|
||||
0:22 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:22 Constant:
|
||||
0:22 0 (const int)
|
||||
0:22 Constant:
|
||||
0:22 0 (const int)
|
||||
0:22 Convert uint to float (temp float)
|
||||
0:22 'size' (temp uint)
|
||||
0:22 Convert uint to float (temp float)
|
||||
0:22 'stride' (temp uint)
|
||||
0:12 Function Definition: main( (temp void)
|
||||
0:12 Function Parameters:
|
||||
0:? Sequence
|
||||
0:12 move second child to first child (temp uint)
|
||||
0:? 'pos' (temp uint)
|
||||
0:? 'pos' (layout(location=0 ) in uint)
|
||||
0:12 move second child to first child (temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
||||
0:12 Function Call: @main(u1; (temp 4-component vector of float)
|
||||
0:? 'pos' (temp uint)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:? 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
|
||||
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
||||
0:? 'pos' (layout(location=0 ) in uint)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:12 Function Definition: @main(u1; (temp 4-component vector of float)
|
||||
0:12 Function Parameters:
|
||||
0:12 'pos' (in uint)
|
||||
0:? Sequence
|
||||
0:13 Sequence
|
||||
0:13 move second child to first child (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 indirect index (layout(binding=10 row_major std430 ) readonly buffer structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:13 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:13 Constant:
|
||||
0:13 0 (const uint)
|
||||
0:13 'pos' (in uint)
|
||||
0:17 Sequence
|
||||
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(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:17 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:17 Constant:
|
||||
0:17 0 (const uint)
|
||||
0:17 move second child to first child (temp uint)
|
||||
0:17 'stride' (temp uint)
|
||||
0:17 Constant:
|
||||
0:17 32 (const uint)
|
||||
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(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:19 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:19 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:19 Constant:
|
||||
0:19 0 (const uint)
|
||||
0:19 'pos' (in uint)
|
||||
0:19 Constant:
|
||||
0:19 1 (const int)
|
||||
0:19 true case
|
||||
0:20 Branch: Return with expression
|
||||
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(binding=10 row_major std430 ) readonly temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:20 sbuf: direct index for structure (layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:20 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
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 ) readonly temp float)
|
||||
0:20 sbuf2: direct index for structure (layout(row_major std430 ) readonly buffer implicitly-sized array of float)
|
||||
0:20 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
|
||||
0:20 Constant:
|
||||
0:20 0 (const uint)
|
||||
0:20 'pos' (in uint)
|
||||
0:20 Constant:
|
||||
0:20 0.000000
|
||||
0:19 false case
|
||||
0:22 Branch: Return with expression
|
||||
0:22 Construct vec4 (temp 4-component vector of float)
|
||||
0:22 add (temp float)
|
||||
0:22 add (temp float)
|
||||
0:22 direct index (temp float)
|
||||
0:22 color: direct index for structure (temp 3-component vector of float)
|
||||
0:22 'mydata' (temp structure{temp 3-component vector of float color, temp bool test, temp bool test2})
|
||||
0:22 Constant:
|
||||
0:22 0 (const int)
|
||||
0:22 Constant:
|
||||
0:22 0 (const int)
|
||||
0:22 Convert uint to float (temp float)
|
||||
0:22 'size' (temp uint)
|
||||
0:22 Convert uint to float (temp float)
|
||||
0:22 'stride' (temp uint)
|
||||
0:12 Function Definition: main( (temp void)
|
||||
0:12 Function Parameters:
|
||||
0:? Sequence
|
||||
0:12 move second child to first child (temp uint)
|
||||
0:? 'pos' (temp uint)
|
||||
0:? 'pos' (layout(location=0 ) in uint)
|
||||
0:12 move second child to first child (temp 4-component vector of float)
|
||||
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
||||
0:12 Function Call: @main(u1; (temp 4-component vector of float)
|
||||
0:? 'pos' (temp uint)
|
||||
0:? Linker Objects
|
||||
0:? 'anon@0' (layout(binding=10 row_major std430 ) readonly buffer block{layout(binding=10 row_major std430 ) readonly buffer implicitly-sized array of structure{temp 3-component vector of float color, temp bool test, temp bool test2} sbuf})
|
||||
0:? 'anon@1' (layout(row_major std430 ) readonly buffer block{layout(row_major std430 ) readonly buffer implicitly-sized array of float sbuf2})
|
||||
0:? '@entryPointOutput' (layout(location=0 ) out 4-component vector of float)
|
||||
0:? 'pos' (layout(location=0 ) in uint)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 94
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 87 90
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "main"
|
||||
Name 12 "@main(u1;"
|
||||
Name 11 "pos"
|
||||
Name 16 "sb_t"
|
||||
MemberName 16(sb_t) 0 "color"
|
||||
MemberName 16(sb_t) 1 "test"
|
||||
MemberName 16(sb_t) 2 "test2"
|
||||
Name 18 "mydata"
|
||||
Name 19 "sb_t"
|
||||
MemberName 19(sb_t) 0 "color"
|
||||
MemberName 19(sb_t) 1 "test"
|
||||
MemberName 19(sb_t) 2 "test2"
|
||||
Name 21 "sbuf"
|
||||
MemberName 21(sbuf) 0 "sbuf"
|
||||
Name 23 ""
|
||||
Name 40 "size"
|
||||
Name 42 "stride"
|
||||
Name 57 "sbuf2"
|
||||
MemberName 57(sbuf2) 0 "sbuf2"
|
||||
Name 59 ""
|
||||
Name 85 "pos"
|
||||
Name 87 "pos"
|
||||
Name 90 "@entryPointOutput"
|
||||
Name 91 "param"
|
||||
MemberDecorate 19(sb_t) 0 NonWritable
|
||||
MemberDecorate 19(sb_t) 0 Offset 0
|
||||
MemberDecorate 19(sb_t) 1 NonWritable
|
||||
MemberDecorate 19(sb_t) 1 Offset 12
|
||||
MemberDecorate 19(sb_t) 2 NonWritable
|
||||
MemberDecorate 19(sb_t) 2 Offset 16
|
||||
Decorate 20 ArrayStride 32
|
||||
MemberDecorate 21(sbuf) 0 NonWritable
|
||||
MemberDecorate 21(sbuf) 0 Offset 0
|
||||
Decorate 21(sbuf) BufferBlock
|
||||
Decorate 23 DescriptorSet 0
|
||||
Decorate 23 Binding 10
|
||||
Decorate 56 ArrayStride 4
|
||||
MemberDecorate 57(sbuf2) 0 NonWritable
|
||||
MemberDecorate 57(sbuf2) 0 Offset 0
|
||||
Decorate 57(sbuf2) BufferBlock
|
||||
Decorate 59 DescriptorSet 0
|
||||
Decorate 87(pos) Location 0
|
||||
Decorate 90(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeInt 32 0
|
||||
7: TypePointer Function 6(int)
|
||||
8: TypeFloat 32
|
||||
9: TypeVector 8(float) 4
|
||||
10: TypeFunction 9(fvec4) 7(ptr)
|
||||
14: TypeVector 8(float) 3
|
||||
15: TypeBool
|
||||
16(sb_t): TypeStruct 14(fvec3) 15(bool) 15(bool)
|
||||
17: TypePointer Function 16(sb_t)
|
||||
19(sb_t): TypeStruct 14(fvec3) 6(int) 6(int)
|
||||
20: TypeRuntimeArray 19(sb_t)
|
||||
21(sbuf): TypeStruct 20
|
||||
22: TypePointer Uniform 21(sbuf)
|
||||
23: 22(ptr) Variable Uniform
|
||||
24: TypeInt 32 1
|
||||
25: 24(int) Constant 0
|
||||
27: TypePointer Uniform 19(sb_t)
|
||||
31: TypePointer Function 14(fvec3)
|
||||
34: 24(int) Constant 1
|
||||
35: TypePointer Function 15(bool)
|
||||
38: 24(int) Constant 2
|
||||
43: 6(int) Constant 32
|
||||
45: TypePointer Uniform 6(int)
|
||||
48: 6(int) Constant 0
|
||||
53: TypePointer Uniform 14(fvec3)
|
||||
56: TypeRuntimeArray 8(float)
|
||||
57(sbuf2): TypeStruct 56
|
||||
58: TypePointer Uniform 57(sbuf2)
|
||||
59: 58(ptr) Variable Uniform
|
||||
61: TypePointer Uniform 8(float)
|
||||
66: 8(float) Constant 0
|
||||
73: TypePointer Function 8(float)
|
||||
86: TypePointer Input 6(int)
|
||||
87(pos): 86(ptr) Variable Input
|
||||
89: TypePointer Output 9(fvec4)
|
||||
90(@entryPointOutput): 89(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
85(pos): 7(ptr) Variable Function
|
||||
91(param): 7(ptr) Variable Function
|
||||
88: 6(int) Load 87(pos)
|
||||
Store 85(pos) 88
|
||||
92: 6(int) Load 85(pos)
|
||||
Store 91(param) 92
|
||||
93: 9(fvec4) FunctionCall 12(@main(u1;) 91(param)
|
||||
Store 90(@entryPointOutput) 93
|
||||
Return
|
||||
FunctionEnd
|
||||
12(@main(u1;): 9(fvec4) Function None 10
|
||||
11(pos): 7(ptr) FunctionParameter
|
||||
13: Label
|
||||
18(mydata): 17(ptr) Variable Function
|
||||
40(size): 7(ptr) Variable Function
|
||||
42(stride): 7(ptr) Variable Function
|
||||
26: 6(int) Load 11(pos)
|
||||
28: 27(ptr) AccessChain 23 25 26
|
||||
29: 19(sb_t) Load 28
|
||||
30: 14(fvec3) CompositeExtract 29 0
|
||||
32: 31(ptr) AccessChain 18(mydata) 25
|
||||
Store 32 30
|
||||
33: 6(int) CompositeExtract 29 1
|
||||
36: 35(ptr) AccessChain 18(mydata) 34
|
||||
Store 36 33
|
||||
37: 6(int) CompositeExtract 29 2
|
||||
39: 35(ptr) AccessChain 18(mydata) 38
|
||||
Store 39 37
|
||||
41: 24(int) ArrayLength 23 0
|
||||
Store 40(size) 41
|
||||
Store 42(stride) 43
|
||||
44: 6(int) Load 11(pos)
|
||||
46: 45(ptr) AccessChain 23 25 44 34
|
||||
47: 6(int) Load 46
|
||||
49: 15(bool) INotEqual 47 48
|
||||
SelectionMerge 51 None
|
||||
BranchConditional 49 50 72
|
||||
50: Label
|
||||
52: 6(int) Load 11(pos)
|
||||
54: 53(ptr) AccessChain 23 25 52 25
|
||||
55: 14(fvec3) Load 54
|
||||
60: 6(int) Load 11(pos)
|
||||
62: 61(ptr) AccessChain 59 25 60
|
||||
63: 8(float) Load 62
|
||||
64: 14(fvec3) CompositeConstruct 63 63 63
|
||||
65: 14(fvec3) FAdd 55 64
|
||||
67: 8(float) CompositeExtract 65 0
|
||||
68: 8(float) CompositeExtract 65 1
|
||||
69: 8(float) CompositeExtract 65 2
|
||||
70: 9(fvec4) CompositeConstruct 67 68 69 66
|
||||
ReturnValue 70
|
||||
72: Label
|
||||
74: 73(ptr) AccessChain 18(mydata) 25 48
|
||||
75: 8(float) Load 74
|
||||
76: 6(int) Load 40(size)
|
||||
77: 8(float) ConvertUToF 76
|
||||
78: 8(float) FAdd 75 77
|
||||
79: 6(int) Load 42(stride)
|
||||
80: 8(float) ConvertUToF 79
|
||||
81: 8(float) FAdd 78 80
|
||||
82: 9(fvec4) CompositeConstruct 81 81 81 81
|
||||
ReturnValue 82
|
||||
51: Label
|
||||
84: 9(fvec4) Undef
|
||||
ReturnValue 84
|
||||
FunctionEnd
|
||||
Reference in New Issue
Block a user