HLSL: Wrap the entry-point; need to write 'in' args, and support 'inout' args.

This needs some render testing, but is destined to be part of master.

This also leads to a variety of other simplifications.
 - IO are global symbols, so only need one list of linkage nodes (deferred)
 - no longer need parse-context-wide 'inEntryPoint' state, entry-point is localized
 - several parts of splitting/flattening are now localized
This commit is contained in:
John Kessenich
2017-01-19 15:41:47 -07:00
parent 18adbdbbb8
commit 02467d8d94
171 changed files with 37604 additions and 32679 deletions

View File

@@ -2,7 +2,7 @@ hlsl.logical.binary.vec.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:10 Function Definition: main( (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: @main( (temp structure{temp 4-component vector of float Color})
0:10 Function Parameters:
0:? Sequence
0:11 Sequence
@@ -108,15 +108,18 @@ gl_FragCoord origin is upper left
0:22 'r11' (temp 4-component vector of bool)
0:22 'r20' (temp 4-component vector of bool)
0:22 'r21' (temp 4-component vector of bool)
0:23 Sequence
0:23 Sequence
0:23 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:23 Color: direct index for structure (temp 4-component vector of float)
0:23 'psout' (temp structure{temp 4-component vector of float Color})
0:23 Constant:
0:23 0 (const int)
0:23 Branch: Return
0:23 Branch: Return with expression
0:23 'psout' (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: main( (temp void)
0:10 Function Parameters:
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:10 Color: direct index for structure (temp 4-component vector of float)
0:10 Function Call: @main( (temp structure{temp 4-component vector of float Color})
0:10 Constant:
0:10 0 (const int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of bool b4a, layout(offset=16 ) uniform 4-component vector of bool b4b, layout(offset=32 ) uniform bool b1a, layout(offset=36 ) uniform bool b1b})
@@ -128,7 +131,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:10 Function Definition: main( (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: @main( (temp structure{temp 4-component vector of float Color})
0:10 Function Parameters:
0:? Sequence
0:11 Sequence
@@ -234,179 +237,189 @@ gl_FragCoord origin is upper left
0:22 'r11' (temp 4-component vector of bool)
0:22 'r20' (temp 4-component vector of bool)
0:22 'r21' (temp 4-component vector of bool)
0:23 Sequence
0:23 Sequence
0:23 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:23 Color: direct index for structure (temp 4-component vector of float)
0:23 'psout' (temp structure{temp 4-component vector of float Color})
0:23 Constant:
0:23 0 (const int)
0:23 Branch: Return
0:23 Branch: Return with expression
0:23 'psout' (temp structure{temp 4-component vector of float Color})
0:10 Function Definition: main( (temp void)
0:10 Function Parameters:
0:? Sequence
0:10 Sequence
0:10 move second child to first child (temp 4-component vector of float)
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:10 Color: direct index for structure (temp 4-component vector of float)
0:10 Function Call: @main( (temp structure{temp 4-component vector of float Color})
0:10 Constant:
0:10 0 (const int)
0:? Linker Objects
0:? 'Color' (layout(location=0 ) out 4-component vector of float)
0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform 4-component vector of bool b4a, layout(offset=16 ) uniform 4-component vector of bool b4b, layout(offset=32 ) uniform bool b1a, layout(offset=36 ) uniform bool b1b})
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 115
// Id's are bound by 120
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 111
EntryPoint Fragment 4 "main" 117
ExecutionMode 4 OriginUpperLeft
Name 4 "main"
Name 9 "r00"
Name 12 "$Global"
MemberName 12($Global) 0 "b4a"
MemberName 12($Global) 1 "b4b"
MemberName 12($Global) 2 "b1a"
MemberName 12($Global) 3 "b1b"
Name 14 ""
Name 24 "r01"
Name 33 "r02"
Name 41 "r10"
Name 52 "r11"
Name 61 "r20"
Name 73 "r21"
Name 87 "PS_OUTPUT"
MemberName 87(PS_OUTPUT) 0 "Color"
Name 89 "psout"
Name 111 "Color"
MemberDecorate 12($Global) 0 Offset 0
MemberDecorate 12($Global) 1 Offset 16
MemberDecorate 12($Global) 2 Offset 32
MemberDecorate 12($Global) 3 Offset 36
Decorate 12($Global) Block
Decorate 14 DescriptorSet 0
Decorate 111(Color) Location 0
Name 8 "PS_OUTPUT"
MemberName 8(PS_OUTPUT) 0 "Color"
Name 10 "@main("
Name 15 "r00"
Name 18 "$Global"
MemberName 18($Global) 0 "b4a"
MemberName 18($Global) 1 "b4b"
MemberName 18($Global) 2 "b1a"
MemberName 18($Global) 3 "b1b"
Name 20 ""
Name 30 "r01"
Name 39 "r02"
Name 47 "r10"
Name 58 "r11"
Name 67 "r20"
Name 79 "r21"
Name 92 "psout"
Name 117 "Color"
MemberDecorate 18($Global) 0 Offset 0
MemberDecorate 18($Global) 1 Offset 16
MemberDecorate 18($Global) 2 Offset 32
MemberDecorate 18($Global) 3 Offset 36
Decorate 18($Global) Block
Decorate 20 DescriptorSet 0
Decorate 117(Color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeBool
7: TypeVector 6(bool) 4
8: TypePointer Function 7(bvec4)
10: TypeInt 32 0
11: TypeVector 10(int) 4
12($Global): TypeStruct 11(ivec4) 11(ivec4) 10(int) 10(int)
13: TypePointer Uniform 12($Global)
14: 13(ptr) Variable Uniform
15: TypeInt 32 1
16: 15(int) Constant 0
17: TypePointer Uniform 11(ivec4)
20: 10(int) Constant 0
21: 11(ivec4) ConstantComposite 20 20 20 20
28: 15(int) Constant 1
42: 15(int) Constant 2
43: TypePointer Uniform 10(int)
67: 15(int) Constant 3
85: TypeFloat 32
86: TypeVector 85(float) 4
87(PS_OUTPUT): TypeStruct 86(fvec4)
88: TypePointer Function 87(PS_OUTPUT)
103: 85(float) Constant 0
104: 85(float) Constant 1065353216
105: 86(fvec4) ConstantComposite 103 103 103 103
106: 86(fvec4) ConstantComposite 104 104 104 104
108: TypePointer Function 86(fvec4)
110: TypePointer Output 86(fvec4)
111(Color): 110(ptr) Variable Output
6: TypeFloat 32
7: TypeVector 6(float) 4
8(PS_OUTPUT): TypeStruct 7(fvec4)
9: TypeFunction 8(PS_OUTPUT)
12: TypeBool
13: TypeVector 12(bool) 4
14: TypePointer Function 13(bvec4)
16: TypeInt 32 0
17: TypeVector 16(int) 4
18($Global): TypeStruct 17(ivec4) 17(ivec4) 16(int) 16(int)
19: TypePointer Uniform 18($Global)
20: 19(ptr) Variable Uniform
21: TypeInt 32 1
22: 21(int) Constant 0
23: TypePointer Uniform 17(ivec4)
26: 16(int) Constant 0
27: 17(ivec4) ConstantComposite 26 26 26 26
34: 21(int) Constant 1
48: 21(int) Constant 2
49: TypePointer Uniform 16(int)
73: 21(int) Constant 3
91: TypePointer Function 8(PS_OUTPUT)
106: 6(float) Constant 0
107: 6(float) Constant 1065353216
108: 7(fvec4) ConstantComposite 106 106 106 106
109: 7(fvec4) ConstantComposite 107 107 107 107
111: TypePointer Function 7(fvec4)
116: TypePointer Output 7(fvec4)
117(Color): 116(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(r00): 8(ptr) Variable Function
24(r01): 8(ptr) Variable Function
33(r02): 8(ptr) Variable Function
41(r10): 8(ptr) Variable Function
52(r11): 8(ptr) Variable Function
61(r20): 8(ptr) Variable Function
73(r21): 8(ptr) Variable Function
89(psout): 88(ptr) Variable Function
18: 17(ptr) AccessChain 14 16
19: 11(ivec4) Load 18
22: 7(bvec4) INotEqual 19 21
23: 7(bvec4) LogicalNot 22
Store 9(r00) 23
25: 17(ptr) AccessChain 14 16
26: 11(ivec4) Load 25
27: 7(bvec4) INotEqual 26 21
29: 17(ptr) AccessChain 14 28
30: 11(ivec4) Load 29
31: 7(bvec4) INotEqual 30 21
32: 7(bvec4) LogicalAnd 27 31
Store 24(r01) 32
34: 17(ptr) AccessChain 14 16
35: 11(ivec4) Load 34
36: 7(bvec4) INotEqual 35 21
37: 17(ptr) AccessChain 14 28
38: 11(ivec4) Load 37
39: 7(bvec4) INotEqual 38 21
40: 7(bvec4) LogicalOr 36 39
Store 33(r02) 40
44: 43(ptr) AccessChain 14 42
45: 10(int) Load 44
46: 6(bool) INotEqual 45 20
47: 7(bvec4) CompositeConstruct 46 46 46 46
48: 17(ptr) AccessChain 14 28
49: 11(ivec4) Load 48
50: 7(bvec4) INotEqual 49 21
51: 7(bvec4) LogicalAnd 47 50
Store 41(r10) 51
53: 43(ptr) AccessChain 14 42
54: 10(int) Load 53
55: 6(bool) INotEqual 54 20
56: 7(bvec4) CompositeConstruct 55 55 55 55
57: 17(ptr) AccessChain 14 28
58: 11(ivec4) Load 57
59: 7(bvec4) INotEqual 58 21
60: 7(bvec4) LogicalOr 56 59
Store 52(r11) 60
62: 17(ptr) AccessChain 14 16
63: 11(ivec4) Load 62
64: 7(bvec4) INotEqual 63 21
SelectionMerge 66 None
BranchConditional 64 65 66
65: Label
68: 43(ptr) AccessChain 14 67
69: 10(int) Load 68
70: 6(bool) INotEqual 69 20
71: 7(bvec4) CompositeConstruct 70 70 70 70
Branch 66
66: Label
72: 6(bool) Phi 64 5 71 65
Store 61(r20) 72
74: 17(ptr) AccessChain 14 16
75: 11(ivec4) Load 74
76: 7(bvec4) INotEqual 75 21
77: 6(bool) LogicalNot 76
SelectionMerge 79 None
BranchConditional 77 78 79
78: Label
80: 43(ptr) AccessChain 14 67
81: 10(int) Load 80
82: 6(bool) INotEqual 81 20
83: 7(bvec4) CompositeConstruct 82 82 82 82
Branch 79
79: Label
84: 6(bool) Phi 76 66 83 78
Store 73(r21) 84
90: 7(bvec4) Load 9(r00)
91: 7(bvec4) Load 24(r01)
92: 7(bvec4) LogicalOr 90 91
93: 7(bvec4) Load 33(r02)
94: 7(bvec4) LogicalOr 92 93
95: 7(bvec4) Load 41(r10)
96: 7(bvec4) LogicalOr 94 95
97: 7(bvec4) Load 52(r11)
98: 7(bvec4) LogicalOr 96 97
99: 7(bvec4) Load 61(r20)
100: 7(bvec4) LogicalOr 98 99
101: 7(bvec4) Load 73(r21)
102: 7(bvec4) LogicalOr 100 101
107: 86(fvec4) Select 102 106 105
109: 108(ptr) AccessChain 89(psout) 16
Store 109 107
112: 108(ptr) AccessChain 89(psout) 16
113: 86(fvec4) Load 112
Store 111(Color) 113
118:8(PS_OUTPUT) FunctionCall 10(@main()
119: 7(fvec4) CompositeExtract 118 0
Store 117(Color) 119
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
11: Label
15(r00): 14(ptr) Variable Function
30(r01): 14(ptr) Variable Function
39(r02): 14(ptr) Variable Function
47(r10): 14(ptr) Variable Function
58(r11): 14(ptr) Variable Function
67(r20): 14(ptr) Variable Function
79(r21): 14(ptr) Variable Function
92(psout): 91(ptr) Variable Function
24: 23(ptr) AccessChain 20 22
25: 17(ivec4) Load 24
28: 13(bvec4) INotEqual 25 27
29: 13(bvec4) LogicalNot 28
Store 15(r00) 29
31: 23(ptr) AccessChain 20 22
32: 17(ivec4) Load 31
33: 13(bvec4) INotEqual 32 27
35: 23(ptr) AccessChain 20 34
36: 17(ivec4) Load 35
37: 13(bvec4) INotEqual 36 27
38: 13(bvec4) LogicalAnd 33 37
Store 30(r01) 38
40: 23(ptr) AccessChain 20 22
41: 17(ivec4) Load 40
42: 13(bvec4) INotEqual 41 27
43: 23(ptr) AccessChain 20 34
44: 17(ivec4) Load 43
45: 13(bvec4) INotEqual 44 27
46: 13(bvec4) LogicalOr 42 45
Store 39(r02) 46
50: 49(ptr) AccessChain 20 48
51: 16(int) Load 50
52: 12(bool) INotEqual 51 26
53: 13(bvec4) CompositeConstruct 52 52 52 52
54: 23(ptr) AccessChain 20 34
55: 17(ivec4) Load 54
56: 13(bvec4) INotEqual 55 27
57: 13(bvec4) LogicalAnd 53 56
Store 47(r10) 57
59: 49(ptr) AccessChain 20 48
60: 16(int) Load 59
61: 12(bool) INotEqual 60 26
62: 13(bvec4) CompositeConstruct 61 61 61 61
63: 23(ptr) AccessChain 20 34
64: 17(ivec4) Load 63
65: 13(bvec4) INotEqual 64 27
66: 13(bvec4) LogicalOr 62 65
Store 58(r11) 66
68: 23(ptr) AccessChain 20 22
69: 17(ivec4) Load 68
70: 13(bvec4) INotEqual 69 27
SelectionMerge 72 None
BranchConditional 70 71 72
71: Label
74: 49(ptr) AccessChain 20 73
75: 16(int) Load 74
76: 12(bool) INotEqual 75 26
77: 13(bvec4) CompositeConstruct 76 76 76 76
Branch 72
72: Label
78: 12(bool) Phi 70 11 77 71
Store 67(r20) 78
80: 23(ptr) AccessChain 20 22
81: 17(ivec4) Load 80
82: 13(bvec4) INotEqual 81 27
83: 12(bool) LogicalNot 82
SelectionMerge 85 None
BranchConditional 83 84 85
84: Label
86: 49(ptr) AccessChain 20 73
87: 16(int) Load 86
88: 12(bool) INotEqual 87 26
89: 13(bvec4) CompositeConstruct 88 88 88 88
Branch 85
85: Label
90: 12(bool) Phi 82 72 89 84
Store 79(r21) 90
93: 13(bvec4) Load 15(r00)
94: 13(bvec4) Load 30(r01)
95: 13(bvec4) LogicalOr 93 94
96: 13(bvec4) Load 39(r02)
97: 13(bvec4) LogicalOr 95 96
98: 13(bvec4) Load 47(r10)
99: 13(bvec4) LogicalOr 97 98
100: 13(bvec4) Load 58(r11)
101: 13(bvec4) LogicalOr 99 100
102: 13(bvec4) Load 67(r20)
103: 13(bvec4) LogicalOr 101 102
104: 13(bvec4) Load 79(r21)
105: 13(bvec4) LogicalOr 103 104
110: 7(fvec4) Select 105 109 108
112: 111(ptr) AccessChain 92(psout) 22
Store 112 110
113:8(PS_OUTPUT) Load 92(psout)
ReturnValue 113
FunctionEnd