SPV: Fix issue #320: Fetch needs to extract the image.

GLSL takes a traditional sampler, but SPIR-V wants just the
sampled image, not the combined sampler and image.
This commit is contained in:
John Kessenich 2016-06-02 23:45:21 -06:00
parent 98f2b3bfe0
commit a5c33d6ffb
4 changed files with 695 additions and 678 deletions

View file

@ -7,7 +7,7 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 278
// Id's are bound by 282
Capability Shader
Capability SampledRect
@ -15,7 +15,7 @@ Linked fragment stage:
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 17 26 29 55 81 84 91 247 277
EntryPoint Fragment 4 "main" 17 26 29 55 81 84 92 251 281
ExecutionMode 4 OriginUpperLeft
Source GLSL 430
Name 4 "main"
@ -31,24 +31,24 @@ Linked fragment stage:
Name 64 "s2DShadow"
Name 81 "ic3D"
Name 84 "ic1D"
Name 91 "ic2D"
Name 100 "sr"
Name 125 "sCube"
Name 136 "s2DArrayShadow"
Name 164 "iv"
Name 168 "is2D"
Name 203 "is3D"
Name 215 "isCube"
Name 227 "is2DArray"
Name 237 "iv2"
Name 241 "sCubeShadow"
Name 247 "FragData"
Name 259 "is2Dms"
Name 263 "us2D"
Name 267 "us3D"
Name 271 "usCube"
Name 275 "us2DArray"
Name 277 "ic4D"
Name 92 "ic2D"
Name 102 "sr"
Name 128 "sCube"
Name 139 "s2DArrayShadow"
Name 167 "iv"
Name 171 "is2D"
Name 206 "is3D"
Name 218 "isCube"
Name 230 "is2DArray"
Name 241 "iv2"
Name 245 "sCubeShadow"
Name 251 "FragData"
Name 263 "is2Dms"
Name 267 "us2D"
Name 271 "us3D"
Name 275 "usCube"
Name 279 "us2DArray"
Name 281 "ic4D"
Decorate 13(s2D) DescriptorSet 0
Decorate 23(sCubeArrayShadow) DescriptorSet 0
Decorate 42(s3D) DescriptorSet 0
@ -56,21 +56,21 @@ Linked fragment stage:
Decorate 64(s2DShadow) DescriptorSet 0
Decorate 81(ic3D) Flat
Decorate 84(ic1D) Flat
Decorate 91(ic2D) Flat
Decorate 100(sr) DescriptorSet 0
Decorate 125(sCube) DescriptorSet 0
Decorate 136(s2DArrayShadow) DescriptorSet 0
Decorate 168(is2D) DescriptorSet 0
Decorate 203(is3D) DescriptorSet 0
Decorate 215(isCube) DescriptorSet 0
Decorate 227(is2DArray) DescriptorSet 0
Decorate 241(sCubeShadow) DescriptorSet 0
Decorate 259(is2Dms) DescriptorSet 0
Decorate 263(us2D) DescriptorSet 0
Decorate 267(us3D) DescriptorSet 0
Decorate 271(usCube) DescriptorSet 0
Decorate 275(us2DArray) DescriptorSet 0
Decorate 277(ic4D) Flat
Decorate 92(ic2D) Flat
Decorate 102(sr) DescriptorSet 0
Decorate 128(sCube) DescriptorSet 0
Decorate 139(s2DArrayShadow) DescriptorSet 0
Decorate 171(is2D) DescriptorSet 0
Decorate 206(is3D) DescriptorSet 0
Decorate 218(isCube) DescriptorSet 0
Decorate 230(is2DArray) DescriptorSet 0
Decorate 245(sCubeShadow) DescriptorSet 0
Decorate 263(is2Dms) DescriptorSet 0
Decorate 267(us2D) DescriptorSet 0
Decorate 271(us3D) DescriptorSet 0
Decorate 275(usCube) DescriptorSet 0
Decorate 279(us2DArray) DescriptorSet 0
Decorate 281(ic4D) Flat
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -119,78 +119,78 @@ Linked fragment stage:
81(ic3D): 80(ptr) Variable Input
83: TypePointer Input 67(int)
84(ic1D): 83(ptr) Variable Input
90: TypePointer Input 68(ivec2)
91(ic2D): 90(ptr) Variable Input
93: 67(int) Constant 4
97: TypeImage 6(float) Rect sampled format:Unknown
98: TypeSampledImage 97
99: TypePointer UniformConstant 98
100(sr): 99(ptr) Variable UniformConstant
103: 68(ivec2) ConstantComposite 93 93
122: TypeImage 6(float) Cube sampled format:Unknown
123: TypeSampledImage 122
124: TypePointer UniformConstant 123
125(sCube): 124(ptr) Variable UniformConstant
133: TypeImage 6(float) 2D depth array sampled format:Unknown
134: TypeSampledImage 133
135: TypePointer UniformConstant 134
136(s2DArrayShadow): 135(ptr) Variable UniformConstant
143: 32(int) Constant 0
162: TypeVector 67(int) 4
163: TypePointer Function 162(ivec4)
165: TypeImage 67(int) 2D sampled format:Unknown
166: TypeSampledImage 165
167: TypePointer UniformConstant 166
168(is2D): 167(ptr) Variable UniformConstant
200: TypeImage 67(int) 3D sampled format:Unknown
201: TypeSampledImage 200
202: TypePointer UniformConstant 201
203(is3D): 202(ptr) Variable UniformConstant
206: 6(float) Constant 1082549862
212: TypeImage 67(int) Cube sampled format:Unknown
213: TypeSampledImage 212
214: TypePointer UniformConstant 213
215(isCube): 214(ptr) Variable UniformConstant
224: TypeImage 67(int) 2D array sampled format:Unknown
225: TypeSampledImage 224
226: TypePointer UniformConstant 225
227(is2DArray): 226(ptr) Variable UniformConstant
236: TypePointer Function 68(ivec2)
238: TypeImage 6(float) Cube depth sampled format:Unknown
239: TypeSampledImage 238
240: TypePointer UniformConstant 239
241(sCubeShadow): 240(ptr) Variable UniformConstant
243: 67(int) Constant 2
246: TypePointer Output 7(fvec4)
247(FragData): 246(ptr) Variable Output
251: 6(float) Constant 0
256: TypeImage 67(int) 2D multi-sampled sampled format:Unknown
257: TypeSampledImage 256
258: TypePointer UniformConstant 257
259(is2Dms): 258(ptr) Variable UniformConstant
260: TypeImage 32(int) 2D sampled format:Unknown
91: TypePointer Input 68(ivec2)
92(ic2D): 91(ptr) Variable Input
94: 67(int) Constant 4
99: TypeImage 6(float) Rect sampled format:Unknown
100: TypeSampledImage 99
101: TypePointer UniformConstant 100
102(sr): 101(ptr) Variable UniformConstant
105: 68(ivec2) ConstantComposite 94 94
125: TypeImage 6(float) Cube sampled format:Unknown
126: TypeSampledImage 125
127: TypePointer UniformConstant 126
128(sCube): 127(ptr) Variable UniformConstant
136: TypeImage 6(float) 2D depth array sampled format:Unknown
137: TypeSampledImage 136
138: TypePointer UniformConstant 137
139(s2DArrayShadow): 138(ptr) Variable UniformConstant
146: 32(int) Constant 0
165: TypeVector 67(int) 4
166: TypePointer Function 165(ivec4)
168: TypeImage 67(int) 2D sampled format:Unknown
169: TypeSampledImage 168
170: TypePointer UniformConstant 169
171(is2D): 170(ptr) Variable UniformConstant
203: TypeImage 67(int) 3D sampled format:Unknown
204: TypeSampledImage 203
205: TypePointer UniformConstant 204
206(is3D): 205(ptr) Variable UniformConstant
209: 6(float) Constant 1082549862
215: TypeImage 67(int) Cube sampled format:Unknown
216: TypeSampledImage 215
217: TypePointer UniformConstant 216
218(isCube): 217(ptr) Variable UniformConstant
227: TypeImage 67(int) 2D array sampled format:Unknown
228: TypeSampledImage 227
229: TypePointer UniformConstant 228
230(is2DArray): 229(ptr) Variable UniformConstant
240: TypePointer Function 68(ivec2)
242: TypeImage 6(float) Cube depth sampled format:Unknown
243: TypeSampledImage 242
244: TypePointer UniformConstant 243
245(sCubeShadow): 244(ptr) Variable UniformConstant
247: 67(int) Constant 2
250: TypePointer Output 7(fvec4)
251(FragData): 250(ptr) Variable Output
255: 6(float) Constant 0
260: TypeImage 67(int) 2D multi-sampled sampled format:Unknown
261: TypeSampledImage 260
262: TypePointer UniformConstant 261
263(us2D): 262(ptr) Variable UniformConstant
264: TypeImage 32(int) 3D sampled format:Unknown
263(is2Dms): 262(ptr) Variable UniformConstant
264: TypeImage 32(int) 2D sampled format:Unknown
265: TypeSampledImage 264
266: TypePointer UniformConstant 265
267(us3D): 266(ptr) Variable UniformConstant
268: TypeImage 32(int) Cube sampled format:Unknown
267(us2D): 266(ptr) Variable UniformConstant
268: TypeImage 32(int) 3D sampled format:Unknown
269: TypeSampledImage 268
270: TypePointer UniformConstant 269
271(usCube): 270(ptr) Variable UniformConstant
272: TypeImage 32(int) 2D array sampled format:Unknown
271(us3D): 270(ptr) Variable UniformConstant
272: TypeImage 32(int) Cube sampled format:Unknown
273: TypeSampledImage 272
274: TypePointer UniformConstant 273
275(us2DArray): 274(ptr) Variable UniformConstant
276: TypePointer Input 162(ivec4)
277(ic4D): 276(ptr) Variable Input
275(usCube): 274(ptr) Variable UniformConstant
276: TypeImage 32(int) 2D array sampled format:Unknown
277: TypeSampledImage 276
278: TypePointer UniformConstant 277
279(us2DArray): 278(ptr) Variable UniformConstant
280: TypePointer Input 165(ivec4)
281(ic4D): 280(ptr) Variable Input
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
164(iv): 163(ptr) Variable Function
237(iv2): 236(ptr) Variable Function
167(iv): 166(ptr) Variable Function
241(iv2): 240(ptr) Variable Function
14: 11 Load 13(s2D)
18: 15(fvec2) Load 17(c2D)
19: 7(fvec4) ImageSampleImplicitLod 14 18
@ -229,153 +229,157 @@ Linked fragment stage:
78: 40 Load 42(s3D)
82: 79(ivec3) Load 81(ic3D)
85: 67(int) Load 84(ic1D)
86: 7(fvec4) ImageFetch 78 82 Lod 85
87: 7(fvec4) Load 9(v)
88: 7(fvec4) FAdd 87 86
Store 9(v) 88
89: 11 Load 13(s2D)
92: 68(ivec2) Load 91(ic2D)
94: 7(fvec4) ImageFetch 89 92 Lod ConstOffset 93 70
95: 7(fvec4) Load 9(v)
96: 7(fvec4) FAdd 95 94
Store 9(v) 96
101: 98 Load 100(sr)
102: 68(ivec2) Load 91(ic2D)
104: 7(fvec4) ImageFetch 101 102 ConstOffset 103
105: 7(fvec4) Load 9(v)
106: 7(fvec4) FAdd 105 104
Store 9(v) 106
107: 62 Load 64(s2DShadow)
108: 53(fvec3) Load 55(c3D)
109: 6(float) Load 29(c1D)
110: 6(float) CompositeExtract 108 2
111: 6(float) ImageSampleDrefExplicitLod 107 108 110 Lod ConstOffset 109 70
112: 34(ptr) AccessChain 9(v) 33
113: 6(float) Load 112
114: 6(float) FAdd 113 111
86: 39 Image 78
87: 7(fvec4) ImageFetch 86 82 Lod 85
88: 7(fvec4) Load 9(v)
89: 7(fvec4) FAdd 88 87
Store 9(v) 89
90: 11 Load 13(s2D)
93: 68(ivec2) Load 92(ic2D)
95: 10 Image 90
96: 7(fvec4) ImageFetch 95 93 Lod ConstOffset 94 70
97: 7(fvec4) Load 9(v)
98: 7(fvec4) FAdd 97 96
Store 9(v) 98
103: 100 Load 102(sr)
104: 68(ivec2) Load 92(ic2D)
106: 99 Image 103
107: 7(fvec4) ImageFetch 106 104 ConstOffset 105
108: 7(fvec4) Load 9(v)
109: 7(fvec4) FAdd 108 107
Store 9(v) 109
110: 62 Load 64(s2DShadow)
111: 53(fvec3) Load 55(c3D)
112: 6(float) Load 29(c1D)
113: 6(float) CompositeExtract 111 2
114: 6(float) ImageSampleDrefExplicitLod 110 111 113 Lod ConstOffset 112 70
115: 34(ptr) AccessChain 9(v) 33
Store 115 114
116: 11 Load 13(s2D)
117: 53(fvec3) Load 55(c3D)
118: 6(float) Load 29(c1D)
119: 7(fvec4) ImageSampleProjExplicitLod 116 117 Lod ConstOffset 118 70
120: 7(fvec4) Load 9(v)
121: 7(fvec4) FAdd 120 119
Store 9(v) 121
126: 123 Load 125(sCube)
127: 53(fvec3) Load 55(c3D)
128: 53(fvec3) Load 55(c3D)
129: 53(fvec3) Load 55(c3D)
130: 7(fvec4) ImageSampleExplicitLod 126 127 Grad 128 129
131: 7(fvec4) Load 9(v)
132: 7(fvec4) FAdd 131 130
Store 9(v) 132
137: 134 Load 136(s2DArrayShadow)
138: 7(fvec4) Load 26(c4D)
139: 15(fvec2) Load 17(c2D)
140: 15(fvec2) Load 17(c2D)
141: 6(float) CompositeExtract 138 3
142: 6(float) ImageSampleDrefExplicitLod 137 138 141 Grad ConstOffset 139 140 70
144: 34(ptr) AccessChain 9(v) 143
145: 6(float) Load 144
146: 6(float) FAdd 145 142
147: 34(ptr) AccessChain 9(v) 143
Store 147 146
148: 40 Load 42(s3D)
149: 7(fvec4) Load 26(c4D)
150: 53(fvec3) Load 55(c3D)
151: 53(fvec3) Load 55(c3D)
152: 7(fvec4) ImageSampleProjExplicitLod 148 149 Grad 150 151
153: 7(fvec4) Load 9(v)
154: 7(fvec4) FAdd 153 152
Store 9(v) 154
155: 11 Load 13(s2D)
156: 53(fvec3) Load 55(c3D)
157: 15(fvec2) Load 17(c2D)
158: 15(fvec2) Load 17(c2D)
159: 7(fvec4) ImageSampleProjExplicitLod 155 156 Grad ConstOffset 157 158 70
160: 7(fvec4) Load 9(v)
161: 7(fvec4) FAdd 160 159
Store 9(v) 161
169: 166 Load 168(is2D)
170: 15(fvec2) Load 17(c2D)
171: 162(ivec4) ImageSampleImplicitLod 169 170
Store 164(iv) 171
172: 162(ivec4) Load 164(iv)
173: 7(fvec4) ConvertSToF 172
174: 7(fvec4) Load 9(v)
175: 7(fvec4) FAdd 174 173
Store 9(v) 175
176: 166 Load 168(is2D)
177: 7(fvec4) Load 26(c4D)
178: 162(ivec4) ImageSampleProjImplicitLod 176 177 ConstOffset 70
Store 164(iv) 178
179: 162(ivec4) Load 164(iv)
180: 7(fvec4) ConvertSToF 179
181: 7(fvec4) Load 9(v)
182: 7(fvec4) FAdd 181 180
Store 9(v) 182
183: 166 Load 168(is2D)
184: 53(fvec3) Load 55(c3D)
185: 6(float) Load 29(c1D)
186: 162(ivec4) ImageSampleProjExplicitLod 183 184 Lod 185
Store 164(iv) 186
187: 162(ivec4) Load 164(iv)
188: 7(fvec4) ConvertSToF 187
189: 7(fvec4) Load 9(v)
190: 7(fvec4) FAdd 189 188
Store 9(v) 190
191: 166 Load 168(is2D)
192: 53(fvec3) Load 55(c3D)
193: 15(fvec2) Load 17(c2D)
194: 15(fvec2) Load 17(c2D)
195: 162(ivec4) ImageSampleProjExplicitLod 191 192 Grad 193 194
Store 164(iv) 195
196: 162(ivec4) Load 164(iv)
197: 7(fvec4) ConvertSToF 196
198: 7(fvec4) Load 9(v)
199: 7(fvec4) FAdd 198 197
Store 9(v) 199
204: 201 Load 203(is3D)
205: 53(fvec3) Load 55(c3D)
207: 162(ivec4) ImageSampleImplicitLod 204 205 Bias 206
Store 164(iv) 207
208: 162(ivec4) Load 164(iv)
209: 7(fvec4) ConvertSToF 208
210: 7(fvec4) Load 9(v)
211: 7(fvec4) FAdd 210 209
Store 9(v) 211
216: 213 Load 215(isCube)
217: 53(fvec3) Load 55(c3D)
218: 6(float) Load 29(c1D)
219: 162(ivec4) ImageSampleExplicitLod 216 217 Lod 218
Store 164(iv) 219
220: 162(ivec4) Load 164(iv)
221: 7(fvec4) ConvertSToF 220
222: 7(fvec4) Load 9(v)
223: 7(fvec4) FAdd 222 221
Store 9(v) 223
228: 225 Load 227(is2DArray)
229: 79(ivec3) Load 81(ic3D)
230: 67(int) Load 84(ic1D)
231: 162(ivec4) ImageFetch 228 229 Lod 230
Store 164(iv) 231
232: 162(ivec4) Load 164(iv)
233: 7(fvec4) ConvertSToF 232
234: 7(fvec4) Load 9(v)
235: 7(fvec4) FAdd 234 233
Store 9(v) 235
242: 239 Load 241(sCubeShadow)
244: 238 Image 242
245: 68(ivec2) ImageQuerySizeLod 244 243
Store 237(iv2) 245
248: 7(fvec4) Load 9(v)
249: 68(ivec2) Load 237(iv2)
250: 15(fvec2) ConvertSToF 249
252: 6(float) CompositeExtract 250 0
253: 6(float) CompositeExtract 250 1
254: 7(fvec4) CompositeConstruct 252 253 251 251
255: 7(fvec4) FAdd 248 254
Store 247(FragData) 255
116: 6(float) Load 115
117: 6(float) FAdd 116 114
118: 34(ptr) AccessChain 9(v) 33
Store 118 117
119: 11 Load 13(s2D)
120: 53(fvec3) Load 55(c3D)
121: 6(float) Load 29(c1D)
122: 7(fvec4) ImageSampleProjExplicitLod 119 120 Lod ConstOffset 121 70
123: 7(fvec4) Load 9(v)
124: 7(fvec4) FAdd 123 122
Store 9(v) 124
129: 126 Load 128(sCube)
130: 53(fvec3) Load 55(c3D)
131: 53(fvec3) Load 55(c3D)
132: 53(fvec3) Load 55(c3D)
133: 7(fvec4) ImageSampleExplicitLod 129 130 Grad 131 132
134: 7(fvec4) Load 9(v)
135: 7(fvec4) FAdd 134 133
Store 9(v) 135
140: 137 Load 139(s2DArrayShadow)
141: 7(fvec4) Load 26(c4D)
142: 15(fvec2) Load 17(c2D)
143: 15(fvec2) Load 17(c2D)
144: 6(float) CompositeExtract 141 3
145: 6(float) ImageSampleDrefExplicitLod 140 141 144 Grad ConstOffset 142 143 70
147: 34(ptr) AccessChain 9(v) 146
148: 6(float) Load 147
149: 6(float) FAdd 148 145
150: 34(ptr) AccessChain 9(v) 146
Store 150 149
151: 40 Load 42(s3D)
152: 7(fvec4) Load 26(c4D)
153: 53(fvec3) Load 55(c3D)
154: 53(fvec3) Load 55(c3D)
155: 7(fvec4) ImageSampleProjExplicitLod 151 152 Grad 153 154
156: 7(fvec4) Load 9(v)
157: 7(fvec4) FAdd 156 155
Store 9(v) 157
158: 11 Load 13(s2D)
159: 53(fvec3) Load 55(c3D)
160: 15(fvec2) Load 17(c2D)
161: 15(fvec2) Load 17(c2D)
162: 7(fvec4) ImageSampleProjExplicitLod 158 159 Grad ConstOffset 160 161 70
163: 7(fvec4) Load 9(v)
164: 7(fvec4) FAdd 163 162
Store 9(v) 164
172: 169 Load 171(is2D)
173: 15(fvec2) Load 17(c2D)
174: 165(ivec4) ImageSampleImplicitLod 172 173
Store 167(iv) 174
175: 165(ivec4) Load 167(iv)
176: 7(fvec4) ConvertSToF 175
177: 7(fvec4) Load 9(v)
178: 7(fvec4) FAdd 177 176
Store 9(v) 178
179: 169 Load 171(is2D)
180: 7(fvec4) Load 26(c4D)
181: 165(ivec4) ImageSampleProjImplicitLod 179 180 ConstOffset 70
Store 167(iv) 181
182: 165(ivec4) Load 167(iv)
183: 7(fvec4) ConvertSToF 182
184: 7(fvec4) Load 9(v)
185: 7(fvec4) FAdd 184 183
Store 9(v) 185
186: 169 Load 171(is2D)
187: 53(fvec3) Load 55(c3D)
188: 6(float) Load 29(c1D)
189: 165(ivec4) ImageSampleProjExplicitLod 186 187 Lod 188
Store 167(iv) 189
190: 165(ivec4) Load 167(iv)
191: 7(fvec4) ConvertSToF 190
192: 7(fvec4) Load 9(v)
193: 7(fvec4) FAdd 192 191
Store 9(v) 193
194: 169 Load 171(is2D)
195: 53(fvec3) Load 55(c3D)
196: 15(fvec2) Load 17(c2D)
197: 15(fvec2) Load 17(c2D)
198: 165(ivec4) ImageSampleProjExplicitLod 194 195 Grad 196 197
Store 167(iv) 198
199: 165(ivec4) Load 167(iv)
200: 7(fvec4) ConvertSToF 199
201: 7(fvec4) Load 9(v)
202: 7(fvec4) FAdd 201 200
Store 9(v) 202
207: 204 Load 206(is3D)
208: 53(fvec3) Load 55(c3D)
210: 165(ivec4) ImageSampleImplicitLod 207 208 Bias 209
Store 167(iv) 210
211: 165(ivec4) Load 167(iv)
212: 7(fvec4) ConvertSToF 211
213: 7(fvec4) Load 9(v)
214: 7(fvec4) FAdd 213 212
Store 9(v) 214
219: 216 Load 218(isCube)
220: 53(fvec3) Load 55(c3D)
221: 6(float) Load 29(c1D)
222: 165(ivec4) ImageSampleExplicitLod 219 220 Lod 221
Store 167(iv) 222
223: 165(ivec4) Load 167(iv)
224: 7(fvec4) ConvertSToF 223
225: 7(fvec4) Load 9(v)
226: 7(fvec4) FAdd 225 224
Store 9(v) 226
231: 228 Load 230(is2DArray)
232: 79(ivec3) Load 81(ic3D)
233: 67(int) Load 84(ic1D)
234: 227 Image 231
235: 165(ivec4) ImageFetch 234 232 Lod 233
Store 167(iv) 235
236: 165(ivec4) Load 167(iv)
237: 7(fvec4) ConvertSToF 236
238: 7(fvec4) Load 9(v)
239: 7(fvec4) FAdd 238 237
Store 9(v) 239
246: 243 Load 245(sCubeShadow)
248: 242 Image 246
249: 68(ivec2) ImageQuerySizeLod 248 247
Store 241(iv2) 249
252: 7(fvec4) Load 9(v)
253: 68(ivec2) Load 241(iv2)
254: 15(fvec2) ConvertSToF 253
256: 6(float) CompositeExtract 254 0
257: 6(float) CompositeExtract 254 1
258: 7(fvec4) CompositeConstruct 256 257 255 255
259: 7(fvec4) FAdd 252 258
Store 251(FragData) 259
Return
FunctionEnd