
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.
386 lines
22 KiB
Plaintext
386 lines
22 KiB
Plaintext
hlsl.structcopylogical.comp
|
|
Shader version: 500
|
|
local_size = (128, 1, 1)
|
|
0:? Sequence
|
|
0:20 Function Definition: @main(u1; ( temp void)
|
|
0:20 Function Parameters:
|
|
0:20 'id' ( in uint)
|
|
0:? Sequence
|
|
0:21 move second child to first child ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:21 direct index ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:21 's' ( shared 128-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:21 Constant:
|
|
0:21 0 (const int)
|
|
0:21 Constant:
|
|
0:21 1 (const uint)
|
|
0:21 2 (const uint)
|
|
0:21 3 (const uint)
|
|
0:22 Sequence
|
|
0:22 move second child to first child ( temp uint)
|
|
0:22 'count' ( temp uint)
|
|
0:22 count: direct index for structure ( temp uint)
|
|
0:22 direct index (layout( row_major std430) buffer structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:22 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data} @data})
|
|
0:22 Constant:
|
|
0:22 0 (const uint)
|
|
0:22 Constant:
|
|
0:22 0 (const int)
|
|
0:22 Constant:
|
|
0:22 0 (const int)
|
|
0:23 Sequence
|
|
0:23 move second child to first child ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 Test condition and select ( temp structure{ temp uint a, temp uint b, temp uint c}): no shortcircuit
|
|
0:23 Condition
|
|
0:23 Compare Greater Than ( temp bool)
|
|
0:23 'id' ( in uint)
|
|
0:23 'count' ( temp uint)
|
|
0:23 true case
|
|
0:23 indirect index ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 's' ( shared 128-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 subtract ( temp uint)
|
|
0:23 'id' ( in uint)
|
|
0:23 'count' ( temp uint)
|
|
0:23 false case
|
|
0:23 indirect index ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 data: direct index for structure ( temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 direct index (layout( row_major std430) buffer structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:23 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:23 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data} @data})
|
|
0:23 Constant:
|
|
0:23 0 (const uint)
|
|
0:23 Constant:
|
|
0:23 0 (const int)
|
|
0:23 Constant:
|
|
0:23 1 (const int)
|
|
0:23 'id' ( in uint)
|
|
0:25 AtomicAdd ( temp uint)
|
|
0:25 a: direct index for structure ( temp uint)
|
|
0:25 direct index (layout( row_major std430) buffer structure{ temp uint a, temp uint b, temp uint c})
|
|
0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:25 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:25 Constant:
|
|
0:25 0 (const uint)
|
|
0:25 Constant:
|
|
0:25 0 (const int)
|
|
0:25 Constant:
|
|
0:25 0 (const int)
|
|
0:25 a: direct index for structure ( temp uint)
|
|
0:25 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:25 Constant:
|
|
0:25 0 (const int)
|
|
0:26 AtomicAdd ( temp uint)
|
|
0:26 b: direct index for structure ( temp uint)
|
|
0:26 direct index (layout( row_major std430) buffer structure{ temp uint a, temp uint b, temp uint c})
|
|
0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:26 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:26 Constant:
|
|
0:26 0 (const uint)
|
|
0:26 Constant:
|
|
0:26 0 (const int)
|
|
0:26 Constant:
|
|
0:26 1 (const int)
|
|
0:26 b: direct index for structure ( temp uint)
|
|
0:26 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:26 Constant:
|
|
0:26 1 (const int)
|
|
0:27 AtomicAdd ( temp uint)
|
|
0:27 c: direct index for structure ( temp uint)
|
|
0:27 direct index (layout( row_major std430) buffer structure{ temp uint a, temp uint b, temp uint c})
|
|
0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:27 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:27 Constant:
|
|
0:27 0 (const uint)
|
|
0:27 Constant:
|
|
0:27 0 (const int)
|
|
0:27 Constant:
|
|
0:27 2 (const int)
|
|
0:27 c: direct index for structure ( temp uint)
|
|
0:27 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:27 Constant:
|
|
0:27 2 (const int)
|
|
0:20 Function Definition: main( ( temp void)
|
|
0:20 Function Parameters:
|
|
0:? Sequence
|
|
0:20 move second child to first child ( temp uint)
|
|
0:? 'id' ( temp uint)
|
|
0:? 'id' ( in uint LocalInvocationIndex)
|
|
0:20 Function Call: @main(u1; ( temp void)
|
|
0:? 'id' ( temp uint)
|
|
0:? Linker Objects
|
|
0:? 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data} @data})
|
|
0:? 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:? 's' ( shared 128-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:? 'deflt' ( const structure{ temp uint a, temp uint b, temp uint c})
|
|
0:? 1 (const uint)
|
|
0:? 2 (const uint)
|
|
0:? 3 (const uint)
|
|
0:? 'id' ( in uint LocalInvocationIndex)
|
|
|
|
|
|
Linked compute stage:
|
|
|
|
|
|
Shader version: 500
|
|
local_size = (128, 1, 1)
|
|
0:? Sequence
|
|
0:20 Function Definition: @main(u1; ( temp void)
|
|
0:20 Function Parameters:
|
|
0:20 'id' ( in uint)
|
|
0:? Sequence
|
|
0:21 move second child to first child ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:21 direct index ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:21 's' ( shared 128-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:21 Constant:
|
|
0:21 0 (const int)
|
|
0:21 Constant:
|
|
0:21 1 (const uint)
|
|
0:21 2 (const uint)
|
|
0:21 3 (const uint)
|
|
0:22 Sequence
|
|
0:22 move second child to first child ( temp uint)
|
|
0:22 'count' ( temp uint)
|
|
0:22 count: direct index for structure ( temp uint)
|
|
0:22 direct index (layout( row_major std430) buffer structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:22 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data} @data})
|
|
0:22 Constant:
|
|
0:22 0 (const uint)
|
|
0:22 Constant:
|
|
0:22 0 (const int)
|
|
0:22 Constant:
|
|
0:22 0 (const int)
|
|
0:23 Sequence
|
|
0:23 move second child to first child ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 Test condition and select ( temp structure{ temp uint a, temp uint b, temp uint c}): no shortcircuit
|
|
0:23 Condition
|
|
0:23 Compare Greater Than ( temp bool)
|
|
0:23 'id' ( in uint)
|
|
0:23 'count' ( temp uint)
|
|
0:23 true case
|
|
0:23 indirect index ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 's' ( shared 128-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 subtract ( temp uint)
|
|
0:23 'id' ( in uint)
|
|
0:23 'count' ( temp uint)
|
|
0:23 false case
|
|
0:23 indirect index ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 data: direct index for structure ( temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:23 direct index (layout( row_major std430) buffer structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:23 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data})
|
|
0:23 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data} @data})
|
|
0:23 Constant:
|
|
0:23 0 (const uint)
|
|
0:23 Constant:
|
|
0:23 0 (const int)
|
|
0:23 Constant:
|
|
0:23 1 (const int)
|
|
0:23 'id' ( in uint)
|
|
0:25 AtomicAdd ( temp uint)
|
|
0:25 a: direct index for structure ( temp uint)
|
|
0:25 direct index (layout( row_major std430) buffer structure{ temp uint a, temp uint b, temp uint c})
|
|
0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:25 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:25 Constant:
|
|
0:25 0 (const uint)
|
|
0:25 Constant:
|
|
0:25 0 (const int)
|
|
0:25 Constant:
|
|
0:25 0 (const int)
|
|
0:25 a: direct index for structure ( temp uint)
|
|
0:25 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:25 Constant:
|
|
0:25 0 (const int)
|
|
0:26 AtomicAdd ( temp uint)
|
|
0:26 b: direct index for structure ( temp uint)
|
|
0:26 direct index (layout( row_major std430) buffer structure{ temp uint a, temp uint b, temp uint c})
|
|
0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:26 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:26 Constant:
|
|
0:26 0 (const uint)
|
|
0:26 Constant:
|
|
0:26 0 (const int)
|
|
0:26 Constant:
|
|
0:26 1 (const int)
|
|
0:26 b: direct index for structure ( temp uint)
|
|
0:26 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:26 Constant:
|
|
0:26 1 (const int)
|
|
0:27 AtomicAdd ( temp uint)
|
|
0:27 c: direct index for structure ( temp uint)
|
|
0:27 direct index (layout( row_major std430) buffer structure{ temp uint a, temp uint b, temp uint c})
|
|
0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:27 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:27 Constant:
|
|
0:27 0 (const uint)
|
|
0:27 Constant:
|
|
0:27 0 (const int)
|
|
0:27 Constant:
|
|
0:27 2 (const int)
|
|
0:27 c: direct index for structure ( temp uint)
|
|
0:27 'ms' ( temp structure{ temp uint a, temp uint b, temp uint c})
|
|
0:27 Constant:
|
|
0:27 2 (const int)
|
|
0:20 Function Definition: main( ( temp void)
|
|
0:20 Function Parameters:
|
|
0:? Sequence
|
|
0:20 move second child to first child ( temp uint)
|
|
0:? 'id' ( temp uint)
|
|
0:? 'id' ( in uint LocalInvocationIndex)
|
|
0:20 Function Call: @main(u1; ( temp void)
|
|
0:? 'id' ( temp uint)
|
|
0:? Linker Objects
|
|
0:? 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint count, temp unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} data} @data})
|
|
0:? 'o' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp uint a, temp uint b, temp uint c} @data})
|
|
0:? 's' ( shared 128-element array of structure{ temp uint a, temp uint b, temp uint c})
|
|
0:? 'deflt' ( const structure{ temp uint a, temp uint b, temp uint c})
|
|
0:? 1 (const uint)
|
|
0:? 2 (const uint)
|
|
0:? 3 (const uint)
|
|
0:? 'id' ( in uint LocalInvocationIndex)
|
|
|
|
// Module Version 10600
|
|
// Generated by (magic number): 8000b
|
|
// Id's are bound by 79
|
|
|
|
Capability Shader
|
|
1: ExtInstImport "GLSL.std.450"
|
|
MemoryModel Logical GLSL450
|
|
EntryPoint GLCompute 4 "main" 17 32 57 74
|
|
ExecutionModeId 4 LocalSizeId 7 8 8
|
|
Source HLSL 500
|
|
Name 4 "main"
|
|
Name 12 "@main(u1;"
|
|
Name 11 "id"
|
|
Name 14 "MyStruct"
|
|
MemberName 14(MyStruct) 0 "a"
|
|
MemberName 14(MyStruct) 1 "b"
|
|
MemberName 14(MyStruct) 2 "c"
|
|
Name 17 "s"
|
|
Name 25 "count"
|
|
Name 26 "MyStruct"
|
|
MemberName 26(MyStruct) 0 "a"
|
|
MemberName 26(MyStruct) 1 "b"
|
|
MemberName 26(MyStruct) 2 "c"
|
|
Name 28 "MyStructs"
|
|
MemberName 28(MyStructs) 0 "count"
|
|
MemberName 28(MyStructs) 1 "data"
|
|
Name 30 "sb"
|
|
MemberName 30(sb) 0 "@data"
|
|
Name 32 "sb"
|
|
Name 37 "ms"
|
|
Name 55 "o"
|
|
MemberName 55(o) 0 "@data"
|
|
Name 57 "o"
|
|
Name 72 "id"
|
|
Name 74 "id"
|
|
Name 76 "param"
|
|
MemberDecorate 26(MyStruct) 0 Offset 0
|
|
MemberDecorate 26(MyStruct) 1 Offset 4
|
|
MemberDecorate 26(MyStruct) 2 Offset 8
|
|
Decorate 27 ArrayStride 12
|
|
MemberDecorate 28(MyStructs) 0 Offset 0
|
|
MemberDecorate 28(MyStructs) 1 Offset 4
|
|
Decorate 28(MyStructs) Block
|
|
Decorate 29 ArrayStride 16
|
|
MemberDecorate 30(sb) 0 NonWritable
|
|
MemberDecorate 30(sb) 0 Offset 0
|
|
Decorate 30(sb) Block
|
|
Decorate 32(sb) DescriptorSet 0
|
|
Decorate 32(sb) Binding 0
|
|
Decorate 54 ArrayStride 12
|
|
MemberDecorate 55(o) 0 NonWritable
|
|
MemberDecorate 55(o) 0 Offset 0
|
|
Decorate 55(o) Block
|
|
Decorate 57(o) DescriptorSet 0
|
|
Decorate 57(o) Binding 1
|
|
Decorate 74(id) BuiltIn LocalInvocationIndex
|
|
2: TypeVoid
|
|
3: TypeFunction 2
|
|
6: TypeInt 32 0
|
|
7: 6(int) Constant 128
|
|
8: 6(int) Constant 1
|
|
9: TypePointer Function 6(int)
|
|
10: TypeFunction 2 9(ptr)
|
|
14(MyStruct): TypeStruct 6(int) 6(int) 6(int)
|
|
15: TypeArray 14(MyStruct) 7
|
|
16: TypePointer Workgroup 15
|
|
17(s): 16(ptr) Variable Workgroup
|
|
18: TypeInt 32 1
|
|
19: 18(int) Constant 0
|
|
20: 6(int) Constant 2
|
|
21: 6(int) Constant 3
|
|
22:14(MyStruct) ConstantComposite 8 20 21
|
|
23: TypePointer Workgroup 14(MyStruct)
|
|
26(MyStruct): TypeStruct 6(int) 6(int) 6(int)
|
|
27: TypeRuntimeArray 26(MyStruct)
|
|
28(MyStructs): TypeStruct 6(int) 27
|
|
29: TypeRuntimeArray 28(MyStructs)
|
|
30(sb): TypeStruct 29
|
|
31: TypePointer StorageBuffer 30(sb)
|
|
32(sb): 31(ptr) Variable StorageBuffer
|
|
33: TypePointer StorageBuffer 6(int)
|
|
36: TypePointer Function 14(MyStruct)
|
|
40: TypeBool
|
|
47: 18(int) Constant 1
|
|
49: TypePointer StorageBuffer 26(MyStruct)
|
|
54: TypeRuntimeArray 26(MyStruct)
|
|
55(o): TypeStruct 54
|
|
56: TypePointer StorageBuffer 55(o)
|
|
57(o): 56(ptr) Variable StorageBuffer
|
|
61: 6(int) Constant 0
|
|
67: 18(int) Constant 2
|
|
73: TypePointer Input 6(int)
|
|
74(id): 73(ptr) Variable Input
|
|
4(main): 2 Function None 3
|
|
5: Label
|
|
72(id): 9(ptr) Variable Function
|
|
76(param): 9(ptr) Variable Function
|
|
75: 6(int) Load 74(id)
|
|
Store 72(id) 75
|
|
77: 6(int) Load 72(id)
|
|
Store 76(param) 77
|
|
78: 2 FunctionCall 12(@main(u1;) 76(param)
|
|
Return
|
|
FunctionEnd
|
|
12(@main(u1;): 2 Function None 10
|
|
11(id): 9(ptr) FunctionParameter
|
|
13: Label
|
|
25(count): 9(ptr) Variable Function
|
|
37(ms): 36(ptr) Variable Function
|
|
24: 23(ptr) AccessChain 17(s) 19
|
|
Store 24 22
|
|
34: 33(ptr) AccessChain 32(sb) 19 19 19
|
|
35: 6(int) Load 34
|
|
Store 25(count) 35
|
|
38: 6(int) Load 11(id)
|
|
39: 6(int) Load 25(count)
|
|
41: 40(bool) UGreaterThan 38 39
|
|
42: 6(int) Load 11(id)
|
|
43: 6(int) Load 25(count)
|
|
44: 6(int) ISub 42 43
|
|
45: 23(ptr) AccessChain 17(s) 44
|
|
46:14(MyStruct) Load 45
|
|
48: 6(int) Load 11(id)
|
|
50: 49(ptr) AccessChain 32(sb) 19 19 47 48
|
|
51:26(MyStruct) Load 50
|
|
52:14(MyStruct) CopyLogical 51
|
|
53:14(MyStruct) Select 41 46 52
|
|
Store 37(ms) 53
|
|
58: 33(ptr) AccessChain 57(o) 19 19 19
|
|
59: 9(ptr) AccessChain 37(ms) 19
|
|
60: 6(int) Load 59
|
|
62: 6(int) AtomicIAdd 58 8 61 60
|
|
63: 33(ptr) AccessChain 57(o) 19 19 47
|
|
64: 9(ptr) AccessChain 37(ms) 47
|
|
65: 6(int) Load 64
|
|
66: 6(int) AtomicIAdd 63 8 61 65
|
|
68: 33(ptr) AccessChain 57(o) 19 19 67
|
|
69: 9(ptr) AccessChain 37(ms) 67
|
|
70: 6(int) Load 69
|
|
71: 6(int) AtomicIAdd 68 8 61 70
|
|
Return
|
|
FunctionEnd
|