glslang/Test/baseResults/spv.structCopy.comp.out
Arcady Goldmints-Orlov 094b567af7 Add tests for conditionals that return a struct value
There are 3 separate tests added to cover the 3 cases in
visitSelection(). With SPIR-V versions prior to 1.4, control flow is
generated, with GLSL generating code to execute only the appropriate
branch of the conditional while HLSL executes both branches and uses the
control flow to select the appropriate one. Finally, with SPIR-V
versions newer than 1.4, OpSelect can be used on structs.

Note that the hlsl.structcopy.comp and hlsl.structcopylogical.comp tests
have identical shader code, but are compiled with different versions of
SPIR-V and result in different codepaths being used and different SPIR-V
generated.
2023-12-11 20:03:15 +00:00

143 lines
7.1 KiB
Plaintext

spv.structCopy.comp
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 81
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 24
ExecutionMode 4 LocalSize 512 1 1
Source GLSL 460
Name 4 "main"
Name 7 "MyStruct"
MemberName 7(MyStruct) 0 "a"
MemberName 7(MyStruct) 1 "b"
MemberName 7(MyStruct) 2 "c"
Name 11 "s"
Name 21 "id"
Name 24 "gl_GlobalInvocationID"
Name 30 "ms"
Name 32 "MyStruct"
MemberName 32(MyStruct) 0 "a"
MemberName 32(MyStruct) 1 "b"
MemberName 32(MyStruct) 2 "c"
Name 34 "MyStructs"
MemberName 34(MyStructs) 0 "count"
MemberName 34(MyStructs) 1 "data"
Name 36 "my_structs"
Name 65 "Output"
MemberName 65(Output) 0 "a"
MemberName 65(Output) 1 "b"
MemberName 65(Output) 2 "c"
Name 67 "o"
Decorate 24(gl_GlobalInvocationID) BuiltIn GlobalInvocationId
MemberDecorate 32(MyStruct) 0 Offset 0
MemberDecorate 32(MyStruct) 1 Offset 4
MemberDecorate 32(MyStruct) 2 Offset 8
Decorate 33 ArrayStride 12
MemberDecorate 34(MyStructs) 0 Offset 0
MemberDecorate 34(MyStructs) 1 Offset 4
Decorate 34(MyStructs) BufferBlock
Decorate 36(my_structs) DescriptorSet 0
Decorate 36(my_structs) Binding 0
MemberDecorate 65(Output) 0 Offset 0
MemberDecorate 65(Output) 1 Offset 4
MemberDecorate 65(Output) 2 Offset 8
Decorate 65(Output) BufferBlock
Decorate 67(o) DescriptorSet 0
Decorate 67(o) Binding 1
Decorate 80 BuiltIn WorkgroupSize
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7(MyStruct): TypeStruct 6(int) 6(int) 6(int)
8: 6(int) Constant 512
9: TypeArray 7(MyStruct) 8
10: TypePointer Workgroup 9
11(s): 10(ptr) Variable Workgroup
12: TypeInt 32 1
13: 12(int) Constant 0
14: 6(int) Constant 1
15: 6(int) Constant 2
16: 6(int) Constant 3
17: 7(MyStruct) ConstantComposite 14 15 16
18: TypePointer Workgroup 7(MyStruct)
20: TypePointer Function 6(int)
22: TypeVector 6(int) 3
23: TypePointer Input 22(ivec3)
24(gl_GlobalInvocationID): 23(ptr) Variable Input
25: 6(int) Constant 0
26: TypePointer Input 6(int)
29: TypePointer Function 7(MyStruct)
32(MyStruct): TypeStruct 6(int) 6(int) 6(int)
33: TypeRuntimeArray 32(MyStruct)
34(MyStructs): TypeStruct 6(int) 33
35: TypePointer Uniform 34(MyStructs)
36(my_structs): 35(ptr) Variable Uniform
37: TypePointer Uniform 6(int)
40: TypeBool
52: 12(int) Constant 1
54: TypePointer Uniform 32(MyStruct)
62: 12(int) Constant 2
65(Output): TypeStruct 6(int) 6(int) 6(int)
66: TypePointer Uniform 65(Output)
67(o): 66(ptr) Variable Uniform
80: 22(ivec3) ConstantComposite 8 14 14
4(main): 2 Function None 3
5: Label
21(id): 20(ptr) Variable Function
30(ms): 29(ptr) Variable Function
42: 29(ptr) Variable Function
19: 18(ptr) AccessChain 11(s) 13
Store 19 17
27: 26(ptr) AccessChain 24(gl_GlobalInvocationID) 25
28: 6(int) Load 27
Store 21(id) 28
31: 6(int) Load 21(id)
38: 37(ptr) AccessChain 36(my_structs) 13
39: 6(int) Load 38
41: 40(bool) UGreaterThan 31 39
SelectionMerge 44 None
BranchConditional 41 43 51
43: Label
45: 6(int) Load 21(id)
46: 37(ptr) AccessChain 36(my_structs) 13
47: 6(int) Load 46
48: 6(int) ISub 45 47
49: 18(ptr) AccessChain 11(s) 48
50: 7(MyStruct) Load 49
Store 42 50
Branch 44
51: Label
53: 6(int) Load 21(id)
55: 54(ptr) AccessChain 36(my_structs) 52 53
56:32(MyStruct) Load 55
57: 6(int) CompositeExtract 56 0
58: 20(ptr) AccessChain 42 13
Store 58 57
59: 6(int) CompositeExtract 56 1
60: 20(ptr) AccessChain 42 52
Store 60 59
61: 6(int) CompositeExtract 56 2
63: 20(ptr) AccessChain 42 62
Store 63 61
Branch 44
44: Label
64: 7(MyStruct) Load 42
Store 30(ms) 64
68: 37(ptr) AccessChain 67(o) 13
69: 20(ptr) AccessChain 30(ms) 13
70: 6(int) Load 69
71: 6(int) AtomicIAdd 68 14 25 70
72: 37(ptr) AccessChain 67(o) 52
73: 20(ptr) AccessChain 30(ms) 52
74: 6(int) Load 73
75: 6(int) AtomicIAdd 72 14 25 74
76: 37(ptr) AccessChain 67(o) 62
77: 20(ptr) AccessChain 30(ms) 62
78: 6(int) Load 77
79: 6(int) AtomicIAdd 76 14 25 78
Return
FunctionEnd