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.templatetypes.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:3 Function Definition: PixelShaderFunction( (temp float)
0:3 Function Definition: @PixelShaderFunction( (temp float)
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
@@ -239,12 +239,15 @@ gl_FragCoord origin is upper left
0:? 10.000000
0:? 11.000000
0:? 12.000000
0:45 Sequence
0:45 move second child to first child (temp float)
0:? '@entryPointOutput' (layout(location=0 ) out float)
0:45 Constant:
0:45 0.000000
0:45 Branch: Return
0:45 Branch: Return with expression
0:45 Constant:
0:45 0.000000
0:3 Function Definition: PixelShaderFunction( (temp void)
0:3 Function Parameters:
0:? Sequence
0:3 move second child to first child (temp float)
0:? '@entryPointOutput' (layout(location=0 ) out float)
0:3 Function Call: @PixelShaderFunction( (temp float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out float)
@@ -255,7 +258,7 @@ Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:3 Function Definition: PixelShaderFunction( (temp float)
0:3 Function Definition: @PixelShaderFunction( (temp float)
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
@@ -492,229 +495,239 @@ gl_FragCoord origin is upper left
0:? 10.000000
0:? 11.000000
0:? 12.000000
0:45 Sequence
0:45 move second child to first child (temp float)
0:? '@entryPointOutput' (layout(location=0 ) out float)
0:45 Constant:
0:45 0.000000
0:45 Branch: Return
0:45 Branch: Return with expression
0:45 Constant:
0:45 0.000000
0:3 Function Definition: PixelShaderFunction( (temp void)
0:3 Function Parameters:
0:? Sequence
0:3 move second child to first child (temp float)
0:? '@entryPointOutput' (layout(location=0 ) out float)
0:3 Function Call: @PixelShaderFunction( (temp float)
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 148
// Id's are bound by 153
Capability Shader
Capability Float64
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 146
EntryPoint Fragment 4 "PixelShaderFunction" 151
ExecutionMode 4 OriginUpperLeft
Name 4 "PixelShaderFunction"
Name 9 "r00"
Name 15 "r01"
Name 20 "r12"
Name 24 "r13"
Name 27 "r14"
Name 30 "r15"
Name 34 "r16"
Name 38 "r20"
Name 43 "r21"
Name 48 "r22"
Name 52 "r23"
Name 57 "r24"
Name 62 "r30"
Name 66 "r31"
Name 71 "r32"
Name 75 "r33"
Name 80 "r34"
Name 85 "r40"
Name 89 "r41"
Name 92 "r42"
Name 95 "r43"
Name 100 "r44"
Name 105 "r50"
Name 122 "r51"
Name 125 "r61"
Name 130 "r62"
Name 136 "r65"
Name 141 "r66"
Name 146 "@entryPointOutput"
Decorate 146(@entryPointOutput) Location 0
Name 8 "@PixelShaderFunction("
Name 12 "r00"
Name 18 "r01"
Name 23 "r12"
Name 27 "r13"
Name 30 "r14"
Name 33 "r15"
Name 37 "r16"
Name 41 "r20"
Name 46 "r21"
Name 51 "r22"
Name 55 "r23"
Name 60 "r24"
Name 65 "r30"
Name 69 "r31"
Name 74 "r32"
Name 78 "r33"
Name 83 "r34"
Name 88 "r40"
Name 92 "r41"
Name 95 "r42"
Name 98 "r43"
Name 103 "r44"
Name 108 "r50"
Name 125 "r51"
Name 128 "r61"
Name 133 "r62"
Name 139 "r65"
Name 144 "r66"
Name 151 "@entryPointOutput"
Decorate 151(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 1065353216
11: 6(float) Constant 1073741824
12: 6(float) Constant 1077936128
13: 6(float) Constant 1082130432
14: 7(fvec4) ConstantComposite 10 11 12 13
16: 6(float) Constant 1084227584
17: 7(fvec4) ConstantComposite 11 12 13 16
18: TypeBool
19: TypePointer Function 18(bool)
21: 18(bool) ConstantFalse
22: TypeInt 32 1
23: TypePointer Function 22(int)
25: 22(int) Constant 1
26: TypePointer Function 6(float)
28: TypeFloat 64
29: TypePointer Function 28(float)
31: 28(float) Constant 0 1072693248
32: TypeInt 32 0
33: TypePointer Function 32(int)
35: 32(int) Constant 1
36: TypeVector 18(bool) 2
37: TypePointer Function 36(bvec2)
39: 18(bool) ConstantTrue
40: 36(bvec2) ConstantComposite 21 39
41: TypeVector 22(int) 2
42: TypePointer Function 41(ivec2)
44: 22(int) Constant 2
45: 41(ivec2) ConstantComposite 25 44
46: TypeVector 6(float) 2
47: TypePointer Function 46(fvec2)
49: 46(fvec2) ConstantComposite 10 11
50: TypeVector 28(float) 2
51: TypePointer Function 50(fvec2)
53: 28(float) Constant 0 1073741824
54: 50(fvec2) ConstantComposite 31 53
55: TypeVector 32(int) 2
56: TypePointer Function 55(ivec2)
58: 32(int) Constant 2
59: 55(ivec2) ConstantComposite 35 58
60: TypeVector 18(bool) 3
61: TypePointer Function 60(bvec3)
63: 60(bvec3) ConstantComposite 21 39 39
64: TypeVector 22(int) 3
65: TypePointer Function 64(ivec3)
67: 22(int) Constant 3
68: 64(ivec3) ConstantComposite 25 44 67
69: TypeVector 6(float) 3
70: TypePointer Function 69(fvec3)
72: 69(fvec3) ConstantComposite 10 11 12
73: TypeVector 28(float) 3
74: TypePointer Function 73(fvec3)
76: 28(float) Constant 0 1074266112
77: 73(fvec3) ConstantComposite 31 53 76
78: TypeVector 32(int) 3
79: TypePointer Function 78(ivec3)
81: 32(int) Constant 3
82: 78(ivec3) ConstantComposite 35 58 81
83: TypeVector 18(bool) 4
84: TypePointer Function 83(bvec4)
86: 83(bvec4) ConstantComposite 21 39 39 21
87: TypeVector 22(int) 4
88: TypePointer Function 87(ivec4)
90: 22(int) Constant 4
91: 87(ivec4) ConstantComposite 25 44 67 90
93: TypeVector 28(float) 4
94: TypePointer Function 93(fvec4)
96: 28(float) Constant 0 1074790400
97: 93(fvec4) ConstantComposite 31 53 76 96
98: TypeVector 32(int) 4
99: TypePointer Function 98(ivec4)
101: 32(int) Constant 4
102: 98(ivec4) ConstantComposite 35 58 81 101
103: TypeMatrix 7(fvec4) 4
104: TypePointer Function 103
106: 6(float) Constant 0
107: 7(fvec4) ConstantComposite 106 10 11 12
108: 6(float) Constant 1086324736
109: 6(float) Constant 1088421888
110: 7(fvec4) ConstantComposite 13 16 108 109
111: 6(float) Constant 1090519040
112: 6(float) Constant 1091567616
113: 6(float) Constant 1092616192
114: 6(float) Constant 1093664768
115: 7(fvec4) ConstantComposite 111 112 113 114
116: 6(float) Constant 1094713344
117: 6(float) Constant 1095761920
118: 6(float) Constant 1096810496
119: 6(float) Constant 1097859072
120: 7(fvec4) ConstantComposite 116 117 118 119
121: 103 ConstantComposite 107 110 115 120
123: TypeMatrix 69(fvec3) 2
124: TypePointer Function 123
126: 69(fvec3) ConstantComposite 13 16 108
127: 123 ConstantComposite 72 126
128: TypeMatrix 46(fvec2) 3
129: TypePointer Function 128
131: 46(fvec2) ConstantComposite 12 13
132: 46(fvec2) ConstantComposite 16 108
133: 128 ConstantComposite 49 131 132
134: TypeMatrix 46(fvec2) 4
135: TypePointer Function 134
137: 46(fvec2) ConstantComposite 109 111
138: 134 ConstantComposite 49 131 132 137
139: TypeMatrix 69(fvec3) 4
140: TypePointer Function 139
142: 69(fvec3) ConstantComposite 109 111 112
143: 69(fvec3) ConstantComposite 113 114 116
144: 139 ConstantComposite 72 126 142 143
145: TypePointer Output 6(float)
146(@entryPointOutput): 145(ptr) Variable Output
7: TypeFunction 6(float)
10: TypeVector 6(float) 4
11: TypePointer Function 10(fvec4)
13: 6(float) Constant 1065353216
14: 6(float) Constant 1073741824
15: 6(float) Constant 1077936128
16: 6(float) Constant 1082130432
17: 10(fvec4) ConstantComposite 13 14 15 16
19: 6(float) Constant 1084227584
20: 10(fvec4) ConstantComposite 14 15 16 19
21: TypeBool
22: TypePointer Function 21(bool)
24: 21(bool) ConstantFalse
25: TypeInt 32 1
26: TypePointer Function 25(int)
28: 25(int) Constant 1
29: TypePointer Function 6(float)
31: TypeFloat 64
32: TypePointer Function 31(float)
34: 31(float) Constant 0 1072693248
35: TypeInt 32 0
36: TypePointer Function 35(int)
38: 35(int) Constant 1
39: TypeVector 21(bool) 2
40: TypePointer Function 39(bvec2)
42: 21(bool) ConstantTrue
43: 39(bvec2) ConstantComposite 24 42
44: TypeVector 25(int) 2
45: TypePointer Function 44(ivec2)
47: 25(int) Constant 2
48: 44(ivec2) ConstantComposite 28 47
49: TypeVector 6(float) 2
50: TypePointer Function 49(fvec2)
52: 49(fvec2) ConstantComposite 13 14
53: TypeVector 31(float) 2
54: TypePointer Function 53(fvec2)
56: 31(float) Constant 0 1073741824
57: 53(fvec2) ConstantComposite 34 56
58: TypeVector 35(int) 2
59: TypePointer Function 58(ivec2)
61: 35(int) Constant 2
62: 58(ivec2) ConstantComposite 38 61
63: TypeVector 21(bool) 3
64: TypePointer Function 63(bvec3)
66: 63(bvec3) ConstantComposite 24 42 42
67: TypeVector 25(int) 3
68: TypePointer Function 67(ivec3)
70: 25(int) Constant 3
71: 67(ivec3) ConstantComposite 28 47 70
72: TypeVector 6(float) 3
73: TypePointer Function 72(fvec3)
75: 72(fvec3) ConstantComposite 13 14 15
76: TypeVector 31(float) 3
77: TypePointer Function 76(fvec3)
79: 31(float) Constant 0 1074266112
80: 76(fvec3) ConstantComposite 34 56 79
81: TypeVector 35(int) 3
82: TypePointer Function 81(ivec3)
84: 35(int) Constant 3
85: 81(ivec3) ConstantComposite 38 61 84
86: TypeVector 21(bool) 4
87: TypePointer Function 86(bvec4)
89: 86(bvec4) ConstantComposite 24 42 42 24
90: TypeVector 25(int) 4
91: TypePointer Function 90(ivec4)
93: 25(int) Constant 4
94: 90(ivec4) ConstantComposite 28 47 70 93
96: TypeVector 31(float) 4
97: TypePointer Function 96(fvec4)
99: 31(float) Constant 0 1074790400
100: 96(fvec4) ConstantComposite 34 56 79 99
101: TypeVector 35(int) 4
102: TypePointer Function 101(ivec4)
104: 35(int) Constant 4
105: 101(ivec4) ConstantComposite 38 61 84 104
106: TypeMatrix 10(fvec4) 4
107: TypePointer Function 106
109: 6(float) Constant 0
110: 10(fvec4) ConstantComposite 109 13 14 15
111: 6(float) Constant 1086324736
112: 6(float) Constant 1088421888
113: 10(fvec4) ConstantComposite 16 19 111 112
114: 6(float) Constant 1090519040
115: 6(float) Constant 1091567616
116: 6(float) Constant 1092616192
117: 6(float) Constant 1093664768
118: 10(fvec4) ConstantComposite 114 115 116 117
119: 6(float) Constant 1094713344
120: 6(float) Constant 1095761920
121: 6(float) Constant 1096810496
122: 6(float) Constant 1097859072
123: 10(fvec4) ConstantComposite 119 120 121 122
124: 106 ConstantComposite 110 113 118 123
126: TypeMatrix 72(fvec3) 2
127: TypePointer Function 126
129: 72(fvec3) ConstantComposite 16 19 111
130: 126 ConstantComposite 75 129
131: TypeMatrix 49(fvec2) 3
132: TypePointer Function 131
134: 49(fvec2) ConstantComposite 15 16
135: 49(fvec2) ConstantComposite 19 111
136: 131 ConstantComposite 52 134 135
137: TypeMatrix 49(fvec2) 4
138: TypePointer Function 137
140: 49(fvec2) ConstantComposite 112 114
141: 137 ConstantComposite 52 134 135 140
142: TypeMatrix 72(fvec3) 4
143: TypePointer Function 142
145: 72(fvec3) ConstantComposite 112 114 115
146: 72(fvec3) ConstantComposite 116 117 119
147: 142 ConstantComposite 75 129 145 146
150: TypePointer Output 6(float)
151(@entryPointOutput): 150(ptr) Variable Output
4(PixelShaderFunction): 2 Function None 3
5: Label
9(r00): 8(ptr) Variable Function
15(r01): 8(ptr) Variable Function
20(r12): 19(ptr) Variable Function
24(r13): 23(ptr) Variable Function
27(r14): 26(ptr) Variable Function
30(r15): 29(ptr) Variable Function
34(r16): 33(ptr) Variable Function
38(r20): 37(ptr) Variable Function
43(r21): 42(ptr) Variable Function
48(r22): 47(ptr) Variable Function
52(r23): 51(ptr) Variable Function
57(r24): 56(ptr) Variable Function
62(r30): 61(ptr) Variable Function
66(r31): 65(ptr) Variable Function
71(r32): 70(ptr) Variable Function
75(r33): 74(ptr) Variable Function
80(r34): 79(ptr) Variable Function
85(r40): 84(ptr) Variable Function
89(r41): 88(ptr) Variable Function
92(r42): 8(ptr) Variable Function
95(r43): 94(ptr) Variable Function
100(r44): 99(ptr) Variable Function
105(r50): 104(ptr) Variable Function
122(r51): 104(ptr) Variable Function
125(r61): 124(ptr) Variable Function
130(r62): 129(ptr) Variable Function
136(r65): 135(ptr) Variable Function
141(r66): 140(ptr) Variable Function
Store 9(r00) 14
Store 15(r01) 17
Store 20(r12) 21
Store 24(r13) 25
Store 27(r14) 10
Store 30(r15) 31
Store 34(r16) 35
Store 38(r20) 40
Store 43(r21) 45
Store 48(r22) 49
Store 52(r23) 54
Store 57(r24) 59
Store 62(r30) 63
Store 66(r31) 68
Store 71(r32) 72
Store 75(r33) 77
Store 80(r34) 82
Store 85(r40) 86
Store 89(r41) 91
Store 92(r42) 14
Store 95(r43) 97
Store 100(r44) 102
Store 105(r50) 121
Store 122(r51) 121
Store 125(r61) 127
Store 130(r62) 133
Store 136(r65) 138
Store 141(r66) 144
Store 146(@entryPointOutput) 106
152: 6(float) FunctionCall 8(@PixelShaderFunction()
Store 151(@entryPointOutput) 152
Return
FunctionEnd
8(@PixelShaderFunction(): 6(float) Function None 7
9: Label
12(r00): 11(ptr) Variable Function
18(r01): 11(ptr) Variable Function
23(r12): 22(ptr) Variable Function
27(r13): 26(ptr) Variable Function
30(r14): 29(ptr) Variable Function
33(r15): 32(ptr) Variable Function
37(r16): 36(ptr) Variable Function
41(r20): 40(ptr) Variable Function
46(r21): 45(ptr) Variable Function
51(r22): 50(ptr) Variable Function
55(r23): 54(ptr) Variable Function
60(r24): 59(ptr) Variable Function
65(r30): 64(ptr) Variable Function
69(r31): 68(ptr) Variable Function
74(r32): 73(ptr) Variable Function
78(r33): 77(ptr) Variable Function
83(r34): 82(ptr) Variable Function
88(r40): 87(ptr) Variable Function
92(r41): 91(ptr) Variable Function
95(r42): 11(ptr) Variable Function
98(r43): 97(ptr) Variable Function
103(r44): 102(ptr) Variable Function
108(r50): 107(ptr) Variable Function
125(r51): 107(ptr) Variable Function
128(r61): 127(ptr) Variable Function
133(r62): 132(ptr) Variable Function
139(r65): 138(ptr) Variable Function
144(r66): 143(ptr) Variable Function
Store 12(r00) 17
Store 18(r01) 20
Store 23(r12) 24
Store 27(r13) 28
Store 30(r14) 13
Store 33(r15) 34
Store 37(r16) 38
Store 41(r20) 43
Store 46(r21) 48
Store 51(r22) 52
Store 55(r23) 57
Store 60(r24) 62
Store 65(r30) 66
Store 69(r31) 71
Store 74(r32) 75
Store 78(r33) 80
Store 83(r34) 85
Store 88(r40) 89
Store 92(r41) 94
Store 95(r42) 17
Store 98(r43) 100
Store 103(r44) 105
Store 108(r50) 124
Store 125(r51) 124
Store 128(r61) 130
Store 133(r62) 136
Store 139(r65) 141
Store 144(r66) 147
ReturnValue 109
FunctionEnd