HLSL: Pass opaques by local copy, instead of by interface original.

Also, remove assumption that if something is opaque that it
must be in the UniformConstant storage class.

This allows function declarations to know all parameters will
be in the Function storage class.
This commit is contained in:
John Kessenich
2017-09-08 02:38:07 -06:00
committed by GregF
parent 15fa7ef5f5
commit bed4e4f7e4
12 changed files with 976 additions and 841 deletions

View File

@@ -839,12 +839,12 @@ gl_FragCoord origin is upper left
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 233
// Id's are bound by 240
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 231
EntryPoint Fragment 4 "main" 238
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@@ -867,52 +867,55 @@ gl_FragCoord origin is upper left
Name 71 "@sampleStructTemp"
Name 87 "s1"
Name 88 "@sampleResultShadow"
Name 89 "g_tTex2s1"
Name 97 "@sampleStructTemp"
Name 111 "s2"
Name 112 "@sampleResultShadow"
Name 113 "g_tTex2s2"
Name 121 "@sampleStructTemp"
Name 135 "s3_t"
MemberName 135(s3_t) 0 "c0"
MemberName 135(s3_t) 1 "c1"
Name 137 "s3"
Name 138 "@sampleResultShadow"
Name 139 "g_tTex2s3"
Name 147 "@sampleStructTemp"
Name 159 "s4_t"
MemberName 159(s4_t) 0 "c0"
MemberName 159(s4_t) 1 "c1"
MemberName 159(s4_t) 2 "c2"
Name 161 "s4"
Name 164 "@sampleResultShadow"
Name 167 "g_tTex2s4"
Name 176 "@sampleStructTemp"
Name 193 "s5_t"
MemberName 193(s5_t) 0 "c0"
MemberName 193(s5_t) 1 "c1"
Name 195 "s5"
Name 198 "@sampleResultShadow"
Name 201 "g_tTex2s5"
Name 210 "@sampleStructTemp"
Name 219 "r0"
Name 221 "r1"
Name 223 "r2"
Name 224 "g_tTex2s1a"
Name 231 "@entryPointOutput"
Name 90 "g_tTex2s1"
Name 98 "@sampleStructTemp"
Name 112 "s2"
Name 113 "@sampleResultShadow"
Name 114 "g_tTex2s2"
Name 122 "@sampleStructTemp"
Name 136 "s3_t"
MemberName 136(s3_t) 0 "c0"
MemberName 136(s3_t) 1 "c1"
Name 138 "s3"
Name 139 "@sampleResultShadow"
Name 140 "g_tTex2s3"
Name 148 "@sampleStructTemp"
Name 160 "s4_t"
MemberName 160(s4_t) 0 "c0"
MemberName 160(s4_t) 1 "c1"
MemberName 160(s4_t) 2 "c2"
Name 162 "s4"
Name 165 "@sampleResultShadow"
Name 168 "g_tTex2s4"
Name 177 "@sampleStructTemp"
Name 194 "s5_t"
MemberName 194(s5_t) 0 "c0"
MemberName 194(s5_t) 1 "c1"
Name 196 "s5"
Name 199 "@sampleResultShadow"
Name 202 "g_tTex2s5"
Name 211 "@sampleStructTemp"
Name 220 "r0"
Name 221 "param"
Name 224 "r1"
Name 225 "param"
Name 228 "r2"
Name 229 "g_tTex2s1a"
Name 230 "param"
Name 238 "@entryPointOutput"
Decorate 30(g_sSamp) DescriptorSet 0
Decorate 89(g_tTex2s1) DescriptorSet 0
Decorate 113(g_tTex2s2) DescriptorSet 0
Decorate 139(g_tTex2s3) DescriptorSet 0
Decorate 167(g_tTex2s4) DescriptorSet 0
Decorate 201(g_tTex2s5) DescriptorSet 0
Decorate 224(g_tTex2s1a) DescriptorSet 0
Decorate 231(@entryPointOutput) Location 0
Decorate 90(g_tTex2s1) DescriptorSet 0
Decorate 114(g_tTex2s2) DescriptorSet 0
Decorate 140(g_tTex2s3) DescriptorSet 0
Decorate 168(g_tTex2s4) DescriptorSet 0
Decorate 202(g_tTex2s5) DescriptorSet 0
Decorate 229(g_tTex2s1a) DescriptorSet 0
Decorate 238(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeImage 6(float) 2D sampled format:Unknown
8: TypePointer UniformConstant 7
8: TypePointer Function 7
9: TypeVector 6(float) 2
10(s1_t): TypeStruct 6(float) 9(fvec2) 6(float)
11: TypeFunction 10(s1_t) 8(ptr)
@@ -941,54 +944,55 @@ gl_FragCoord origin is upper left
57: 40(int) Constant 2
58: 42(int) Constant 3
70: TypePointer Function 16(s2_t)
89(g_tTex2s1): 8(ptr) Variable UniformConstant
93: 6(float) Constant 1036831949
94: 6(float) Constant 1038174126
95: 9(fvec2) ConstantComposite 93 94
113(g_tTex2s2): 8(ptr) Variable UniformConstant
117: 6(float) Constant 1045220557
118: 6(float) Constant 1045891645
119: 9(fvec2) ConstantComposite 117 118
135(s3_t): TypeStruct 9(fvec2) 6(float)
136: TypePointer Function 135(s3_t)
139(g_tTex2s3): 8(ptr) Variable UniformConstant
143: 6(float) Constant 1050253722
144: 6(float) Constant 1050589266
145: 9(fvec2) ConstantComposite 143 144
158: TypeVector 40(int) 2
159(s4_t): TypeStruct 40(int) 158(ivec2) 40(int)
160: TypePointer Function 159(s4_t)
162: TypeVector 40(int) 4
163: TypePointer Function 162(ivec4)
165: TypeImage 40(int) 2D sampled format:Unknown
166: TypePointer UniformConstant 165
167(g_tTex2s4): 166(ptr) Variable UniformConstant
170: TypeSampledImage 165
172: 6(float) Constant 1053609165
173: 6(float) Constant 1053944709
174: 9(fvec2) ConstantComposite 172 173
177: TypePointer Function 40(int)
193(s5_t): TypeStruct 42(int) 42(int)
194: TypePointer Function 193(s5_t)
196: TypeVector 42(int) 4
197: TypePointer Function 196(ivec4)
199: TypeImage 42(int) 2D sampled format:Unknown
200: TypePointer UniformConstant 199
201(g_tTex2s5): 200(ptr) Variable UniformConstant
204: TypeSampledImage 199
206: 6(float) Constant 1056964608
207: 6(float) Constant 1057132380
208: 9(fvec2) ConstantComposite 206 207
211: TypePointer Function 42(int)
224(g_tTex2s1a): 8(ptr) Variable UniformConstant
226: 6(float) Constant 0
227: 21(fvec4) ConstantComposite 226 226 226 226
230: TypePointer Output 21(fvec4)
231(@entryPointOutput): 230(ptr) Variable Output
89: TypePointer UniformConstant 7
90(g_tTex2s1): 89(ptr) Variable UniformConstant
94: 6(float) Constant 1036831949
95: 6(float) Constant 1038174126
96: 9(fvec2) ConstantComposite 94 95
114(g_tTex2s2): 89(ptr) Variable UniformConstant
118: 6(float) Constant 1045220557
119: 6(float) Constant 1045891645
120: 9(fvec2) ConstantComposite 118 119
136(s3_t): TypeStruct 9(fvec2) 6(float)
137: TypePointer Function 136(s3_t)
140(g_tTex2s3): 89(ptr) Variable UniformConstant
144: 6(float) Constant 1050253722
145: 6(float) Constant 1050589266
146: 9(fvec2) ConstantComposite 144 145
159: TypeVector 40(int) 2
160(s4_t): TypeStruct 40(int) 159(ivec2) 40(int)
161: TypePointer Function 160(s4_t)
163: TypeVector 40(int) 4
164: TypePointer Function 163(ivec4)
166: TypeImage 40(int) 2D sampled format:Unknown
167: TypePointer UniformConstant 166
168(g_tTex2s4): 167(ptr) Variable UniformConstant
171: TypeSampledImage 166
173: 6(float) Constant 1053609165
174: 6(float) Constant 1053944709
175: 9(fvec2) ConstantComposite 173 174
178: TypePointer Function 40(int)
194(s5_t): TypeStruct 42(int) 42(int)
195: TypePointer Function 194(s5_t)
197: TypeVector 42(int) 4
198: TypePointer Function 197(ivec4)
200: TypeImage 42(int) 2D sampled format:Unknown
201: TypePointer UniformConstant 200
202(g_tTex2s5): 201(ptr) Variable UniformConstant
205: TypeSampledImage 200
207: 6(float) Constant 1056964608
208: 6(float) Constant 1057132380
209: 9(fvec2) ConstantComposite 207 208
212: TypePointer Function 42(int)
229(g_tTex2s1a): 89(ptr) Variable UniformConstant
233: 6(float) Constant 0
234: 21(fvec4) ConstantComposite 233 233 233 233
237: TypePointer Output 21(fvec4)
238(@entryPointOutput): 237(ptr) Variable Output
4(main): 2 Function None 3
5: Label
232: 21(fvec4) FunctionCall 23(@main()
Store 231(@entryPointOutput) 232
239: 21(fvec4) FunctionCall 23(@main()
Store 238(@entryPointOutput) 239
Return
FunctionEnd
13(fn1(t2-tx-struct0-1;): 10(s1_t) Function None 11
@@ -1053,132 +1057,141 @@ gl_FragCoord origin is upper left
24: Label
87(s1): 38(ptr) Variable Function
88(@sampleResultShadow): 25(ptr) Variable Function
97(@sampleStructTemp): 38(ptr) Variable Function
111(s2): 70(ptr) Variable Function
112(@sampleResultShadow): 25(ptr) Variable Function
121(@sampleStructTemp): 70(ptr) Variable Function
137(s3): 136(ptr) Variable Function
138(@sampleResultShadow): 25(ptr) Variable Function
147(@sampleStructTemp): 136(ptr) Variable Function
161(s4): 160(ptr) Variable Function
164(@sampleResultShadow): 163(ptr) Variable Function
176(@sampleStructTemp): 160(ptr) Variable Function
195(s5): 194(ptr) Variable Function
198(@sampleResultShadow): 197(ptr) Variable Function
210(@sampleStructTemp): 194(ptr) Variable Function
219(r0): 38(ptr) Variable Function
221(r1): 70(ptr) Variable Function
223(r2): 38(ptr) Variable Function
90: 7 Load 89(g_tTex2s1)
91: 28 Load 30(g_sSamp)
92: 32 SampledImage 90 91
96: 21(fvec4) ImageSampleImplicitLod 92 95
Store 88(@sampleResultShadow) 96
98: 44(ptr) AccessChain 88(@sampleResultShadow) 43
99: 6(float) Load 98
100: 44(ptr) AccessChain 97(@sampleStructTemp) 41
Store 100 99
101: 44(ptr) AccessChain 88(@sampleResultShadow) 49
102: 6(float) Load 101
103: 44(ptr) AccessChain 97(@sampleStructTemp) 48 43
Store 103 102
104: 44(ptr) AccessChain 88(@sampleResultShadow) 53
105: 6(float) Load 104
106: 44(ptr) AccessChain 97(@sampleStructTemp) 48 49
Store 106 105
107: 44(ptr) AccessChain 88(@sampleResultShadow) 58
108: 6(float) Load 107
109: 44(ptr) AccessChain 97(@sampleStructTemp) 57
Store 109 108
110: 10(s1_t) Load 97(@sampleStructTemp)
Store 87(s1) 110
114: 7 Load 113(g_tTex2s2)
115: 28 Load 30(g_sSamp)
116: 32 SampledImage 114 115
120: 21(fvec4) ImageSampleImplicitLod 116 119
Store 112(@sampleResultShadow) 120
122: 44(ptr) AccessChain 112(@sampleResultShadow) 43
123: 6(float) Load 122
124: 44(ptr) AccessChain 121(@sampleStructTemp) 41
Store 124 123
125: 44(ptr) AccessChain 112(@sampleResultShadow) 49
126: 6(float) Load 125
127: 44(ptr) AccessChain 121(@sampleStructTemp) 48 43
Store 127 126
128: 44(ptr) AccessChain 112(@sampleResultShadow) 53
129: 6(float) Load 128
130: 44(ptr) AccessChain 121(@sampleStructTemp) 48 49
Store 130 129
131: 44(ptr) AccessChain 112(@sampleResultShadow) 58
132: 6(float) Load 131
133: 44(ptr) AccessChain 121(@sampleStructTemp) 48 53
Store 133 132
134: 16(s2_t) Load 121(@sampleStructTemp)
Store 111(s2) 134
140: 7 Load 139(g_tTex2s3)
141: 28 Load 30(g_sSamp)
142: 32 SampledImage 140 141
146: 21(fvec4) ImageSampleImplicitLod 142 145
Store 138(@sampleResultShadow) 146
148: 44(ptr) AccessChain 138(@sampleResultShadow) 43
149: 6(float) Load 148
150: 44(ptr) AccessChain 147(@sampleStructTemp) 41 43
Store 150 149
151: 44(ptr) AccessChain 138(@sampleResultShadow) 49
152: 6(float) Load 151
153: 44(ptr) AccessChain 147(@sampleStructTemp) 41 49
Store 153 152
154: 44(ptr) AccessChain 138(@sampleResultShadow) 53
155: 6(float) Load 154
156: 44(ptr) AccessChain 147(@sampleStructTemp) 48
Store 156 155
157: 135(s3_t) Load 147(@sampleStructTemp)
Store 137(s3) 157
168: 165 Load 167(g_tTex2s4)
169: 28 Load 30(g_sSamp)
171: 170 SampledImage 168 169
175: 162(ivec4) ImageSampleImplicitLod 171 174
Store 164(@sampleResultShadow) 175
178: 177(ptr) AccessChain 164(@sampleResultShadow) 43
179: 40(int) Load 178
180: 177(ptr) AccessChain 176(@sampleStructTemp) 41
Store 180 179
181: 177(ptr) AccessChain 164(@sampleResultShadow) 49
182: 40(int) Load 181
183: 6(float) ConvertSToF 182
184: 177(ptr) AccessChain 176(@sampleStructTemp) 48 43
Store 184 183
185: 177(ptr) AccessChain 164(@sampleResultShadow) 53
186: 40(int) Load 185
187: 6(float) ConvertSToF 186
188: 177(ptr) AccessChain 176(@sampleStructTemp) 48 49
Store 188 187
189: 177(ptr) AccessChain 164(@sampleResultShadow) 58
190: 40(int) Load 189
191: 177(ptr) AccessChain 176(@sampleStructTemp) 57
Store 191 190
192: 159(s4_t) Load 176(@sampleStructTemp)
Store 161(s4) 192
202: 199 Load 201(g_tTex2s5)
203: 28 Load 30(g_sSamp)
205: 204 SampledImage 202 203
209: 196(ivec4) ImageSampleImplicitLod 205 208
Store 198(@sampleResultShadow) 209
212: 211(ptr) AccessChain 198(@sampleResultShadow) 43
213: 42(int) Load 212
214: 211(ptr) AccessChain 210(@sampleStructTemp) 41
Store 214 213
215: 211(ptr) AccessChain 198(@sampleResultShadow) 49
216: 42(int) Load 215
217: 211(ptr) AccessChain 210(@sampleStructTemp) 48
Store 217 216
218: 193(s5_t) Load 210(@sampleStructTemp)
Store 195(s5) 218
220: 10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 89(g_tTex2s1)
Store 219(r0) 220
222: 16(s2_t) FunctionCall 19(fn1(t2-tx-struct1-1;) 113(g_tTex2s2)
Store 221(r1) 222
225: 10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 224(g_tTex2s1a)
Store 223(r2) 225
ReturnValue 227
98(@sampleStructTemp): 38(ptr) Variable Function
112(s2): 70(ptr) Variable Function
113(@sampleResultShadow): 25(ptr) Variable Function
122(@sampleStructTemp): 70(ptr) Variable Function
138(s3): 137(ptr) Variable Function
139(@sampleResultShadow): 25(ptr) Variable Function
148(@sampleStructTemp): 137(ptr) Variable Function
162(s4): 161(ptr) Variable Function
165(@sampleResultShadow): 164(ptr) Variable Function
177(@sampleStructTemp): 161(ptr) Variable Function
196(s5): 195(ptr) Variable Function
199(@sampleResultShadow): 198(ptr) Variable Function
211(@sampleStructTemp): 195(ptr) Variable Function
220(r0): 38(ptr) Variable Function
221(param): 8(ptr) Variable Function
224(r1): 70(ptr) Variable Function
225(param): 8(ptr) Variable Function
228(r2): 38(ptr) Variable Function
230(param): 8(ptr) Variable Function
91: 7 Load 90(g_tTex2s1)
92: 28 Load 30(g_sSamp)
93: 32 SampledImage 91 92
97: 21(fvec4) ImageSampleImplicitLod 93 96
Store 88(@sampleResultShadow) 97
99: 44(ptr) AccessChain 88(@sampleResultShadow) 43
100: 6(float) Load 99
101: 44(ptr) AccessChain 98(@sampleStructTemp) 41
Store 101 100
102: 44(ptr) AccessChain 88(@sampleResultShadow) 49
103: 6(float) Load 102
104: 44(ptr) AccessChain 98(@sampleStructTemp) 48 43
Store 104 103
105: 44(ptr) AccessChain 88(@sampleResultShadow) 53
106: 6(float) Load 105
107: 44(ptr) AccessChain 98(@sampleStructTemp) 48 49
Store 107 106
108: 44(ptr) AccessChain 88(@sampleResultShadow) 58
109: 6(float) Load 108
110: 44(ptr) AccessChain 98(@sampleStructTemp) 57
Store 110 109
111: 10(s1_t) Load 98(@sampleStructTemp)
Store 87(s1) 111
115: 7 Load 114(g_tTex2s2)
116: 28 Load 30(g_sSamp)
117: 32 SampledImage 115 116
121: 21(fvec4) ImageSampleImplicitLod 117 120
Store 113(@sampleResultShadow) 121
123: 44(ptr) AccessChain 113(@sampleResultShadow) 43
124: 6(float) Load 123
125: 44(ptr) AccessChain 122(@sampleStructTemp) 41
Store 125 124
126: 44(ptr) AccessChain 113(@sampleResultShadow) 49
127: 6(float) Load 126
128: 44(ptr) AccessChain 122(@sampleStructTemp) 48 43
Store 128 127
129: 44(ptr) AccessChain 113(@sampleResultShadow) 53
130: 6(float) Load 129
131: 44(ptr) AccessChain 122(@sampleStructTemp) 48 49
Store 131 130
132: 44(ptr) AccessChain 113(@sampleResultShadow) 58
133: 6(float) Load 132
134: 44(ptr) AccessChain 122(@sampleStructTemp) 48 53
Store 134 133
135: 16(s2_t) Load 122(@sampleStructTemp)
Store 112(s2) 135
141: 7 Load 140(g_tTex2s3)
142: 28 Load 30(g_sSamp)
143: 32 SampledImage 141 142
147: 21(fvec4) ImageSampleImplicitLod 143 146
Store 139(@sampleResultShadow) 147
149: 44(ptr) AccessChain 139(@sampleResultShadow) 43
150: 6(float) Load 149
151: 44(ptr) AccessChain 148(@sampleStructTemp) 41 43
Store 151 150
152: 44(ptr) AccessChain 139(@sampleResultShadow) 49
153: 6(float) Load 152
154: 44(ptr) AccessChain 148(@sampleStructTemp) 41 49
Store 154 153
155: 44(ptr) AccessChain 139(@sampleResultShadow) 53
156: 6(float) Load 155
157: 44(ptr) AccessChain 148(@sampleStructTemp) 48
Store 157 156
158: 136(s3_t) Load 148(@sampleStructTemp)
Store 138(s3) 158
169: 166 Load 168(g_tTex2s4)
170: 28 Load 30(g_sSamp)
172: 171 SampledImage 169 170
176: 163(ivec4) ImageSampleImplicitLod 172 175
Store 165(@sampleResultShadow) 176
179: 178(ptr) AccessChain 165(@sampleResultShadow) 43
180: 40(int) Load 179
181: 178(ptr) AccessChain 177(@sampleStructTemp) 41
Store 181 180
182: 178(ptr) AccessChain 165(@sampleResultShadow) 49
183: 40(int) Load 182
184: 6(float) ConvertSToF 183
185: 178(ptr) AccessChain 177(@sampleStructTemp) 48 43
Store 185 184
186: 178(ptr) AccessChain 165(@sampleResultShadow) 53
187: 40(int) Load 186
188: 6(float) ConvertSToF 187
189: 178(ptr) AccessChain 177(@sampleStructTemp) 48 49
Store 189 188
190: 178(ptr) AccessChain 165(@sampleResultShadow) 58
191: 40(int) Load 190
192: 178(ptr) AccessChain 177(@sampleStructTemp) 57
Store 192 191
193: 160(s4_t) Load 177(@sampleStructTemp)
Store 162(s4) 193
203: 200 Load 202(g_tTex2s5)
204: 28 Load 30(g_sSamp)
206: 205 SampledImage 203 204
210: 197(ivec4) ImageSampleImplicitLod 206 209
Store 199(@sampleResultShadow) 210
213: 212(ptr) AccessChain 199(@sampleResultShadow) 43
214: 42(int) Load 213
215: 212(ptr) AccessChain 211(@sampleStructTemp) 41
Store 215 214
216: 212(ptr) AccessChain 199(@sampleResultShadow) 49
217: 42(int) Load 216
218: 212(ptr) AccessChain 211(@sampleStructTemp) 48
Store 218 217
219: 194(s5_t) Load 211(@sampleStructTemp)
Store 196(s5) 219
222: 7 Load 90(g_tTex2s1)
Store 221(param) 222
223: 10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 221(param)
Store 220(r0) 223
226: 7 Load 114(g_tTex2s2)
Store 225(param) 226
227: 16(s2_t) FunctionCall 19(fn1(t2-tx-struct1-1;) 225(param)
Store 224(r1) 227
231: 7 Load 229(g_tTex2s1a)
Store 230(param) 231
232: 10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 230(param)
Store 228(r2) 232
ReturnValue 234
FunctionEnd