blob: b5fcc9c631c648e5394f96cbb765cc7a2f119072 [file] [log] [blame]
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001// Copyright 2020 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "gmock/gmock.h"
16#include "src/tint/ast/builtin_texture_helper_test.h"
17#include "src/tint/ast/call_statement.h"
18#include "src/tint/ast/stage_attribute.h"
19#include "src/tint/writer/spirv/spv_dump.h"
20#include "src/tint/writer/spirv/test_helper.h"
21
dan sinclair411d0652022-04-07 14:16:34 +000022namespace tint::writer::spirv {
Ryan Harrisondbc13af2022-02-21 15:19:07 +000023namespace {
24
25struct expected_texture_overload_spirv {
dan sinclair41e4d9a2022-05-01 14:40:55 +000026 std::string types;
27 std::string instructions;
28 std::string capabilities;
Ryan Harrisondbc13af2022-02-21 15:19:07 +000029};
30
31expected_texture_overload_spirv expected_texture_overload(
32 ast::builtin::test::ValidTextureOverload overload) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000033 using ValidTextureOverload = ast::builtin::test::ValidTextureOverload;
34 switch (overload) {
35 case ValidTextureOverload::kDimensions1d:
36 return {
37 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000038%4 = OpTypeFloat 32
39%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
40%2 = OpTypePointer UniformConstant %3
41%1 = OpVariable %2 UniformConstant
42%7 = OpTypeSampler
43%6 = OpTypePointer UniformConstant %7
44%5 = OpVariable %6 UniformConstant
45%9 = OpTypeInt 32 1
46%11 = OpConstant %9 0
47)",
dan sinclair41e4d9a2022-05-01 14:40:55 +000048 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000049%10 = OpLoad %3 %1
50%8 = OpImageQuerySizeLod %9 %10 %11
51)",
dan sinclair41e4d9a2022-05-01 14:40:55 +000052 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000053OpCapability Sampled1D
54OpCapability ImageQuery
55)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +000056 case ValidTextureOverload::kDimensions2d:
57 return {
58 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000059%4 = OpTypeFloat 32
60%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
61%2 = OpTypePointer UniformConstant %3
62%1 = OpVariable %2 UniformConstant
63%7 = OpTypeSampler
64%6 = OpTypePointer UniformConstant %7
65%5 = OpVariable %6 UniformConstant
66%10 = OpTypeInt 32 1
67%9 = OpTypeVector %10 2
68%12 = OpConstant %10 0
69)",
dan sinclair41e4d9a2022-05-01 14:40:55 +000070 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000071%11 = OpLoad %3 %1
72%8 = OpImageQuerySizeLod %9 %11 %12
73)",
dan sinclair41e4d9a2022-05-01 14:40:55 +000074 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000075OpCapability ImageQuery
76)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +000077 case ValidTextureOverload::kDimensions2dLevel:
78 return {
79 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000080%4 = OpTypeFloat 32
81%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
82%2 = OpTypePointer UniformConstant %3
83%1 = OpVariable %2 UniformConstant
84%7 = OpTypeSampler
85%6 = OpTypePointer UniformConstant %7
86%5 = OpVariable %6 UniformConstant
87%10 = OpTypeInt 32 1
88%9 = OpTypeVector %10 2
89%12 = OpConstant %10 1
90)",
dan sinclair41e4d9a2022-05-01 14:40:55 +000091 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000092%11 = OpLoad %3 %1
93%8 = OpImageQuerySizeLod %9 %11 %12
94)",
dan sinclair41e4d9a2022-05-01 14:40:55 +000095 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +000096OpCapability ImageQuery
97)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +000098 case ValidTextureOverload::kDimensions2dArray:
99 return {
100 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000101%4 = OpTypeFloat 32
102%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
103%2 = OpTypePointer UniformConstant %3
104%1 = OpVariable %2 UniformConstant
105%7 = OpTypeSampler
106%6 = OpTypePointer UniformConstant %7
107%5 = OpVariable %6 UniformConstant
108%10 = OpTypeInt 32 1
109%9 = OpTypeVector %10 2
110%12 = OpTypeVector %10 3
111%14 = OpConstant %10 0
112)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000113 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000114%13 = OpLoad %3 %1
115%11 = OpImageQuerySizeLod %12 %13 %14
116%8 = OpVectorShuffle %9 %11 %11 0 1
117)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000118 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000119OpCapability ImageQuery
120)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000121 case ValidTextureOverload::kDimensions2dArrayLevel:
122 return {
123 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000124%4 = OpTypeFloat 32
125%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
126%2 = OpTypePointer UniformConstant %3
127%1 = OpVariable %2 UniformConstant
128%7 = OpTypeSampler
129%6 = OpTypePointer UniformConstant %7
130%5 = OpVariable %6 UniformConstant
131%10 = OpTypeInt 32 1
132%9 = OpTypeVector %10 2
133%12 = OpTypeVector %10 3
134%14 = OpConstant %10 1
135)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000136 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000137%13 = OpLoad %3 %1
138%11 = OpImageQuerySizeLod %12 %13 %14
139%8 = OpVectorShuffle %9 %11 %11 0 1
140)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000141 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000142OpCapability ImageQuery
143)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000144 case ValidTextureOverload::kDimensions3d:
145 return {
146 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000147%4 = OpTypeFloat 32
148%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
149%2 = OpTypePointer UniformConstant %3
150%1 = OpVariable %2 UniformConstant
151%7 = OpTypeSampler
152%6 = OpTypePointer UniformConstant %7
153%5 = OpVariable %6 UniformConstant
154%10 = OpTypeInt 32 1
155%9 = OpTypeVector %10 3
156%12 = OpConstant %10 0
157)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000158 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000159%11 = OpLoad %3 %1
160%8 = OpImageQuerySizeLod %9 %11 %12
161)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000162 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000163OpCapability ImageQuery
164)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000165 case ValidTextureOverload::kDimensions3dLevel:
166 return {
167 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000168%4 = OpTypeFloat 32
169%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
170%2 = OpTypePointer UniformConstant %3
171%1 = OpVariable %2 UniformConstant
172%7 = OpTypeSampler
173%6 = OpTypePointer UniformConstant %7
174%5 = OpVariable %6 UniformConstant
175%10 = OpTypeInt 32 1
176%9 = OpTypeVector %10 3
177%12 = OpConstant %10 1
178)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000179 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000180%11 = OpLoad %3 %1
181%8 = OpImageQuerySizeLod %9 %11 %12
182)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000183 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000184OpCapability ImageQuery
185)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000186 case ValidTextureOverload::kDimensionsCube:
187 return {
188 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000189%4 = OpTypeFloat 32
190%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
191%2 = OpTypePointer UniformConstant %3
192%1 = OpVariable %2 UniformConstant
193%7 = OpTypeSampler
194%6 = OpTypePointer UniformConstant %7
195%5 = OpVariable %6 UniformConstant
196%10 = OpTypeInt 32 1
197%9 = OpTypeVector %10 2
198%12 = OpConstant %10 0
199)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000200 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000201%11 = OpLoad %3 %1
202%8 = OpImageQuerySizeLod %9 %11 %12
203)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000204 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000205OpCapability ImageQuery
206)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000207 case ValidTextureOverload::kDimensionsCubeLevel:
208 return {
209 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000210%4 = OpTypeFloat 32
211%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
212%2 = OpTypePointer UniformConstant %3
213%1 = OpVariable %2 UniformConstant
214%7 = OpTypeSampler
215%6 = OpTypePointer UniformConstant %7
216%5 = OpVariable %6 UniformConstant
217%10 = OpTypeInt 32 1
218%9 = OpTypeVector %10 2
219%12 = OpConstant %10 1
220)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000221 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000222%11 = OpLoad %3 %1
223%8 = OpImageQuerySizeLod %9 %11 %12
224)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000225 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000226OpCapability ImageQuery
227)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000228 case ValidTextureOverload::kDimensionsCubeArray:
229 return {
230 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000231%4 = OpTypeFloat 32
232%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
233%2 = OpTypePointer UniformConstant %3
234%1 = OpVariable %2 UniformConstant
235%7 = OpTypeSampler
236%6 = OpTypePointer UniformConstant %7
237%5 = OpVariable %6 UniformConstant
238%10 = OpTypeInt 32 1
239%9 = OpTypeVector %10 2
240%12 = OpTypeVector %10 3
241%14 = OpConstant %10 0
242)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000243 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000244%13 = OpLoad %3 %1
245%11 = OpImageQuerySizeLod %12 %13 %14
246%8 = OpVectorShuffle %9 %11 %11 0 1
247)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000248 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000249OpCapability SampledCubeArray
250OpCapability ImageQuery
251)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000252 case ValidTextureOverload::kDimensionsCubeArrayLevel:
253 return {
254 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000255%4 = OpTypeFloat 32
256%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
257%2 = OpTypePointer UniformConstant %3
258%1 = OpVariable %2 UniformConstant
259%7 = OpTypeSampler
260%6 = OpTypePointer UniformConstant %7
261%5 = OpVariable %6 UniformConstant
262%10 = OpTypeInt 32 1
263%9 = OpTypeVector %10 2
264%12 = OpTypeVector %10 3
265%14 = OpConstant %10 1
266)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000267 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000268%13 = OpLoad %3 %1
269%11 = OpImageQuerySizeLod %12 %13 %14
270%8 = OpVectorShuffle %9 %11 %11 0 1
271)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000272 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000273OpCapability SampledCubeArray
274OpCapability ImageQuery
275)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000276 case ValidTextureOverload::kDimensionsMultisampled2d:
277 return {
278 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000279%4 = OpTypeFloat 32
280%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
281%2 = OpTypePointer UniformConstant %3
282%1 = OpVariable %2 UniformConstant
283%7 = OpTypeSampler
284%6 = OpTypePointer UniformConstant %7
285%5 = OpVariable %6 UniformConstant
286%10 = OpTypeInt 32 1
287%9 = OpTypeVector %10 2
288)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000289 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000290%11 = OpLoad %3 %1
291%8 = OpImageQuerySize %9 %11
292)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000293 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000294OpCapability ImageQuery
295)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000296 case ValidTextureOverload::kDimensionsDepth2d:
297 return {
298 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000299%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000300%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000301%2 = OpTypePointer UniformConstant %3
302%1 = OpVariable %2 UniformConstant
303%7 = OpTypeSampler
304%6 = OpTypePointer UniformConstant %7
305%5 = OpVariable %6 UniformConstant
306%10 = OpTypeInt 32 1
307%9 = OpTypeVector %10 2
308%12 = OpConstant %10 0
309)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000310 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000311%11 = OpLoad %3 %1
312%8 = OpImageQuerySizeLod %9 %11 %12
313)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000314 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000315OpCapability ImageQuery
316)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000317 case ValidTextureOverload::kDimensionsDepth2dLevel:
318 return {
319 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000320%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000321%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000322%2 = OpTypePointer UniformConstant %3
323%1 = OpVariable %2 UniformConstant
324%7 = OpTypeSampler
325%6 = OpTypePointer UniformConstant %7
326%5 = OpVariable %6 UniformConstant
327%10 = OpTypeInt 32 1
328%9 = OpTypeVector %10 2
329%12 = OpConstant %10 1
330)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000331 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000332%11 = OpLoad %3 %1
333%8 = OpImageQuerySizeLod %9 %11 %12
334)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000335 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000336OpCapability ImageQuery
337)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000338 case ValidTextureOverload::kDimensionsDepth2dArray:
339 return {
340 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000341%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000342%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000343%2 = OpTypePointer UniformConstant %3
344%1 = OpVariable %2 UniformConstant
345%7 = OpTypeSampler
346%6 = OpTypePointer UniformConstant %7
347%5 = OpVariable %6 UniformConstant
348%10 = OpTypeInt 32 1
349%9 = OpTypeVector %10 2
350%12 = OpTypeVector %10 3
351%14 = OpConstant %10 0
352)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000353 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000354%13 = OpLoad %3 %1
355%11 = OpImageQuerySizeLod %12 %13 %14
356%8 = OpVectorShuffle %9 %11 %11 0 1
357)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000358 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000359OpCapability ImageQuery
360)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000361 case ValidTextureOverload::kDimensionsDepth2dArrayLevel:
362 return {
363 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000364%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000365%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000366%2 = OpTypePointer UniformConstant %3
367%1 = OpVariable %2 UniformConstant
368%7 = OpTypeSampler
369%6 = OpTypePointer UniformConstant %7
370%5 = OpVariable %6 UniformConstant
371%10 = OpTypeInt 32 1
372%9 = OpTypeVector %10 2
373%12 = OpTypeVector %10 3
374%14 = OpConstant %10 1
375)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000376 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000377%13 = OpLoad %3 %1
378%11 = OpImageQuerySizeLod %12 %13 %14
379%8 = OpVectorShuffle %9 %11 %11 0 1
380)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000381 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000382OpCapability ImageQuery
383)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000384 case ValidTextureOverload::kDimensionsDepthCube:
385 return {
386 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000387%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000388%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000389%2 = OpTypePointer UniformConstant %3
390%1 = OpVariable %2 UniformConstant
391%7 = OpTypeSampler
392%6 = OpTypePointer UniformConstant %7
393%5 = OpVariable %6 UniformConstant
394%10 = OpTypeInt 32 1
395%9 = OpTypeVector %10 2
396%12 = OpConstant %10 0
397)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000398 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000399%11 = OpLoad %3 %1
400%8 = OpImageQuerySizeLod %9 %11 %12
401)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000402 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000403OpCapability ImageQuery
404)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000405 case ValidTextureOverload::kDimensionsDepthCubeLevel:
406 return {
407 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000408%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000409%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000410%2 = OpTypePointer UniformConstant %3
411%1 = OpVariable %2 UniformConstant
412%7 = OpTypeSampler
413%6 = OpTypePointer UniformConstant %7
414%5 = OpVariable %6 UniformConstant
415%10 = OpTypeInt 32 1
416%9 = OpTypeVector %10 2
417%12 = OpConstant %10 1
418)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000419 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000420%11 = OpLoad %3 %1
421%8 = OpImageQuerySizeLod %9 %11 %12
422)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000423 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000424OpCapability ImageQuery
425)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000426 case ValidTextureOverload::kDimensionsDepthCubeArray:
427 return {
428 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000429%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000430%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000431%2 = OpTypePointer UniformConstant %3
432%1 = OpVariable %2 UniformConstant
433%7 = OpTypeSampler
434%6 = OpTypePointer UniformConstant %7
435%5 = OpVariable %6 UniformConstant
436%10 = OpTypeInt 32 1
437%9 = OpTypeVector %10 2
438%12 = OpTypeVector %10 3
439%14 = OpConstant %10 0
440)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000441 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000442%13 = OpLoad %3 %1
443%11 = OpImageQuerySizeLod %12 %13 %14
444%8 = OpVectorShuffle %9 %11 %11 0 1
445)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000446 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000447OpCapability SampledCubeArray
448OpCapability ImageQuery
449)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000450 case ValidTextureOverload::kDimensionsDepthCubeArrayLevel:
451 return {
452 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000453%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000454%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000455%2 = OpTypePointer UniformConstant %3
456%1 = OpVariable %2 UniformConstant
457%7 = OpTypeSampler
458%6 = OpTypePointer UniformConstant %7
459%5 = OpVariable %6 UniformConstant
460%10 = OpTypeInt 32 1
461%9 = OpTypeVector %10 2
462%12 = OpTypeVector %10 3
463%14 = OpConstant %10 1
464)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000465 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000466%13 = OpLoad %3 %1
467%11 = OpImageQuerySizeLod %12 %13 %14
468%8 = OpVectorShuffle %9 %11 %11 0 1
469)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000470 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000471OpCapability SampledCubeArray
472OpCapability ImageQuery
473)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000474 case ValidTextureOverload::kDimensionsDepthMultisampled2d:
475 return {
476 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000477%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000478%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000479%2 = OpTypePointer UniformConstant %3
480%1 = OpVariable %2 UniformConstant
481%7 = OpTypeSampler
482%6 = OpTypePointer UniformConstant %7
483%5 = OpVariable %6 UniformConstant
484%10 = OpTypeInt 32 1
485%9 = OpTypeVector %10 2
486)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000487 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000488%11 = OpLoad %3 %1
489%8 = OpImageQuerySize %9 %11
490)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000491 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000492OpCapability ImageQuery
493)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000494 case ValidTextureOverload::kDimensionsStorageWO1d:
495 return {
496 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000497%4 = OpTypeFloat 32
498%3 = OpTypeImage %4 1D 0 0 0 2 Rgba32f
499%2 = OpTypePointer UniformConstant %3
500%1 = OpVariable %2 UniformConstant
501%7 = OpTypeSampler
502%6 = OpTypePointer UniformConstant %7
503%5 = OpVariable %6 UniformConstant
504%9 = OpTypeInt 32 1
505)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000506 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000507%10 = OpLoad %3 %1
508%8 = OpImageQuerySize %9 %10
509)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000510 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000511OpCapability Image1D
512OpCapability ImageQuery
513)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000514 case ValidTextureOverload::kDimensionsStorageWO2d:
515 return {
516 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000517%4 = OpTypeFloat 32
518%3 = OpTypeImage %4 2D 0 0 0 2 Rgba32f
519%2 = OpTypePointer UniformConstant %3
520%1 = OpVariable %2 UniformConstant
521%7 = OpTypeSampler
522%6 = OpTypePointer UniformConstant %7
523%5 = OpVariable %6 UniformConstant
524%10 = OpTypeInt 32 1
525%9 = OpTypeVector %10 2
526)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000527 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000528%11 = OpLoad %3 %1
529%8 = OpImageQuerySize %9 %11
530)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000531 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000532OpCapability ImageQuery
533)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000534 case ValidTextureOverload::kDimensionsStorageWO2dArray:
535 return {
536 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000537%4 = OpTypeFloat 32
538%3 = OpTypeImage %4 2D 0 1 0 2 Rgba32f
539%2 = OpTypePointer UniformConstant %3
540%1 = OpVariable %2 UniformConstant
541%7 = OpTypeSampler
542%6 = OpTypePointer UniformConstant %7
543%5 = OpVariable %6 UniformConstant
544%10 = OpTypeInt 32 1
545%9 = OpTypeVector %10 2
546%12 = OpTypeVector %10 3
547)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000548 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000549%13 = OpLoad %3 %1
550%11 = OpImageQuerySize %12 %13
551%8 = OpVectorShuffle %9 %11 %11 0 1
552)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000553 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000554OpCapability ImageQuery
555)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000556 case ValidTextureOverload::kDimensionsStorageWO3d:
557 return {
558 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000559%4 = OpTypeFloat 32
560%3 = OpTypeImage %4 3D 0 0 0 2 Rgba32f
561%2 = OpTypePointer UniformConstant %3
562%1 = OpVariable %2 UniformConstant
563%7 = OpTypeSampler
564%6 = OpTypePointer UniformConstant %7
565%5 = OpVariable %6 UniformConstant
566%10 = OpTypeInt 32 1
567%9 = OpTypeVector %10 3
568)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000569 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000570%11 = OpLoad %3 %1
571%8 = OpImageQuerySize %9 %11
572)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000573 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000574OpCapability ImageQuery
575)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000576 case ValidTextureOverload::kGather2dF32:
577 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000578%4 = OpTypeFloat 32
579%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
580%2 = OpTypePointer UniformConstant %3
581%1 = OpVariable %2 UniformConstant
582%7 = OpTypeSampler
583%6 = OpTypePointer UniformConstant %7
584%5 = OpVariable %6 UniformConstant
585%9 = OpTypeVector %4 4
586%12 = OpTypeSampledImage %3
587%14 = OpTypeVector %4 2
588%15 = OpConstant %4 1
589%16 = OpConstant %4 2
590%17 = OpConstantComposite %14 %15 %16
591%18 = OpTypeInt 32 1
Ben Clayton8e348522022-06-01 15:57:22 +0000592%19 = OpConstantNull %18
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000593)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000594 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000595%10 = OpLoad %7 %5
596%11 = OpLoad %3 %1
597%13 = OpSampledImage %12 %11 %10
598%8 = OpImageGather %9 %13 %17 %19
599)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000600 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000601)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000602 case ValidTextureOverload::kGather2dOffsetF32:
603 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000604%4 = OpTypeFloat 32
605%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
606%2 = OpTypePointer UniformConstant %3
607%1 = OpVariable %2 UniformConstant
608%7 = OpTypeSampler
609%6 = OpTypePointer UniformConstant %7
610%5 = OpVariable %6 UniformConstant
611%9 = OpTypeVector %4 4
612%12 = OpTypeSampledImage %3
613%14 = OpTypeVector %4 2
614%15 = OpConstant %4 1
615%16 = OpConstant %4 2
616%17 = OpConstantComposite %14 %15 %16
617%18 = OpTypeInt 32 1
Ben Clayton8e348522022-06-01 15:57:22 +0000618%19 = OpConstantNull %18
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000619%20 = OpTypeVector %18 2
620%21 = OpConstant %18 3
621%22 = OpConstant %18 4
622%23 = OpConstantComposite %20 %21 %22
623)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000624 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000625%10 = OpLoad %7 %5
626%11 = OpLoad %3 %1
627%13 = OpSampledImage %12 %11 %10
628%8 = OpImageGather %9 %13 %17 %19 ConstOffset %23
629)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000630 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000631)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000632 case ValidTextureOverload::kGather2dArrayF32:
633 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000634%4 = OpTypeFloat 32
635%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
636%2 = OpTypePointer UniformConstant %3
637%1 = OpVariable %2 UniformConstant
638%7 = OpTypeSampler
639%6 = OpTypePointer UniformConstant %7
640%5 = OpVariable %6 UniformConstant
641%9 = OpTypeVector %4 4
642%12 = OpTypeSampledImage %3
643%14 = OpTypeVector %4 3
644%15 = OpConstant %4 1
645%16 = OpConstant %4 2
646%18 = OpTypeInt 32 1
647%19 = OpConstant %18 3
Ben Clayton8e348522022-06-01 15:57:22 +0000648%21 = OpConstantNull %18
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000649)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000650 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000651%10 = OpLoad %7 %5
652%11 = OpLoad %3 %1
653%13 = OpSampledImage %12 %11 %10
654%17 = OpConvertSToF %4 %19
655%20 = OpCompositeConstruct %14 %15 %16 %17
656%8 = OpImageGather %9 %13 %20 %21
657)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000658 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000659)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000660 case ValidTextureOverload::kGather2dArrayOffsetF32:
661 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000662%4 = OpTypeFloat 32
663%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
664%2 = OpTypePointer UniformConstant %3
665%1 = OpVariable %2 UniformConstant
666%7 = OpTypeSampler
667%6 = OpTypePointer UniformConstant %7
668%5 = OpVariable %6 UniformConstant
669%9 = OpTypeVector %4 4
670%12 = OpTypeSampledImage %3
671%14 = OpTypeVector %4 3
672%15 = OpConstant %4 1
673%16 = OpConstant %4 2
674%18 = OpTypeInt 32 1
675%19 = OpConstant %18 3
Ben Clayton8e348522022-06-01 15:57:22 +0000676%21 = OpConstantNull %18
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000677%22 = OpTypeVector %18 2
678%23 = OpConstant %18 4
679%24 = OpConstant %18 5
680%25 = OpConstantComposite %22 %23 %24
681)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000682 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000683%10 = OpLoad %7 %5
684%11 = OpLoad %3 %1
685%13 = OpSampledImage %12 %11 %10
686%17 = OpConvertSToF %4 %19
687%20 = OpCompositeConstruct %14 %15 %16 %17
688%8 = OpImageGather %9 %13 %20 %21 ConstOffset %25
689)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000690 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000691)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000692 case ValidTextureOverload::kGatherCubeF32:
693 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000694%4 = OpTypeFloat 32
695%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
696%2 = OpTypePointer UniformConstant %3
697%1 = OpVariable %2 UniformConstant
698%7 = OpTypeSampler
699%6 = OpTypePointer UniformConstant %7
700%5 = OpVariable %6 UniformConstant
701%9 = OpTypeVector %4 4
702%12 = OpTypeSampledImage %3
703%14 = OpTypeVector %4 3
704%15 = OpConstant %4 1
705%16 = OpConstant %4 2
706%17 = OpConstant %4 3
707%18 = OpConstantComposite %14 %15 %16 %17
708%19 = OpTypeInt 32 1
Ben Clayton8e348522022-06-01 15:57:22 +0000709%20 = OpConstantNull %19
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000710)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000711 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000712%10 = OpLoad %7 %5
713%11 = OpLoad %3 %1
714%13 = OpSampledImage %12 %11 %10
715%8 = OpImageGather %9 %13 %18 %20
716)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000717 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000718)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000719 case ValidTextureOverload::kGatherCubeArrayF32:
720 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000721%4 = OpTypeFloat 32
722%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
723%2 = OpTypePointer UniformConstant %3
724%1 = OpVariable %2 UniformConstant
725%7 = OpTypeSampler
726%6 = OpTypePointer UniformConstant %7
727%5 = OpVariable %6 UniformConstant
728%9 = OpTypeVector %4 4
729%12 = OpTypeSampledImage %3
730%14 = OpConstant %4 1
731%15 = OpConstant %4 2
732%16 = OpConstant %4 3
733%18 = OpTypeInt 32 1
734%19 = OpConstant %18 4
Ben Clayton8e348522022-06-01 15:57:22 +0000735%21 = OpConstantNull %18
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000736)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000737 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000738%10 = OpLoad %7 %5
739%11 = OpLoad %3 %1
740%13 = OpSampledImage %12 %11 %10
741%17 = OpConvertSToF %4 %19
742%20 = OpCompositeConstruct %9 %14 %15 %16 %17
743%8 = OpImageGather %9 %13 %20 %21
744)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000745 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000746OpCapability SampledCubeArray
747)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000748 case ValidTextureOverload::kGatherDepth2dF32:
749 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000750%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000751%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000752%2 = OpTypePointer UniformConstant %3
753%1 = OpVariable %2 UniformConstant
754%7 = OpTypeSampler
755%6 = OpTypePointer UniformConstant %7
756%5 = OpVariable %6 UniformConstant
757%9 = OpTypeVector %4 4
758%12 = OpTypeSampledImage %3
759%14 = OpTypeVector %4 2
760%15 = OpConstant %4 1
761%16 = OpConstant %4 2
762%17 = OpConstantComposite %14 %15 %16
763%18 = OpTypeInt 32 1
764%19 = OpConstant %18 0
765)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000766 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000767%10 = OpLoad %7 %5
768%11 = OpLoad %3 %1
769%13 = OpSampledImage %12 %11 %10
770%8 = OpImageGather %9 %13 %17 %19
771)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000772 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000773)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000774 case ValidTextureOverload::kGatherDepth2dOffsetF32:
775 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000776%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000777%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000778%2 = OpTypePointer UniformConstant %3
779%1 = OpVariable %2 UniformConstant
780%7 = OpTypeSampler
781%6 = OpTypePointer UniformConstant %7
782%5 = OpVariable %6 UniformConstant
783%9 = OpTypeVector %4 4
784%12 = OpTypeSampledImage %3
785%14 = OpTypeVector %4 2
786%15 = OpConstant %4 1
787%16 = OpConstant %4 2
788%17 = OpConstantComposite %14 %15 %16
789%18 = OpTypeInt 32 1
790%19 = OpConstant %18 0
791%20 = OpTypeVector %18 2
792%21 = OpConstant %18 3
793%22 = OpConstant %18 4
794%23 = OpConstantComposite %20 %21 %22
795)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000796 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000797%10 = OpLoad %7 %5
798%11 = OpLoad %3 %1
799%13 = OpSampledImage %12 %11 %10
800%8 = OpImageGather %9 %13 %17 %19 ConstOffset %23
801)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000802 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000803)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000804 case ValidTextureOverload::kGatherDepth2dArrayF32:
805 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000806%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000807%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000808%2 = OpTypePointer UniformConstant %3
809%1 = OpVariable %2 UniformConstant
810%7 = OpTypeSampler
811%6 = OpTypePointer UniformConstant %7
812%5 = OpVariable %6 UniformConstant
813%9 = OpTypeVector %4 4
814%12 = OpTypeSampledImage %3
815%14 = OpTypeVector %4 3
816%15 = OpConstant %4 1
817%16 = OpConstant %4 2
818%18 = OpTypeInt 32 1
819%19 = OpConstant %18 3
820%21 = OpConstant %18 0
821)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000822 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000823%10 = OpLoad %7 %5
824%11 = OpLoad %3 %1
825%13 = OpSampledImage %12 %11 %10
826%17 = OpConvertSToF %4 %19
827%20 = OpCompositeConstruct %14 %15 %16 %17
828%8 = OpImageGather %9 %13 %20 %21
829)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000830 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000831)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000832 case ValidTextureOverload::kGatherDepth2dArrayOffsetF32:
833 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000834%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000835%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000836%2 = OpTypePointer UniformConstant %3
837%1 = OpVariable %2 UniformConstant
838%7 = OpTypeSampler
839%6 = OpTypePointer UniformConstant %7
840%5 = OpVariable %6 UniformConstant
841%9 = OpTypeVector %4 4
842%12 = OpTypeSampledImage %3
843%14 = OpTypeVector %4 3
844%15 = OpConstant %4 1
845%16 = OpConstant %4 2
846%18 = OpTypeInt 32 1
847%19 = OpConstant %18 3
848%21 = OpConstant %18 0
849%22 = OpTypeVector %18 2
850%23 = OpConstant %18 4
851%24 = OpConstant %18 5
852%25 = OpConstantComposite %22 %23 %24
853)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000854 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000855%10 = OpLoad %7 %5
856%11 = OpLoad %3 %1
857%13 = OpSampledImage %12 %11 %10
858%17 = OpConvertSToF %4 %19
859%20 = OpCompositeConstruct %14 %15 %16 %17
860%8 = OpImageGather %9 %13 %20 %21 ConstOffset %25
861)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000862 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000863)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000864 case ValidTextureOverload::kGatherDepthCubeF32:
865 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000866%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000867%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000868%2 = OpTypePointer UniformConstant %3
869%1 = OpVariable %2 UniformConstant
870%7 = OpTypeSampler
871%6 = OpTypePointer UniformConstant %7
872%5 = OpVariable %6 UniformConstant
873%9 = OpTypeVector %4 4
874%12 = OpTypeSampledImage %3
875%14 = OpTypeVector %4 3
876%15 = OpConstant %4 1
877%16 = OpConstant %4 2
878%17 = OpConstant %4 3
879%18 = OpConstantComposite %14 %15 %16 %17
880%19 = OpTypeInt 32 1
881%20 = OpConstant %19 0
882)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000883 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000884%10 = OpLoad %7 %5
885%11 = OpLoad %3 %1
886%13 = OpSampledImage %12 %11 %10
887%8 = OpImageGather %9 %13 %18 %20
888)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000889 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000890)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000891 case ValidTextureOverload::kGatherDepthCubeArrayF32:
892 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000893%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000894%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000895%2 = OpTypePointer UniformConstant %3
896%1 = OpVariable %2 UniformConstant
897%7 = OpTypeSampler
898%6 = OpTypePointer UniformConstant %7
899%5 = OpVariable %6 UniformConstant
900%9 = OpTypeVector %4 4
901%12 = OpTypeSampledImage %3
902%14 = OpConstant %4 1
903%15 = OpConstant %4 2
904%16 = OpConstant %4 3
905%18 = OpTypeInt 32 1
906%19 = OpConstant %18 4
907%21 = OpConstant %18 0
908)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000909 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000910%10 = OpLoad %7 %5
911%11 = OpLoad %3 %1
912%13 = OpSampledImage %12 %11 %10
913%17 = OpConvertSToF %4 %19
914%20 = OpCompositeConstruct %9 %14 %15 %16 %17
915%8 = OpImageGather %9 %13 %20 %21
916)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000917 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000918OpCapability SampledCubeArray
919)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000920 case ValidTextureOverload::kGatherCompareDepth2dF32:
921 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000922%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000923%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000924%2 = OpTypePointer UniformConstant %3
925%1 = OpVariable %2 UniformConstant
926%7 = OpTypeSampler
927%6 = OpTypePointer UniformConstant %7
928%5 = OpVariable %6 UniformConstant
929%9 = OpTypeVector %4 4
930%12 = OpTypeSampledImage %3
931%14 = OpTypeVector %4 2
932%15 = OpConstant %4 1
933%16 = OpConstant %4 2
934%17 = OpConstantComposite %14 %15 %16
935%18 = OpConstant %4 3
936)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000937 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000938%10 = OpLoad %7 %5
939%11 = OpLoad %3 %1
940%13 = OpSampledImage %12 %11 %10
941%8 = OpImageDrefGather %9 %13 %17 %18
942)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000943 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000944)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000945 case ValidTextureOverload::kGatherCompareDepth2dOffsetF32:
946 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000947%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000948%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000949%2 = OpTypePointer UniformConstant %3
950%1 = OpVariable %2 UniformConstant
951%7 = OpTypeSampler
952%6 = OpTypePointer UniformConstant %7
953%5 = OpVariable %6 UniformConstant
954%9 = OpTypeVector %4 4
955%12 = OpTypeSampledImage %3
956%14 = OpTypeVector %4 2
957%15 = OpConstant %4 1
958%16 = OpConstant %4 2
959%17 = OpConstantComposite %14 %15 %16
960%18 = OpConstant %4 3
961%20 = OpTypeInt 32 1
962%19 = OpTypeVector %20 2
963%21 = OpConstant %20 4
964%22 = OpConstant %20 5
965%23 = OpConstantComposite %19 %21 %22
966)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000967 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000968%10 = OpLoad %7 %5
969%11 = OpLoad %3 %1
970%13 = OpSampledImage %12 %11 %10
971%8 = OpImageDrefGather %9 %13 %17 %18 ConstOffset %23
972)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000973 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000974)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +0000975 case ValidTextureOverload::kGatherCompareDepth2dArrayF32:
976 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000977%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +0000978%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000979%2 = OpTypePointer UniformConstant %3
980%1 = OpVariable %2 UniformConstant
981%7 = OpTypeSampler
982%6 = OpTypePointer UniformConstant %7
983%5 = OpVariable %6 UniformConstant
984%9 = OpTypeVector %4 4
985%12 = OpTypeSampledImage %3
986%14 = OpTypeVector %4 3
987%15 = OpConstant %4 1
988%16 = OpConstant %4 2
989%18 = OpTypeInt 32 1
990%19 = OpConstant %18 3
991%21 = OpConstant %4 4
992)",
dan sinclair41e4d9a2022-05-01 14:40:55 +0000993 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000994%10 = OpLoad %7 %5
995%11 = OpLoad %3 %1
996%13 = OpSampledImage %12 %11 %10
997%17 = OpConvertSToF %4 %19
998%20 = OpCompositeConstruct %14 %15 %16 %17
999%8 = OpImageDrefGather %9 %13 %20 %21
1000)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001001 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001002)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001003 case ValidTextureOverload::kGatherCompareDepth2dArrayOffsetF32:
1004 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001005%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001006%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001007%2 = OpTypePointer UniformConstant %3
1008%1 = OpVariable %2 UniformConstant
1009%7 = OpTypeSampler
1010%6 = OpTypePointer UniformConstant %7
1011%5 = OpVariable %6 UniformConstant
1012%9 = OpTypeVector %4 4
1013%12 = OpTypeSampledImage %3
1014%14 = OpTypeVector %4 3
1015%15 = OpConstant %4 1
1016%16 = OpConstant %4 2
1017%18 = OpTypeInt 32 1
1018%19 = OpConstant %18 3
1019%21 = OpConstant %4 4
1020%22 = OpTypeVector %18 2
1021%23 = OpConstant %18 5
1022%24 = OpConstant %18 6
1023%25 = OpConstantComposite %22 %23 %24
1024)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001025 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001026%10 = OpLoad %7 %5
1027%11 = OpLoad %3 %1
1028%13 = OpSampledImage %12 %11 %10
1029%17 = OpConvertSToF %4 %19
1030%20 = OpCompositeConstruct %14 %15 %16 %17
1031%8 = OpImageDrefGather %9 %13 %20 %21 ConstOffset %25
1032)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001033 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001034)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001035 case ValidTextureOverload::kGatherCompareDepthCubeF32:
1036 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001037%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001038%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001039%2 = OpTypePointer UniformConstant %3
1040%1 = OpVariable %2 UniformConstant
1041%7 = OpTypeSampler
1042%6 = OpTypePointer UniformConstant %7
1043%5 = OpVariable %6 UniformConstant
1044%9 = OpTypeVector %4 4
1045%12 = OpTypeSampledImage %3
1046%14 = OpTypeVector %4 3
1047%15 = OpConstant %4 1
1048%16 = OpConstant %4 2
1049%17 = OpConstant %4 3
1050%18 = OpConstantComposite %14 %15 %16 %17
1051%19 = OpConstant %4 4
1052)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001053 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001054%10 = OpLoad %7 %5
1055%11 = OpLoad %3 %1
1056%13 = OpSampledImage %12 %11 %10
1057%8 = OpImageDrefGather %9 %13 %18 %19
1058)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001059 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001060)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001061 case ValidTextureOverload::kGatherCompareDepthCubeArrayF32:
1062 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001063%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001064%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001065%2 = OpTypePointer UniformConstant %3
1066%1 = OpVariable %2 UniformConstant
1067%7 = OpTypeSampler
1068%6 = OpTypePointer UniformConstant %7
1069%5 = OpVariable %6 UniformConstant
1070%9 = OpTypeVector %4 4
1071%12 = OpTypeSampledImage %3
1072%14 = OpConstant %4 1
1073%15 = OpConstant %4 2
1074%16 = OpConstant %4 3
1075%18 = OpTypeInt 32 1
1076%19 = OpConstant %18 4
1077%21 = OpConstant %4 5
1078)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001079 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001080%10 = OpLoad %7 %5
1081%11 = OpLoad %3 %1
1082%13 = OpSampledImage %12 %11 %10
1083%17 = OpConvertSToF %4 %19
1084%20 = OpCompositeConstruct %9 %14 %15 %16 %17
1085%8 = OpImageDrefGather %9 %13 %20 %21
1086)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001087 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001088OpCapability SampledCubeArray
1089)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001090 case ValidTextureOverload::kNumLayers2dArray:
1091 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001092%4 = OpTypeFloat 32
1093%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
1094%2 = OpTypePointer UniformConstant %3
1095%1 = OpVariable %2 UniformConstant
1096%7 = OpTypeSampler
1097%6 = OpTypePointer UniformConstant %7
1098%5 = OpVariable %6 UniformConstant
1099%9 = OpTypeInt 32 1
1100%11 = OpTypeVector %9 3
1101%13 = OpConstant %9 0
1102)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001103 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001104%12 = OpLoad %3 %1
1105%10 = OpImageQuerySizeLod %11 %12 %13
1106%8 = OpCompositeExtract %9 %10 2
1107)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001108 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001109OpCapability ImageQuery
1110)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001111 case ValidTextureOverload::kNumLayersCubeArray:
1112 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001113%4 = OpTypeFloat 32
1114%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
1115%2 = OpTypePointer UniformConstant %3
1116%1 = OpVariable %2 UniformConstant
1117%7 = OpTypeSampler
1118%6 = OpTypePointer UniformConstant %7
1119%5 = OpVariable %6 UniformConstant
1120%9 = OpTypeInt 32 1
1121%11 = OpTypeVector %9 3
1122%13 = OpConstant %9 0
1123)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001124 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001125%12 = OpLoad %3 %1
1126%10 = OpImageQuerySizeLod %11 %12 %13
1127%8 = OpCompositeExtract %9 %10 2
1128)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001129 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001130OpCapability SampledCubeArray
1131OpCapability ImageQuery
1132)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001133 case ValidTextureOverload::kNumLayersDepth2dArray:
1134 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001135%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001136%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001137%2 = OpTypePointer UniformConstant %3
1138%1 = OpVariable %2 UniformConstant
1139%7 = OpTypeSampler
1140%6 = OpTypePointer UniformConstant %7
1141%5 = OpVariable %6 UniformConstant
1142%9 = OpTypeInt 32 1
1143%11 = OpTypeVector %9 3
1144%13 = OpConstant %9 0
1145)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001146 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001147%12 = OpLoad %3 %1
1148%10 = OpImageQuerySizeLod %11 %12 %13
1149%8 = OpCompositeExtract %9 %10 2
1150)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001151 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001152OpCapability ImageQuery
1153)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001154 case ValidTextureOverload::kNumLayersDepthCubeArray:
1155 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001156%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001157%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001158%2 = OpTypePointer UniformConstant %3
1159%1 = OpVariable %2 UniformConstant
1160%7 = OpTypeSampler
1161%6 = OpTypePointer UniformConstant %7
1162%5 = OpVariable %6 UniformConstant
1163%9 = OpTypeInt 32 1
1164%11 = OpTypeVector %9 3
1165%13 = OpConstant %9 0
1166)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001167 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001168%12 = OpLoad %3 %1
1169%10 = OpImageQuerySizeLod %11 %12 %13
1170%8 = OpCompositeExtract %9 %10 2
1171)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001172 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001173OpCapability SampledCubeArray
1174OpCapability ImageQuery
1175)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001176 case ValidTextureOverload::kNumLayersStorageWO2dArray:
1177 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001178%4 = OpTypeFloat 32
1179%3 = OpTypeImage %4 2D 0 1 0 2 Rgba32f
1180%2 = OpTypePointer UniformConstant %3
1181%1 = OpVariable %2 UniformConstant
1182%7 = OpTypeSampler
1183%6 = OpTypePointer UniformConstant %7
1184%5 = OpVariable %6 UniformConstant
1185%9 = OpTypeInt 32 1
1186%11 = OpTypeVector %9 3
1187)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001188 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001189%12 = OpLoad %3 %1
1190%10 = OpImageQuerySize %11 %12
1191%8 = OpCompositeExtract %9 %10 2
1192)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001193 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001194OpCapability ImageQuery
1195)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001196 case ValidTextureOverload::kNumLevels2d:
1197 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001198%4 = OpTypeFloat 32
1199%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
1200%2 = OpTypePointer UniformConstant %3
1201%1 = OpVariable %2 UniformConstant
1202%7 = OpTypeSampler
1203%6 = OpTypePointer UniformConstant %7
1204%5 = OpVariable %6 UniformConstant
1205%9 = OpTypeInt 32 1
1206)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001207 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001208%10 = OpLoad %3 %1
1209%8 = OpImageQueryLevels %9 %10
1210)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001211 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001212OpCapability ImageQuery
1213)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001214 case ValidTextureOverload::kNumLevels2dArray:
1215 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001216%4 = OpTypeFloat 32
1217%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
1218%2 = OpTypePointer UniformConstant %3
1219%1 = OpVariable %2 UniformConstant
1220%7 = OpTypeSampler
1221%6 = OpTypePointer UniformConstant %7
1222%5 = OpVariable %6 UniformConstant
1223%9 = OpTypeInt 32 1
1224)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001225 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001226%10 = OpLoad %3 %1
1227%8 = OpImageQueryLevels %9 %10
1228)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001229 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001230OpCapability ImageQuery
1231)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001232 case ValidTextureOverload::kNumLevels3d:
1233 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001234%4 = OpTypeFloat 32
1235%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
1236%2 = OpTypePointer UniformConstant %3
1237%1 = OpVariable %2 UniformConstant
1238%7 = OpTypeSampler
1239%6 = OpTypePointer UniformConstant %7
1240%5 = OpVariable %6 UniformConstant
1241%9 = OpTypeInt 32 1
1242)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001243 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001244%10 = OpLoad %3 %1
1245%8 = OpImageQueryLevels %9 %10
1246)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001247 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001248OpCapability ImageQuery
1249)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001250 case ValidTextureOverload::kNumLevelsCube:
1251 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001252%4 = OpTypeFloat 32
1253%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
1254%2 = OpTypePointer UniformConstant %3
1255%1 = OpVariable %2 UniformConstant
1256%7 = OpTypeSampler
1257%6 = OpTypePointer UniformConstant %7
1258%5 = OpVariable %6 UniformConstant
1259%9 = OpTypeInt 32 1
1260)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001261 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001262%10 = OpLoad %3 %1
1263%8 = OpImageQueryLevels %9 %10
1264)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001265 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001266OpCapability ImageQuery
1267)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001268 case ValidTextureOverload::kNumLevelsCubeArray:
1269 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001270%4 = OpTypeFloat 32
1271%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
1272%2 = OpTypePointer UniformConstant %3
1273%1 = OpVariable %2 UniformConstant
1274%7 = OpTypeSampler
1275%6 = OpTypePointer UniformConstant %7
1276%5 = OpVariable %6 UniformConstant
1277%9 = OpTypeInt 32 1
1278)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001279 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001280%10 = OpLoad %3 %1
1281%8 = OpImageQueryLevels %9 %10
1282)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001283 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001284OpCapability SampledCubeArray
1285OpCapability ImageQuery
1286)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001287 case ValidTextureOverload::kNumLevelsDepth2d:
1288 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001289%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001290%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001291%2 = OpTypePointer UniformConstant %3
1292%1 = OpVariable %2 UniformConstant
1293%7 = OpTypeSampler
1294%6 = OpTypePointer UniformConstant %7
1295%5 = OpVariable %6 UniformConstant
1296%9 = OpTypeInt 32 1
1297)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001298 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001299%10 = OpLoad %3 %1
1300%8 = OpImageQueryLevels %9 %10
1301)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001302 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001303OpCapability ImageQuery
1304)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001305 case ValidTextureOverload::kNumLevelsDepth2dArray:
1306 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001307%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001308%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001309%2 = OpTypePointer UniformConstant %3
1310%1 = OpVariable %2 UniformConstant
1311%7 = OpTypeSampler
1312%6 = OpTypePointer UniformConstant %7
1313%5 = OpVariable %6 UniformConstant
1314%9 = OpTypeInt 32 1
1315)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001316 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001317%10 = OpLoad %3 %1
1318%8 = OpImageQueryLevels %9 %10
1319)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001320 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001321OpCapability ImageQuery
1322)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001323 case ValidTextureOverload::kNumLevelsDepthCube:
1324 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001325%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001326%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001327%2 = OpTypePointer UniformConstant %3
1328%1 = OpVariable %2 UniformConstant
1329%7 = OpTypeSampler
1330%6 = OpTypePointer UniformConstant %7
1331%5 = OpVariable %6 UniformConstant
1332%9 = OpTypeInt 32 1
1333)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001334 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001335%10 = OpLoad %3 %1
1336%8 = OpImageQueryLevels %9 %10
1337)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001338 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001339OpCapability ImageQuery
1340)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001341 case ValidTextureOverload::kNumLevelsDepthCubeArray:
1342 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001343%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001344%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001345%2 = OpTypePointer UniformConstant %3
1346%1 = OpVariable %2 UniformConstant
1347%7 = OpTypeSampler
1348%6 = OpTypePointer UniformConstant %7
1349%5 = OpVariable %6 UniformConstant
1350%9 = OpTypeInt 32 1
1351)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001352 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001353%10 = OpLoad %3 %1
1354%8 = OpImageQueryLevels %9 %10
1355)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001356 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001357OpCapability SampledCubeArray
1358OpCapability ImageQuery
1359)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001360 case ValidTextureOverload::kNumSamplesMultisampled2d:
1361 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001362%4 = OpTypeFloat 32
1363%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
1364%2 = OpTypePointer UniformConstant %3
1365%1 = OpVariable %2 UniformConstant
1366%7 = OpTypeSampler
1367%6 = OpTypePointer UniformConstant %7
1368%5 = OpVariable %6 UniformConstant
1369%9 = OpTypeInt 32 1
1370)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001371 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001372%10 = OpLoad %3 %1
1373%8 = OpImageQuerySamples %9 %10
1374)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001375 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001376OpCapability ImageQuery
1377)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001378 case ValidTextureOverload::kNumSamplesDepthMultisampled2d:
1379 return {R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001380%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001381%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001382%2 = OpTypePointer UniformConstant %3
1383%1 = OpVariable %2 UniformConstant
1384%7 = OpTypeSampler
1385%6 = OpTypePointer UniformConstant %7
1386%5 = OpVariable %6 UniformConstant
1387%9 = OpTypeInt 32 1
1388)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001389 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001390%10 = OpLoad %3 %1
1391%8 = OpImageQuerySamples %9 %10
1392)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001393 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001394OpCapability ImageQuery
1395)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001396 case ValidTextureOverload::kSample1dF32:
1397 return {
1398 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001399%4 = OpTypeFloat 32
1400%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
1401%2 = OpTypePointer UniformConstant %3
1402%1 = OpVariable %2 UniformConstant
1403%7 = OpTypeSampler
1404%6 = OpTypePointer UniformConstant %7
1405%5 = OpVariable %6 UniformConstant
1406%9 = OpTypeVector %4 4
1407%12 = OpTypeSampledImage %3
1408%14 = OpConstant %4 1
1409)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001410 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001411%10 = OpLoad %7 %5
1412%11 = OpLoad %3 %1
1413%13 = OpSampledImage %12 %11 %10
1414%8 = OpImageSampleImplicitLod %9 %13 %14
1415)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001416 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001417OpCapability Sampled1D
1418)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001419 case ValidTextureOverload::kSample2dF32:
1420 return {
1421 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001422%4 = OpTypeFloat 32
1423%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
1424%2 = OpTypePointer UniformConstant %3
1425%1 = OpVariable %2 UniformConstant
1426%7 = OpTypeSampler
1427%6 = OpTypePointer UniformConstant %7
1428%5 = OpVariable %6 UniformConstant
1429%9 = OpTypeVector %4 4
1430%12 = OpTypeSampledImage %3
1431%14 = OpTypeVector %4 2
1432%15 = OpConstant %4 1
1433%16 = OpConstant %4 2
1434%17 = OpConstantComposite %14 %15 %16
1435)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001436 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001437%10 = OpLoad %7 %5
1438%11 = OpLoad %3 %1
1439%13 = OpSampledImage %12 %11 %10
1440%8 = OpImageSampleImplicitLod %9 %13 %17
1441)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001442 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001443)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001444 case ValidTextureOverload::kSample2dOffsetF32:
1445 return {
1446 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001447%4 = OpTypeFloat 32
1448%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
1449%2 = OpTypePointer UniformConstant %3
1450%1 = OpVariable %2 UniformConstant
1451%7 = OpTypeSampler
1452%6 = OpTypePointer UniformConstant %7
1453%5 = OpVariable %6 UniformConstant
1454%9 = OpTypeVector %4 4
1455%12 = OpTypeSampledImage %3
1456%14 = OpTypeVector %4 2
1457%15 = OpConstant %4 1
1458%16 = OpConstant %4 2
1459%17 = OpConstantComposite %14 %15 %16
1460%19 = OpTypeInt 32 1
1461%18 = OpTypeVector %19 2
1462%20 = OpConstant %19 3
1463%21 = OpConstant %19 4
1464%22 = OpConstantComposite %18 %20 %21
1465)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001466 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001467%10 = OpLoad %7 %5
1468%11 = OpLoad %3 %1
1469%13 = OpSampledImage %12 %11 %10
1470%8 = OpImageSampleImplicitLod %9 %13 %17 ConstOffset %22
1471)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001472 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001473)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001474 case ValidTextureOverload::kSample2dArrayF32:
1475 return {
1476 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001477%4 = OpTypeFloat 32
1478%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
1479%2 = OpTypePointer UniformConstant %3
1480%1 = OpVariable %2 UniformConstant
1481%7 = OpTypeSampler
1482%6 = OpTypePointer UniformConstant %7
1483%5 = OpVariable %6 UniformConstant
1484%9 = OpTypeVector %4 4
1485%12 = OpTypeSampledImage %3
1486%14 = OpTypeVector %4 3
1487%15 = OpConstant %4 1
1488%16 = OpConstant %4 2
1489%18 = OpTypeInt 32 1
1490%19 = OpConstant %18 3
1491)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001492 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001493%10 = OpLoad %7 %5
1494%11 = OpLoad %3 %1
1495%13 = OpSampledImage %12 %11 %10
1496%17 = OpConvertSToF %4 %19
1497%20 = OpCompositeConstruct %14 %15 %16 %17
1498%8 = OpImageSampleImplicitLod %9 %13 %20
1499)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001500 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001501)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001502 case ValidTextureOverload::kSample2dArrayOffsetF32:
1503 return {
1504 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001505%4 = OpTypeFloat 32
1506%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
1507%2 = OpTypePointer UniformConstant %3
1508%1 = OpVariable %2 UniformConstant
1509%7 = OpTypeSampler
1510%6 = OpTypePointer UniformConstant %7
1511%5 = OpVariable %6 UniformConstant
1512%9 = OpTypeVector %4 4
1513%12 = OpTypeSampledImage %3
1514%14 = OpTypeVector %4 3
1515%15 = OpConstant %4 1
1516%16 = OpConstant %4 2
1517%18 = OpTypeInt 32 1
1518%19 = OpConstant %18 3
1519%21 = OpTypeVector %18 2
1520%22 = OpConstant %18 4
1521%23 = OpConstant %18 5
1522%24 = OpConstantComposite %21 %22 %23
1523)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001524 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001525%10 = OpLoad %7 %5
1526%11 = OpLoad %3 %1
1527%13 = OpSampledImage %12 %11 %10
1528%17 = OpConvertSToF %4 %19
1529%20 = OpCompositeConstruct %14 %15 %16 %17
1530%8 = OpImageSampleImplicitLod %9 %13 %20 ConstOffset %24
1531)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001532 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001533)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001534 case ValidTextureOverload::kSample3dF32:
1535 return {
1536 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001537%4 = OpTypeFloat 32
1538%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
1539%2 = OpTypePointer UniformConstant %3
1540%1 = OpVariable %2 UniformConstant
1541%7 = OpTypeSampler
1542%6 = OpTypePointer UniformConstant %7
1543%5 = OpVariable %6 UniformConstant
1544%9 = OpTypeVector %4 4
1545%12 = OpTypeSampledImage %3
1546%14 = OpTypeVector %4 3
1547%15 = OpConstant %4 1
1548%16 = OpConstant %4 2
1549%17 = OpConstant %4 3
1550%18 = OpConstantComposite %14 %15 %16 %17
1551)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001552 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001553%10 = OpLoad %7 %5
1554%11 = OpLoad %3 %1
1555%13 = OpSampledImage %12 %11 %10
1556%8 = OpImageSampleImplicitLod %9 %13 %18
1557)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001558 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001559)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001560 case ValidTextureOverload::kSample3dOffsetF32:
1561 return {
1562 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001563%4 = OpTypeFloat 32
1564%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
1565%2 = OpTypePointer UniformConstant %3
1566%1 = OpVariable %2 UniformConstant
1567%7 = OpTypeSampler
1568%6 = OpTypePointer UniformConstant %7
1569%5 = OpVariable %6 UniformConstant
1570%9 = OpTypeVector %4 4
1571%12 = OpTypeSampledImage %3
1572%14 = OpTypeVector %4 3
1573%15 = OpConstant %4 1
1574%16 = OpConstant %4 2
1575%17 = OpConstant %4 3
1576%18 = OpConstantComposite %14 %15 %16 %17
1577%20 = OpTypeInt 32 1
1578%19 = OpTypeVector %20 3
1579%21 = OpConstant %20 4
1580%22 = OpConstant %20 5
1581%23 = OpConstant %20 6
1582%24 = OpConstantComposite %19 %21 %22 %23
1583)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001584 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001585%10 = OpLoad %7 %5
1586%11 = OpLoad %3 %1
1587%13 = OpSampledImage %12 %11 %10
1588%8 = OpImageSampleImplicitLod %9 %13 %18 ConstOffset %24
1589)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001590 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001591)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001592 case ValidTextureOverload::kSampleCubeF32:
1593 return {
1594 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001595%4 = OpTypeFloat 32
1596%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
1597%2 = OpTypePointer UniformConstant %3
1598%1 = OpVariable %2 UniformConstant
1599%7 = OpTypeSampler
1600%6 = OpTypePointer UniformConstant %7
1601%5 = OpVariable %6 UniformConstant
1602%9 = OpTypeVector %4 4
1603%12 = OpTypeSampledImage %3
1604%14 = OpTypeVector %4 3
1605%15 = OpConstant %4 1
1606%16 = OpConstant %4 2
1607%17 = OpConstant %4 3
1608%18 = OpConstantComposite %14 %15 %16 %17
1609)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001610 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001611%10 = OpLoad %7 %5
1612%11 = OpLoad %3 %1
1613%13 = OpSampledImage %12 %11 %10
1614%8 = OpImageSampleImplicitLod %9 %13 %18
1615)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001616 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001617)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001618 case ValidTextureOverload::kSampleCubeArrayF32:
1619 return {
1620 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001621%4 = OpTypeFloat 32
1622%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
1623%2 = OpTypePointer UniformConstant %3
1624%1 = OpVariable %2 UniformConstant
1625%7 = OpTypeSampler
1626%6 = OpTypePointer UniformConstant %7
1627%5 = OpVariable %6 UniformConstant
1628%9 = OpTypeVector %4 4
1629%12 = OpTypeSampledImage %3
1630%14 = OpConstant %4 1
1631%15 = OpConstant %4 2
1632%16 = OpConstant %4 3
1633%18 = OpTypeInt 32 1
1634%19 = OpConstant %18 4
1635)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001636 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001637%10 = OpLoad %7 %5
1638%11 = OpLoad %3 %1
1639%13 = OpSampledImage %12 %11 %10
1640%17 = OpConvertSToF %4 %19
1641%20 = OpCompositeConstruct %9 %14 %15 %16 %17
1642%8 = OpImageSampleImplicitLod %9 %13 %20
1643)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001644 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001645OpCapability SampledCubeArray
1646)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001647 case ValidTextureOverload::kSampleDepth2dF32:
1648 return {
1649 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001650%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001651%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001652%2 = OpTypePointer UniformConstant %3
1653%1 = OpVariable %2 UniformConstant
1654%7 = OpTypeSampler
1655%6 = OpTypePointer UniformConstant %7
1656%5 = OpVariable %6 UniformConstant
1657%10 = OpTypeVector %4 4
1658%13 = OpTypeSampledImage %3
1659%15 = OpTypeVector %4 2
1660%16 = OpConstant %4 1
1661%17 = OpConstant %4 2
1662%18 = OpConstantComposite %15 %16 %17
1663)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001664 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001665%11 = OpLoad %7 %5
1666%12 = OpLoad %3 %1
1667%14 = OpSampledImage %13 %12 %11
1668%9 = OpImageSampleImplicitLod %10 %14 %18
1669%8 = OpCompositeExtract %4 %9 0
1670)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001671 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001672)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001673 case ValidTextureOverload::kSampleDepth2dOffsetF32:
1674 return {
1675 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001676%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001677%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001678%2 = OpTypePointer UniformConstant %3
1679%1 = OpVariable %2 UniformConstant
1680%7 = OpTypeSampler
1681%6 = OpTypePointer UniformConstant %7
1682%5 = OpVariable %6 UniformConstant
1683%10 = OpTypeVector %4 4
1684%13 = OpTypeSampledImage %3
1685%15 = OpTypeVector %4 2
1686%16 = OpConstant %4 1
1687%17 = OpConstant %4 2
1688%18 = OpConstantComposite %15 %16 %17
1689%20 = OpTypeInt 32 1
1690%19 = OpTypeVector %20 2
1691%21 = OpConstant %20 3
1692%22 = OpConstant %20 4
1693%23 = OpConstantComposite %19 %21 %22
1694)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001695 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001696%11 = OpLoad %7 %5
1697%12 = OpLoad %3 %1
1698%14 = OpSampledImage %13 %12 %11
1699%9 = OpImageSampleImplicitLod %10 %14 %18 ConstOffset %23
1700%8 = OpCompositeExtract %4 %9 0
1701)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001702 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001703)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001704 case ValidTextureOverload::kSampleDepth2dArrayF32:
1705 return {
1706 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001707%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001708%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001709%2 = OpTypePointer UniformConstant %3
1710%1 = OpVariable %2 UniformConstant
1711%7 = OpTypeSampler
1712%6 = OpTypePointer UniformConstant %7
1713%5 = OpVariable %6 UniformConstant
1714%10 = OpTypeVector %4 4
1715%13 = OpTypeSampledImage %3
1716%15 = OpTypeVector %4 3
1717%16 = OpConstant %4 1
1718%17 = OpConstant %4 2
1719%19 = OpTypeInt 32 1
1720%20 = OpConstant %19 3
1721)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001722 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001723%11 = OpLoad %7 %5
1724%12 = OpLoad %3 %1
1725%14 = OpSampledImage %13 %12 %11
1726%18 = OpConvertSToF %4 %20
1727%21 = OpCompositeConstruct %15 %16 %17 %18
1728%9 = OpImageSampleImplicitLod %10 %14 %21
1729%8 = OpCompositeExtract %4 %9 0
1730)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001731 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001732)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001733 case ValidTextureOverload::kSampleDepth2dArrayOffsetF32:
1734 return {
1735 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001736%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001737%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001738%2 = OpTypePointer UniformConstant %3
1739%1 = OpVariable %2 UniformConstant
1740%7 = OpTypeSampler
1741%6 = OpTypePointer UniformConstant %7
1742%5 = OpVariable %6 UniformConstant
1743%10 = OpTypeVector %4 4
1744%13 = OpTypeSampledImage %3
1745%15 = OpTypeVector %4 3
1746%16 = OpConstant %4 1
1747%17 = OpConstant %4 2
1748%19 = OpTypeInt 32 1
1749%20 = OpConstant %19 3
1750%22 = OpTypeVector %19 2
1751%23 = OpConstant %19 4
1752%24 = OpConstant %19 5
1753%25 = OpConstantComposite %22 %23 %24
1754)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001755 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001756%11 = OpLoad %7 %5
1757%12 = OpLoad %3 %1
1758%14 = OpSampledImage %13 %12 %11
1759%18 = OpConvertSToF %4 %20
1760%21 = OpCompositeConstruct %15 %16 %17 %18
1761%9 = OpImageSampleImplicitLod %10 %14 %21 ConstOffset %25
1762%8 = OpCompositeExtract %4 %9 0
1763)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001764 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001765)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001766 case ValidTextureOverload::kSampleDepthCubeF32:
1767 return {
1768 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001769%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001770%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001771%2 = OpTypePointer UniformConstant %3
1772%1 = OpVariable %2 UniformConstant
1773%7 = OpTypeSampler
1774%6 = OpTypePointer UniformConstant %7
1775%5 = OpVariable %6 UniformConstant
1776%10 = OpTypeVector %4 4
1777%13 = OpTypeSampledImage %3
1778%15 = OpTypeVector %4 3
1779%16 = OpConstant %4 1
1780%17 = OpConstant %4 2
1781%18 = OpConstant %4 3
1782%19 = OpConstantComposite %15 %16 %17 %18
1783)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001784 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001785%11 = OpLoad %7 %5
1786%12 = OpLoad %3 %1
1787%14 = OpSampledImage %13 %12 %11
1788%9 = OpImageSampleImplicitLod %10 %14 %19
1789%8 = OpCompositeExtract %4 %9 0
1790)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001791 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001792)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001793 case ValidTextureOverload::kSampleDepthCubeArrayF32:
1794 return {
1795 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001796%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00001797%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001798%2 = OpTypePointer UniformConstant %3
1799%1 = OpVariable %2 UniformConstant
1800%7 = OpTypeSampler
1801%6 = OpTypePointer UniformConstant %7
1802%5 = OpVariable %6 UniformConstant
1803%10 = OpTypeVector %4 4
1804%13 = OpTypeSampledImage %3
1805%15 = OpConstant %4 1
1806%16 = OpConstant %4 2
1807%17 = OpConstant %4 3
1808%19 = OpTypeInt 32 1
1809%20 = OpConstant %19 4
1810)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001811 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001812%11 = OpLoad %7 %5
1813%12 = OpLoad %3 %1
1814%14 = OpSampledImage %13 %12 %11
1815%18 = OpConvertSToF %4 %20
1816%21 = OpCompositeConstruct %10 %15 %16 %17 %18
1817%9 = OpImageSampleImplicitLod %10 %14 %21
1818%8 = OpCompositeExtract %4 %9 0
1819)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001820 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001821OpCapability SampledCubeArray
1822)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001823 case ValidTextureOverload::kSampleBias2dF32:
1824 return {
1825 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001826%4 = OpTypeFloat 32
1827%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
1828%2 = OpTypePointer UniformConstant %3
1829%1 = OpVariable %2 UniformConstant
1830%7 = OpTypeSampler
1831%6 = OpTypePointer UniformConstant %7
1832%5 = OpVariable %6 UniformConstant
1833%9 = OpTypeVector %4 4
1834%12 = OpTypeSampledImage %3
1835%14 = OpTypeVector %4 2
1836%15 = OpConstant %4 1
1837%16 = OpConstant %4 2
1838%17 = OpConstantComposite %14 %15 %16
1839%18 = OpConstant %4 3
1840)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001841 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001842%10 = OpLoad %7 %5
1843%11 = OpLoad %3 %1
1844%13 = OpSampledImage %12 %11 %10
1845%8 = OpImageSampleImplicitLod %9 %13 %17 Bias %18
1846)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001847 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001848)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001849 case ValidTextureOverload::kSampleBias2dOffsetF32:
1850 return {
1851 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001852%4 = OpTypeFloat 32
1853%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
1854%2 = OpTypePointer UniformConstant %3
1855%1 = OpVariable %2 UniformConstant
1856%7 = OpTypeSampler
1857%6 = OpTypePointer UniformConstant %7
1858%5 = OpVariable %6 UniformConstant
1859%9 = OpTypeVector %4 4
1860%12 = OpTypeSampledImage %3
1861%14 = OpTypeVector %4 2
1862%15 = OpConstant %4 1
1863%16 = OpConstant %4 2
1864%17 = OpConstantComposite %14 %15 %16
1865%18 = OpConstant %4 3
1866%20 = OpTypeInt 32 1
1867%19 = OpTypeVector %20 2
1868%21 = OpConstant %20 4
1869%22 = OpConstant %20 5
1870%23 = OpConstantComposite %19 %21 %22
1871)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001872 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001873%10 = OpLoad %7 %5
1874%11 = OpLoad %3 %1
1875%13 = OpSampledImage %12 %11 %10
1876%8 = OpImageSampleImplicitLod %9 %13 %17 Bias|ConstOffset %18 %23
1877)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001878 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001879)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001880 case ValidTextureOverload::kSampleBias2dArrayF32:
1881 return {
1882 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001883%4 = OpTypeFloat 32
1884%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
1885%2 = OpTypePointer UniformConstant %3
1886%1 = OpVariable %2 UniformConstant
1887%7 = OpTypeSampler
1888%6 = OpTypePointer UniformConstant %7
1889%5 = OpVariable %6 UniformConstant
1890%9 = OpTypeVector %4 4
1891%12 = OpTypeSampledImage %3
1892%14 = OpTypeVector %4 3
1893%15 = OpConstant %4 1
1894%16 = OpConstant %4 2
1895%18 = OpTypeInt 32 1
1896%19 = OpConstant %18 4
1897%21 = OpConstant %4 3
1898)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001899 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001900%10 = OpLoad %7 %5
1901%11 = OpLoad %3 %1
1902%13 = OpSampledImage %12 %11 %10
1903%17 = OpConvertSToF %4 %19
1904%20 = OpCompositeConstruct %14 %15 %16 %17
1905%8 = OpImageSampleImplicitLod %9 %13 %20 Bias %21
1906)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001907 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001908)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001909 case ValidTextureOverload::kSampleBias2dArrayOffsetF32:
1910 return {
1911 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001912%4 = OpTypeFloat 32
1913%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
1914%2 = OpTypePointer UniformConstant %3
1915%1 = OpVariable %2 UniformConstant
1916%7 = OpTypeSampler
1917%6 = OpTypePointer UniformConstant %7
1918%5 = OpVariable %6 UniformConstant
1919%9 = OpTypeVector %4 4
1920%12 = OpTypeSampledImage %3
1921%14 = OpTypeVector %4 3
1922%15 = OpConstant %4 1
1923%16 = OpConstant %4 2
1924%18 = OpTypeInt 32 1
1925%19 = OpConstant %18 3
1926%21 = OpConstant %4 4
1927%22 = OpTypeVector %18 2
1928%23 = OpConstant %18 5
1929%24 = OpConstant %18 6
1930%25 = OpConstantComposite %22 %23 %24
1931)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001932 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001933%10 = OpLoad %7 %5
1934%11 = OpLoad %3 %1
1935%13 = OpSampledImage %12 %11 %10
1936%17 = OpConvertSToF %4 %19
1937%20 = OpCompositeConstruct %14 %15 %16 %17
1938%8 = OpImageSampleImplicitLod %9 %13 %20 Bias|ConstOffset %21 %25
1939)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001940 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001941)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001942 case ValidTextureOverload::kSampleBias3dF32:
1943 return {
1944 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001945%4 = OpTypeFloat 32
1946%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
1947%2 = OpTypePointer UniformConstant %3
1948%1 = OpVariable %2 UniformConstant
1949%7 = OpTypeSampler
1950%6 = OpTypePointer UniformConstant %7
1951%5 = OpVariable %6 UniformConstant
1952%9 = OpTypeVector %4 4
1953%12 = OpTypeSampledImage %3
1954%14 = OpTypeVector %4 3
1955%15 = OpConstant %4 1
1956%16 = OpConstant %4 2
1957%17 = OpConstant %4 3
1958%18 = OpConstantComposite %14 %15 %16 %17
1959%19 = OpConstant %4 4
1960)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001961 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001962%10 = OpLoad %7 %5
1963%11 = OpLoad %3 %1
1964%13 = OpSampledImage %12 %11 %10
1965%8 = OpImageSampleImplicitLod %9 %13 %18 Bias %19
1966)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001967 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001968)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00001969 case ValidTextureOverload::kSampleBias3dOffsetF32:
1970 return {
1971 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001972%4 = OpTypeFloat 32
1973%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
1974%2 = OpTypePointer UniformConstant %3
1975%1 = OpVariable %2 UniformConstant
1976%7 = OpTypeSampler
1977%6 = OpTypePointer UniformConstant %7
1978%5 = OpVariable %6 UniformConstant
1979%9 = OpTypeVector %4 4
1980%12 = OpTypeSampledImage %3
1981%14 = OpTypeVector %4 3
1982%15 = OpConstant %4 1
1983%16 = OpConstant %4 2
1984%17 = OpConstant %4 3
1985%18 = OpConstantComposite %14 %15 %16 %17
1986%19 = OpConstant %4 4
1987%21 = OpTypeInt 32 1
1988%20 = OpTypeVector %21 3
1989%22 = OpConstant %21 5
1990%23 = OpConstant %21 6
1991%24 = OpConstant %21 7
1992%25 = OpConstantComposite %20 %22 %23 %24
1993)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00001994 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001995%10 = OpLoad %7 %5
1996%11 = OpLoad %3 %1
1997%13 = OpSampledImage %12 %11 %10
1998%8 = OpImageSampleImplicitLod %9 %13 %18 Bias|ConstOffset %19 %25
1999)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002000 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002001)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002002 case ValidTextureOverload::kSampleBiasCubeF32:
2003 return {
2004 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002005%4 = OpTypeFloat 32
2006%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
2007%2 = OpTypePointer UniformConstant %3
2008%1 = OpVariable %2 UniformConstant
2009%7 = OpTypeSampler
2010%6 = OpTypePointer UniformConstant %7
2011%5 = OpVariable %6 UniformConstant
2012%9 = OpTypeVector %4 4
2013%12 = OpTypeSampledImage %3
2014%14 = OpTypeVector %4 3
2015%15 = OpConstant %4 1
2016%16 = OpConstant %4 2
2017%17 = OpConstant %4 3
2018%18 = OpConstantComposite %14 %15 %16 %17
2019%19 = OpConstant %4 4
2020)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002021 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002022%10 = OpLoad %7 %5
2023%11 = OpLoad %3 %1
2024%13 = OpSampledImage %12 %11 %10
2025%8 = OpImageSampleImplicitLod %9 %13 %18 Bias %19
2026)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002027 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002028)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002029 case ValidTextureOverload::kSampleBiasCubeArrayF32:
2030 return {
2031 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002032%4 = OpTypeFloat 32
2033%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
2034%2 = OpTypePointer UniformConstant %3
2035%1 = OpVariable %2 UniformConstant
2036%7 = OpTypeSampler
2037%6 = OpTypePointer UniformConstant %7
2038%5 = OpVariable %6 UniformConstant
2039%9 = OpTypeVector %4 4
2040%12 = OpTypeSampledImage %3
2041%14 = OpConstant %4 1
2042%15 = OpConstant %4 2
2043%16 = OpConstant %4 3
2044%18 = OpTypeInt 32 1
2045%19 = OpConstant %18 3
2046%21 = OpConstant %4 4
2047)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002048 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002049%10 = OpLoad %7 %5
2050%11 = OpLoad %3 %1
2051%13 = OpSampledImage %12 %11 %10
2052%17 = OpConvertSToF %4 %19
2053%20 = OpCompositeConstruct %9 %14 %15 %16 %17
2054%8 = OpImageSampleImplicitLod %9 %13 %20 Bias %21
2055)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002056 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002057OpCapability SampledCubeArray
2058)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002059 case ValidTextureOverload::kSampleLevel2dF32:
2060 return {
2061 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002062%4 = OpTypeFloat 32
2063%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
2064%2 = OpTypePointer UniformConstant %3
2065%1 = OpVariable %2 UniformConstant
2066%7 = OpTypeSampler
2067%6 = OpTypePointer UniformConstant %7
2068%5 = OpVariable %6 UniformConstant
2069%9 = OpTypeVector %4 4
2070%12 = OpTypeSampledImage %3
2071%14 = OpTypeVector %4 2
2072%15 = OpConstant %4 1
2073%16 = OpConstant %4 2
2074%17 = OpConstantComposite %14 %15 %16
2075%18 = OpConstant %4 3
2076)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002077 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002078%10 = OpLoad %7 %5
2079%11 = OpLoad %3 %1
2080%13 = OpSampledImage %12 %11 %10
2081%8 = OpImageSampleExplicitLod %9 %13 %17 Lod %18
2082)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002083 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002084)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002085 case ValidTextureOverload::kSampleLevel2dOffsetF32:
2086 return {
2087 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002088%4 = OpTypeFloat 32
2089%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
2090%2 = OpTypePointer UniformConstant %3
2091%1 = OpVariable %2 UniformConstant
2092%7 = OpTypeSampler
2093%6 = OpTypePointer UniformConstant %7
2094%5 = OpVariable %6 UniformConstant
2095%9 = OpTypeVector %4 4
2096%12 = OpTypeSampledImage %3
2097%14 = OpTypeVector %4 2
2098%15 = OpConstant %4 1
2099%16 = OpConstant %4 2
2100%17 = OpConstantComposite %14 %15 %16
2101%18 = OpConstant %4 3
2102%20 = OpTypeInt 32 1
2103%19 = OpTypeVector %20 2
2104%21 = OpConstant %20 4
2105%22 = OpConstant %20 5
2106%23 = OpConstantComposite %19 %21 %22
2107)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002108 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002109%10 = OpLoad %7 %5
2110%11 = OpLoad %3 %1
2111%13 = OpSampledImage %12 %11 %10
2112%8 = OpImageSampleExplicitLod %9 %13 %17 Lod|ConstOffset %18 %23
2113)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002114 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002115)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002116 case ValidTextureOverload::kSampleLevel2dArrayF32:
2117 return {
2118 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002119%4 = OpTypeFloat 32
2120%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
2121%2 = OpTypePointer UniformConstant %3
2122%1 = OpVariable %2 UniformConstant
2123%7 = OpTypeSampler
2124%6 = OpTypePointer UniformConstant %7
2125%5 = OpVariable %6 UniformConstant
2126%9 = OpTypeVector %4 4
2127%12 = OpTypeSampledImage %3
2128%14 = OpTypeVector %4 3
2129%15 = OpConstant %4 1
2130%16 = OpConstant %4 2
2131%18 = OpTypeInt 32 1
2132%19 = OpConstant %18 3
2133%21 = OpConstant %4 4
2134)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002135 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002136%10 = OpLoad %7 %5
2137%11 = OpLoad %3 %1
2138%13 = OpSampledImage %12 %11 %10
2139%17 = OpConvertSToF %4 %19
2140%20 = OpCompositeConstruct %14 %15 %16 %17
2141%8 = OpImageSampleExplicitLod %9 %13 %20 Lod %21
2142)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002143 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002144)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002145 case ValidTextureOverload::kSampleLevel2dArrayOffsetF32:
2146 return {
2147 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002148%4 = OpTypeFloat 32
2149%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
2150%2 = OpTypePointer UniformConstant %3
2151%1 = OpVariable %2 UniformConstant
2152%7 = OpTypeSampler
2153%6 = OpTypePointer UniformConstant %7
2154%5 = OpVariable %6 UniformConstant
2155%9 = OpTypeVector %4 4
2156%12 = OpTypeSampledImage %3
2157%14 = OpTypeVector %4 3
2158%15 = OpConstant %4 1
2159%16 = OpConstant %4 2
2160%18 = OpTypeInt 32 1
2161%19 = OpConstant %18 3
2162%21 = OpConstant %4 4
2163%22 = OpTypeVector %18 2
2164%23 = OpConstant %18 5
2165%24 = OpConstant %18 6
2166%25 = OpConstantComposite %22 %23 %24
2167)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002168 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002169%10 = OpLoad %7 %5
2170%11 = OpLoad %3 %1
2171%13 = OpSampledImage %12 %11 %10
2172%17 = OpConvertSToF %4 %19
2173%20 = OpCompositeConstruct %14 %15 %16 %17
2174%8 = OpImageSampleExplicitLod %9 %13 %20 Lod|ConstOffset %21 %25
2175)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002176 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002177)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002178 case ValidTextureOverload::kSampleLevel3dF32:
2179 return {
2180 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002181%4 = OpTypeFloat 32
2182%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
2183%2 = OpTypePointer UniformConstant %3
2184%1 = OpVariable %2 UniformConstant
2185%7 = OpTypeSampler
2186%6 = OpTypePointer UniformConstant %7
2187%5 = OpVariable %6 UniformConstant
2188%9 = OpTypeVector %4 4
2189%12 = OpTypeSampledImage %3
2190%14 = OpTypeVector %4 3
2191%15 = OpConstant %4 1
2192%16 = OpConstant %4 2
2193%17 = OpConstant %4 3
2194%18 = OpConstantComposite %14 %15 %16 %17
2195%19 = OpConstant %4 4
2196)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002197 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002198%10 = OpLoad %7 %5
2199%11 = OpLoad %3 %1
2200%13 = OpSampledImage %12 %11 %10
2201%8 = OpImageSampleExplicitLod %9 %13 %18 Lod %19
2202)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002203 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002204)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002205 case ValidTextureOverload::kSampleLevel3dOffsetF32:
2206 return {
2207 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002208%4 = OpTypeFloat 32
2209%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
2210%2 = OpTypePointer UniformConstant %3
2211%1 = OpVariable %2 UniformConstant
2212%7 = OpTypeSampler
2213%6 = OpTypePointer UniformConstant %7
2214%5 = OpVariable %6 UniformConstant
2215%9 = OpTypeVector %4 4
2216%12 = OpTypeSampledImage %3
2217%14 = OpTypeVector %4 3
2218%15 = OpConstant %4 1
2219%16 = OpConstant %4 2
2220%17 = OpConstant %4 3
2221%18 = OpConstantComposite %14 %15 %16 %17
2222%19 = OpConstant %4 4
2223%21 = OpTypeInt 32 1
2224%20 = OpTypeVector %21 3
2225%22 = OpConstant %21 5
2226%23 = OpConstant %21 6
2227%24 = OpConstant %21 7
2228%25 = OpConstantComposite %20 %22 %23 %24
2229)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002230 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002231%10 = OpLoad %7 %5
2232%11 = OpLoad %3 %1
2233%13 = OpSampledImage %12 %11 %10
2234%8 = OpImageSampleExplicitLod %9 %13 %18 Lod|ConstOffset %19 %25
2235)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002236 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002237)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002238 case ValidTextureOverload::kSampleLevelCubeF32:
2239 return {
2240 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002241%4 = OpTypeFloat 32
2242%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
2243%2 = OpTypePointer UniformConstant %3
2244%1 = OpVariable %2 UniformConstant
2245%7 = OpTypeSampler
2246%6 = OpTypePointer UniformConstant %7
2247%5 = OpVariable %6 UniformConstant
2248%9 = OpTypeVector %4 4
2249%12 = OpTypeSampledImage %3
2250%14 = OpTypeVector %4 3
2251%15 = OpConstant %4 1
2252%16 = OpConstant %4 2
2253%17 = OpConstant %4 3
2254%18 = OpConstantComposite %14 %15 %16 %17
2255%19 = OpConstant %4 4
2256)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002257 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002258%10 = OpLoad %7 %5
2259%11 = OpLoad %3 %1
2260%13 = OpSampledImage %12 %11 %10
2261%8 = OpImageSampleExplicitLod %9 %13 %18 Lod %19
2262)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002263 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002264)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002265 case ValidTextureOverload::kSampleLevelCubeArrayF32:
2266 return {
2267 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002268%4 = OpTypeFloat 32
2269%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
2270%2 = OpTypePointer UniformConstant %3
2271%1 = OpVariable %2 UniformConstant
2272%7 = OpTypeSampler
2273%6 = OpTypePointer UniformConstant %7
2274%5 = OpVariable %6 UniformConstant
2275%9 = OpTypeVector %4 4
2276%12 = OpTypeSampledImage %3
2277%14 = OpConstant %4 1
2278%15 = OpConstant %4 2
2279%16 = OpConstant %4 3
2280%18 = OpTypeInt 32 1
2281%19 = OpConstant %18 4
2282%21 = OpConstant %4 5
2283)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002284 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002285%10 = OpLoad %7 %5
2286%11 = OpLoad %3 %1
2287%13 = OpSampledImage %12 %11 %10
2288%17 = OpConvertSToF %4 %19
2289%20 = OpCompositeConstruct %9 %14 %15 %16 %17
2290%8 = OpImageSampleExplicitLod %9 %13 %20 Lod %21
2291)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002292 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002293OpCapability SampledCubeArray
2294)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002295 case ValidTextureOverload::kSampleLevelDepth2dF32:
2296 return {
2297 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002298%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002299%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002300%2 = OpTypePointer UniformConstant %3
2301%1 = OpVariable %2 UniformConstant
2302%7 = OpTypeSampler
2303%6 = OpTypePointer UniformConstant %7
2304%5 = OpVariable %6 UniformConstant
2305%10 = OpTypeVector %4 4
2306%13 = OpTypeSampledImage %3
2307%15 = OpTypeVector %4 2
2308%16 = OpConstant %4 1
2309%17 = OpConstant %4 2
2310%18 = OpConstantComposite %15 %16 %17
2311%20 = OpTypeInt 32 1
2312%21 = OpConstant %20 3
2313)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002314 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002315%11 = OpLoad %7 %5
2316%12 = OpLoad %3 %1
2317%14 = OpSampledImage %13 %12 %11
2318%19 = OpConvertSToF %4 %21
2319%9 = OpImageSampleExplicitLod %10 %14 %18 Lod %19
2320%8 = OpCompositeExtract %4 %9 0
2321)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002322 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002323)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002324 case ValidTextureOverload::kSampleLevelDepth2dOffsetF32:
2325 return {
2326 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002327%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002328%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002329%2 = OpTypePointer UniformConstant %3
2330%1 = OpVariable %2 UniformConstant
2331%7 = OpTypeSampler
2332%6 = OpTypePointer UniformConstant %7
2333%5 = OpVariable %6 UniformConstant
2334%10 = OpTypeVector %4 4
2335%13 = OpTypeSampledImage %3
2336%15 = OpTypeVector %4 2
2337%16 = OpConstant %4 1
2338%17 = OpConstant %4 2
2339%18 = OpConstantComposite %15 %16 %17
2340%20 = OpTypeInt 32 1
2341%21 = OpConstant %20 3
2342%22 = OpTypeVector %20 2
2343%23 = OpConstant %20 4
2344%24 = OpConstant %20 5
2345%25 = OpConstantComposite %22 %23 %24
2346)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002347 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002348%11 = OpLoad %7 %5
2349%12 = OpLoad %3 %1
2350%14 = OpSampledImage %13 %12 %11
2351%19 = OpConvertSToF %4 %21
2352%9 = OpImageSampleExplicitLod %10 %14 %18 Lod|ConstOffset %19 %25
2353%8 = OpCompositeExtract %4 %9 0
2354)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002355 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002356)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002357 case ValidTextureOverload::kSampleLevelDepth2dArrayF32:
2358 return {
2359 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002360%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002361%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002362%2 = OpTypePointer UniformConstant %3
2363%1 = OpVariable %2 UniformConstant
2364%7 = OpTypeSampler
2365%6 = OpTypePointer UniformConstant %7
2366%5 = OpVariable %6 UniformConstant
2367%10 = OpTypeVector %4 4
2368%13 = OpTypeSampledImage %3
2369%15 = OpTypeVector %4 3
2370%16 = OpConstant %4 1
2371%17 = OpConstant %4 2
2372%19 = OpTypeInt 32 1
2373%20 = OpConstant %19 3
2374%23 = OpConstant %19 4
2375)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002376 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002377%11 = OpLoad %7 %5
2378%12 = OpLoad %3 %1
2379%14 = OpSampledImage %13 %12 %11
2380%18 = OpConvertSToF %4 %20
2381%21 = OpCompositeConstruct %15 %16 %17 %18
2382%22 = OpConvertSToF %4 %23
2383%9 = OpImageSampleExplicitLod %10 %14 %21 Lod %22
2384%8 = OpCompositeExtract %4 %9 0
2385)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002386 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002387)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002388 case ValidTextureOverload::kSampleLevelDepth2dArrayOffsetF32:
2389 return {
2390 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002391%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002392%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002393%2 = OpTypePointer UniformConstant %3
2394%1 = OpVariable %2 UniformConstant
2395%7 = OpTypeSampler
2396%6 = OpTypePointer UniformConstant %7
2397%5 = OpVariable %6 UniformConstant
2398%10 = OpTypeVector %4 4
2399%13 = OpTypeSampledImage %3
2400%15 = OpTypeVector %4 3
2401%16 = OpConstant %4 1
2402%17 = OpConstant %4 2
2403%19 = OpTypeInt 32 1
2404%20 = OpConstant %19 3
2405%23 = OpConstant %19 4
2406%24 = OpTypeVector %19 2
2407%25 = OpConstant %19 5
2408%26 = OpConstant %19 6
2409%27 = OpConstantComposite %24 %25 %26
2410)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002411 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002412%11 = OpLoad %7 %5
2413%12 = OpLoad %3 %1
2414%14 = OpSampledImage %13 %12 %11
2415%18 = OpConvertSToF %4 %20
2416%21 = OpCompositeConstruct %15 %16 %17 %18
2417%22 = OpConvertSToF %4 %23
2418%9 = OpImageSampleExplicitLod %10 %14 %21 Lod|ConstOffset %22 %27
2419%8 = OpCompositeExtract %4 %9 0
2420)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002421 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002422)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002423 case ValidTextureOverload::kSampleLevelDepthCubeF32:
2424 return {
2425 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002426%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002427%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002428%2 = OpTypePointer UniformConstant %3
2429%1 = OpVariable %2 UniformConstant
2430%7 = OpTypeSampler
2431%6 = OpTypePointer UniformConstant %7
2432%5 = OpVariable %6 UniformConstant
2433%10 = OpTypeVector %4 4
2434%13 = OpTypeSampledImage %3
2435%15 = OpTypeVector %4 3
2436%16 = OpConstant %4 1
2437%17 = OpConstant %4 2
2438%18 = OpConstant %4 3
2439%19 = OpConstantComposite %15 %16 %17 %18
2440%21 = OpTypeInt 32 1
2441%22 = OpConstant %21 4
2442)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002443 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002444%11 = OpLoad %7 %5
2445%12 = OpLoad %3 %1
2446%14 = OpSampledImage %13 %12 %11
2447%20 = OpConvertSToF %4 %22
2448%9 = OpImageSampleExplicitLod %10 %14 %19 Lod %20
2449%8 = OpCompositeExtract %4 %9 0
2450)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002451 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002452)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002453 case ValidTextureOverload::kSampleLevelDepthCubeArrayF32:
2454 return {
2455 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002456%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002457%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002458%2 = OpTypePointer UniformConstant %3
2459%1 = OpVariable %2 UniformConstant
2460%7 = OpTypeSampler
2461%6 = OpTypePointer UniformConstant %7
2462%5 = OpVariable %6 UniformConstant
2463%10 = OpTypeVector %4 4
2464%13 = OpTypeSampledImage %3
2465%15 = OpConstant %4 1
2466%16 = OpConstant %4 2
2467%17 = OpConstant %4 3
2468%19 = OpTypeInt 32 1
2469%20 = OpConstant %19 4
2470%23 = OpConstant %19 5
2471)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002472 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002473%11 = OpLoad %7 %5
2474%12 = OpLoad %3 %1
2475%14 = OpSampledImage %13 %12 %11
2476%18 = OpConvertSToF %4 %20
2477%21 = OpCompositeConstruct %10 %15 %16 %17 %18
2478%22 = OpConvertSToF %4 %23
2479%9 = OpImageSampleExplicitLod %10 %14 %21 Lod %22
2480%8 = OpCompositeExtract %4 %9 0
2481)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002482 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002483OpCapability SampledCubeArray
2484)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002485 case ValidTextureOverload::kSampleGrad2dF32:
2486 return {
2487 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002488%4 = OpTypeFloat 32
2489%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
2490%2 = OpTypePointer UniformConstant %3
2491%1 = OpVariable %2 UniformConstant
2492%7 = OpTypeSampler
2493%6 = OpTypePointer UniformConstant %7
2494%5 = OpVariable %6 UniformConstant
2495%9 = OpTypeVector %4 4
2496%12 = OpTypeSampledImage %3
2497%14 = OpTypeVector %4 2
2498%15 = OpConstant %4 1
2499%16 = OpConstant %4 2
2500%17 = OpConstantComposite %14 %15 %16
2501%18 = OpConstant %4 3
2502%19 = OpConstant %4 4
2503%20 = OpConstantComposite %14 %18 %19
2504%21 = OpConstant %4 5
2505%22 = OpConstant %4 6
2506%23 = OpConstantComposite %14 %21 %22
2507)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002508 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002509%10 = OpLoad %7 %5
2510%11 = OpLoad %3 %1
2511%13 = OpSampledImage %12 %11 %10
2512%8 = OpImageSampleExplicitLod %9 %13 %17 Grad %20 %23
2513)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002514 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002515)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002516 case ValidTextureOverload::kSampleGrad2dOffsetF32:
2517 return {
2518 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002519%4 = OpTypeFloat 32
2520%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
2521%2 = OpTypePointer UniformConstant %3
2522%1 = OpVariable %2 UniformConstant
2523%7 = OpTypeSampler
2524%6 = OpTypePointer UniformConstant %7
2525%5 = OpVariable %6 UniformConstant
2526%9 = OpTypeVector %4 4
2527%12 = OpTypeSampledImage %3
2528%14 = OpTypeVector %4 2
2529%15 = OpConstant %4 1
2530%16 = OpConstant %4 2
2531%17 = OpConstantComposite %14 %15 %16
2532%18 = OpConstant %4 3
2533%19 = OpConstant %4 4
2534%20 = OpConstantComposite %14 %18 %19
2535%21 = OpConstant %4 5
2536%22 = OpConstant %4 6
2537%23 = OpConstantComposite %14 %21 %22
2538%25 = OpTypeInt 32 1
2539%24 = OpTypeVector %25 2
2540%26 = OpConstant %25 7
2541%27 = OpConstantComposite %24 %26 %26
2542)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002543 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002544%10 = OpLoad %7 %5
2545%11 = OpLoad %3 %1
2546%13 = OpSampledImage %12 %11 %10
2547%8 = OpImageSampleExplicitLod %9 %13 %17 Grad|ConstOffset %20 %23 %27
2548)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002549 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002550)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002551 case ValidTextureOverload::kSampleGrad2dArrayF32:
2552 return {
2553 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002554%4 = OpTypeFloat 32
2555%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
2556%2 = OpTypePointer UniformConstant %3
2557%1 = OpVariable %2 UniformConstant
2558%7 = OpTypeSampler
2559%6 = OpTypePointer UniformConstant %7
2560%5 = OpVariable %6 UniformConstant
2561%9 = OpTypeVector %4 4
2562%12 = OpTypeSampledImage %3
2563%14 = OpTypeVector %4 3
2564%15 = OpConstant %4 1
2565%16 = OpConstant %4 2
2566%18 = OpTypeInt 32 1
2567%19 = OpConstant %18 3
2568%21 = OpTypeVector %4 2
2569%22 = OpConstant %4 4
2570%23 = OpConstant %4 5
2571%24 = OpConstantComposite %21 %22 %23
2572%25 = OpConstant %4 6
2573%26 = OpConstant %4 7
2574%27 = OpConstantComposite %21 %25 %26
2575)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002576 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002577%10 = OpLoad %7 %5
2578%11 = OpLoad %3 %1
2579%13 = OpSampledImage %12 %11 %10
2580%17 = OpConvertSToF %4 %19
2581%20 = OpCompositeConstruct %14 %15 %16 %17
2582%8 = OpImageSampleExplicitLod %9 %13 %20 Grad %24 %27
2583)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002584 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002585)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002586 case ValidTextureOverload::kSampleGrad2dArrayOffsetF32:
2587 return {
2588 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002589%4 = OpTypeFloat 32
2590%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
2591%2 = OpTypePointer UniformConstant %3
2592%1 = OpVariable %2 UniformConstant
2593%7 = OpTypeSampler
2594%6 = OpTypePointer UniformConstant %7
2595%5 = OpVariable %6 UniformConstant
2596%9 = OpTypeVector %4 4
2597%12 = OpTypeSampledImage %3
2598%14 = OpTypeVector %4 3
2599%15 = OpConstant %4 1
2600%16 = OpConstant %4 2
2601%18 = OpTypeInt 32 1
2602%19 = OpConstant %18 3
2603%21 = OpTypeVector %4 2
2604%22 = OpConstant %4 4
2605%23 = OpConstant %4 5
2606%24 = OpConstantComposite %21 %22 %23
2607%25 = OpConstant %4 6
2608%26 = OpConstant %4 7
2609%27 = OpConstantComposite %21 %25 %26
2610%28 = OpTypeVector %18 2
2611%29 = OpConstant %18 6
2612%30 = OpConstant %18 7
2613%31 = OpConstantComposite %28 %29 %30
2614)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002615 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002616%10 = OpLoad %7 %5
2617%11 = OpLoad %3 %1
2618%13 = OpSampledImage %12 %11 %10
2619%17 = OpConvertSToF %4 %19
2620%20 = OpCompositeConstruct %14 %15 %16 %17
2621%8 = OpImageSampleExplicitLod %9 %13 %20 Grad|ConstOffset %24 %27 %31
2622)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002623 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002624)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002625 case ValidTextureOverload::kSampleGrad3dF32:
2626 return {
2627 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002628%4 = OpTypeFloat 32
2629%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
2630%2 = OpTypePointer UniformConstant %3
2631%1 = OpVariable %2 UniformConstant
2632%7 = OpTypeSampler
2633%6 = OpTypePointer UniformConstant %7
2634%5 = OpVariable %6 UniformConstant
2635%9 = OpTypeVector %4 4
2636%12 = OpTypeSampledImage %3
2637%14 = OpTypeVector %4 3
2638%15 = OpConstant %4 1
2639%16 = OpConstant %4 2
2640%17 = OpConstant %4 3
2641%18 = OpConstantComposite %14 %15 %16 %17
2642%19 = OpConstant %4 4
2643%20 = OpConstant %4 5
2644%21 = OpConstant %4 6
2645%22 = OpConstantComposite %14 %19 %20 %21
2646%23 = OpConstant %4 7
2647%24 = OpConstant %4 8
2648%25 = OpConstant %4 9
2649%26 = OpConstantComposite %14 %23 %24 %25
2650)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002651 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002652%10 = OpLoad %7 %5
2653%11 = OpLoad %3 %1
2654%13 = OpSampledImage %12 %11 %10
2655%8 = OpImageSampleExplicitLod %9 %13 %18 Grad %22 %26
2656)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002657 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002658)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002659 case ValidTextureOverload::kSampleGrad3dOffsetF32:
2660 return {
2661 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002662%4 = OpTypeFloat 32
2663%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
2664%2 = OpTypePointer UniformConstant %3
2665%1 = OpVariable %2 UniformConstant
2666%7 = OpTypeSampler
2667%6 = OpTypePointer UniformConstant %7
2668%5 = OpVariable %6 UniformConstant
2669%9 = OpTypeVector %4 4
2670%12 = OpTypeSampledImage %3
2671%14 = OpTypeVector %4 3
2672%15 = OpConstant %4 1
2673%16 = OpConstant %4 2
2674%17 = OpConstant %4 3
2675%18 = OpConstantComposite %14 %15 %16 %17
2676%19 = OpConstant %4 4
2677%20 = OpConstant %4 5
2678%21 = OpConstant %4 6
2679%22 = OpConstantComposite %14 %19 %20 %21
2680%23 = OpConstant %4 7
2681%24 = OpConstant %4 8
2682%25 = OpConstant %4 9
2683%26 = OpConstantComposite %14 %23 %24 %25
2684%28 = OpTypeInt 32 1
2685%27 = OpTypeVector %28 3
Ben Clayton50414802022-06-24 08:06:19 +00002686%29 = OpConstantNull %28
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002687%30 = OpConstant %28 1
2688%31 = OpConstant %28 2
2689%32 = OpConstantComposite %27 %29 %30 %31
2690)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002691 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002692%10 = OpLoad %7 %5
2693%11 = OpLoad %3 %1
2694%13 = OpSampledImage %12 %11 %10
2695%8 = OpImageSampleExplicitLod %9 %13 %18 Grad|ConstOffset %22 %26 %32
2696)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002697 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002698)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002699 case ValidTextureOverload::kSampleGradCubeF32:
2700 return {
2701 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002702%4 = OpTypeFloat 32
2703%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
2704%2 = OpTypePointer UniformConstant %3
2705%1 = OpVariable %2 UniformConstant
2706%7 = OpTypeSampler
2707%6 = OpTypePointer UniformConstant %7
2708%5 = OpVariable %6 UniformConstant
2709%9 = OpTypeVector %4 4
2710%12 = OpTypeSampledImage %3
2711%14 = OpTypeVector %4 3
2712%15 = OpConstant %4 1
2713%16 = OpConstant %4 2
2714%17 = OpConstant %4 3
2715%18 = OpConstantComposite %14 %15 %16 %17
2716%19 = OpConstant %4 4
2717%20 = OpConstant %4 5
2718%21 = OpConstant %4 6
2719%22 = OpConstantComposite %14 %19 %20 %21
2720%23 = OpConstant %4 7
2721%24 = OpConstant %4 8
2722%25 = OpConstant %4 9
2723%26 = OpConstantComposite %14 %23 %24 %25
2724)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002725 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002726%10 = OpLoad %7 %5
2727%11 = OpLoad %3 %1
2728%13 = OpSampledImage %12 %11 %10
2729%8 = OpImageSampleExplicitLod %9 %13 %18 Grad %22 %26
2730)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002731 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002732)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002733 case ValidTextureOverload::kSampleGradCubeArrayF32:
2734 return {
2735 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002736%4 = OpTypeFloat 32
2737%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
2738%2 = OpTypePointer UniformConstant %3
2739%1 = OpVariable %2 UniformConstant
2740%7 = OpTypeSampler
2741%6 = OpTypePointer UniformConstant %7
2742%5 = OpVariable %6 UniformConstant
2743%9 = OpTypeVector %4 4
2744%12 = OpTypeSampledImage %3
2745%14 = OpConstant %4 1
2746%15 = OpConstant %4 2
2747%16 = OpConstant %4 3
2748%18 = OpTypeInt 32 1
2749%19 = OpConstant %18 4
2750%21 = OpTypeVector %4 3
2751%22 = OpConstant %4 5
2752%23 = OpConstant %4 6
2753%24 = OpConstant %4 7
2754%25 = OpConstantComposite %21 %22 %23 %24
2755%26 = OpConstant %4 8
2756%27 = OpConstant %4 9
2757%28 = OpConstant %4 10
2758%29 = OpConstantComposite %21 %26 %27 %28
2759)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002760 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002761%10 = OpLoad %7 %5
2762%11 = OpLoad %3 %1
2763%13 = OpSampledImage %12 %11 %10
2764%17 = OpConvertSToF %4 %19
2765%20 = OpCompositeConstruct %9 %14 %15 %16 %17
2766%8 = OpImageSampleExplicitLod %9 %13 %20 Grad %25 %29
2767)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002768 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002769OpCapability SampledCubeArray
2770)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002771 case ValidTextureOverload::kSampleCompareDepth2dF32:
2772 return {
2773 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002774%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002775%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002776%2 = OpTypePointer UniformConstant %3
2777%1 = OpVariable %2 UniformConstant
2778%7 = OpTypeSampler
2779%6 = OpTypePointer UniformConstant %7
2780%5 = OpVariable %6 UniformConstant
2781%11 = OpTypeSampledImage %3
2782%13 = OpTypeVector %4 2
2783%14 = OpConstant %4 1
2784%15 = OpConstant %4 2
2785%16 = OpConstantComposite %13 %14 %15
2786%17 = OpConstant %4 3
2787)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002788 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002789%9 = OpLoad %7 %5
2790%10 = OpLoad %3 %1
2791%12 = OpSampledImage %11 %10 %9
2792%8 = OpImageSampleDrefImplicitLod %4 %12 %16 %17
2793)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002794 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002795)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002796 case ValidTextureOverload::kSampleCompareDepth2dOffsetF32:
2797 return {
2798 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002799%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002800%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002801%2 = OpTypePointer UniformConstant %3
2802%1 = OpVariable %2 UniformConstant
2803%7 = OpTypeSampler
2804%6 = OpTypePointer UniformConstant %7
2805%5 = OpVariable %6 UniformConstant
2806%11 = OpTypeSampledImage %3
2807%13 = OpTypeVector %4 2
2808%14 = OpConstant %4 1
2809%15 = OpConstant %4 2
2810%16 = OpConstantComposite %13 %14 %15
2811%17 = OpConstant %4 3
2812%19 = OpTypeInt 32 1
2813%18 = OpTypeVector %19 2
2814%20 = OpConstant %19 4
2815%21 = OpConstant %19 5
2816%22 = OpConstantComposite %18 %20 %21
2817)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002818 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002819%9 = OpLoad %7 %5
2820%10 = OpLoad %3 %1
2821%12 = OpSampledImage %11 %10 %9
2822%8 = OpImageSampleDrefImplicitLod %4 %12 %16 %17 ConstOffset %22
2823)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002824 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002825)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002826 case ValidTextureOverload::kSampleCompareDepth2dArrayF32:
2827 return {
2828 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002829%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002830%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002831%2 = OpTypePointer UniformConstant %3
2832%1 = OpVariable %2 UniformConstant
2833%7 = OpTypeSampler
2834%6 = OpTypePointer UniformConstant %7
2835%5 = OpVariable %6 UniformConstant
2836%11 = OpTypeSampledImage %3
2837%13 = OpTypeVector %4 3
2838%14 = OpConstant %4 1
2839%15 = OpConstant %4 2
2840%17 = OpTypeInt 32 1
2841%18 = OpConstant %17 4
2842%20 = OpConstant %4 3
2843)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002844 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002845%9 = OpLoad %7 %5
2846%10 = OpLoad %3 %1
2847%12 = OpSampledImage %11 %10 %9
2848%16 = OpConvertSToF %4 %18
2849%19 = OpCompositeConstruct %13 %14 %15 %16
2850%8 = OpImageSampleDrefImplicitLod %4 %12 %19 %20
2851)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002852 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002853)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002854 case ValidTextureOverload::kSampleCompareDepth2dArrayOffsetF32:
2855 return {
2856 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002857%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002858%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002859%2 = OpTypePointer UniformConstant %3
2860%1 = OpVariable %2 UniformConstant
2861%7 = OpTypeSampler
2862%6 = OpTypePointer UniformConstant %7
2863%5 = OpVariable %6 UniformConstant
2864%11 = OpTypeSampledImage %3
2865%13 = OpTypeVector %4 3
2866%14 = OpConstant %4 1
2867%15 = OpConstant %4 2
2868%17 = OpTypeInt 32 1
2869%18 = OpConstant %17 4
2870%20 = OpConstant %4 3
2871%21 = OpTypeVector %17 2
2872%22 = OpConstant %17 5
2873%23 = OpConstant %17 6
2874%24 = OpConstantComposite %21 %22 %23
2875)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002876 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002877%9 = OpLoad %7 %5
2878%10 = OpLoad %3 %1
2879%12 = OpSampledImage %11 %10 %9
2880%16 = OpConvertSToF %4 %18
2881%19 = OpCompositeConstruct %13 %14 %15 %16
2882%8 = OpImageSampleDrefImplicitLod %4 %12 %19 %20 ConstOffset %24
2883)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002884 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002885)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002886 case ValidTextureOverload::kSampleCompareDepthCubeF32:
2887 return {
2888 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002889%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002890%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002891%2 = OpTypePointer UniformConstant %3
2892%1 = OpVariable %2 UniformConstant
2893%7 = OpTypeSampler
2894%6 = OpTypePointer UniformConstant %7
2895%5 = OpVariable %6 UniformConstant
2896%11 = OpTypeSampledImage %3
2897%13 = OpTypeVector %4 3
2898%14 = OpConstant %4 1
2899%15 = OpConstant %4 2
2900%16 = OpConstant %4 3
2901%17 = OpConstantComposite %13 %14 %15 %16
2902%18 = OpConstant %4 4
2903)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002904 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002905%9 = OpLoad %7 %5
2906%10 = OpLoad %3 %1
2907%12 = OpSampledImage %11 %10 %9
2908%8 = OpImageSampleDrefImplicitLod %4 %12 %17 %18
2909)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002910 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002911)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002912 case ValidTextureOverload::kSampleCompareDepthCubeArrayF32:
2913 return {
2914 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002915%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002916%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002917%2 = OpTypePointer UniformConstant %3
2918%1 = OpVariable %2 UniformConstant
2919%7 = OpTypeSampler
2920%6 = OpTypePointer UniformConstant %7
2921%5 = OpVariable %6 UniformConstant
2922%11 = OpTypeSampledImage %3
2923%13 = OpTypeVector %4 4
2924%14 = OpConstant %4 1
2925%15 = OpConstant %4 2
2926%16 = OpConstant %4 3
2927%18 = OpTypeInt 32 1
2928%19 = OpConstant %18 4
2929%21 = OpConstant %4 5
2930)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002931 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002932%9 = OpLoad %7 %5
2933%10 = OpLoad %3 %1
2934%12 = OpSampledImage %11 %10 %9
2935%17 = OpConvertSToF %4 %19
2936%20 = OpCompositeConstruct %13 %14 %15 %16 %17
2937%8 = OpImageSampleDrefImplicitLod %4 %12 %20 %21
2938)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002939 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002940OpCapability SampledCubeArray
2941)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002942 case ValidTextureOverload::kSampleCompareLevelDepth2dF32:
2943 return {
2944 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002945%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002946%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002947%2 = OpTypePointer UniformConstant %3
2948%1 = OpVariable %2 UniformConstant
2949%7 = OpTypeSampler
2950%6 = OpTypePointer UniformConstant %7
2951%5 = OpVariable %6 UniformConstant
2952%11 = OpTypeSampledImage %3
2953%13 = OpTypeVector %4 2
2954%14 = OpConstant %4 1
2955%15 = OpConstant %4 2
2956%16 = OpConstantComposite %13 %14 %15
2957%17 = OpConstant %4 3
2958%18 = OpConstant %4 0
2959)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002960 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002961%9 = OpLoad %7 %5
2962%10 = OpLoad %3 %1
2963%12 = OpSampledImage %11 %10 %9
2964%8 = OpImageSampleDrefExplicitLod %4 %12 %16 %17 Lod %18
2965)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002966 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002967)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002968 case ValidTextureOverload::kSampleCompareLevelDepth2dOffsetF32:
2969 return {
2970 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002971%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00002972%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002973%2 = OpTypePointer UniformConstant %3
2974%1 = OpVariable %2 UniformConstant
2975%7 = OpTypeSampler
2976%6 = OpTypePointer UniformConstant %7
2977%5 = OpVariable %6 UniformConstant
2978%11 = OpTypeSampledImage %3
2979%13 = OpTypeVector %4 2
2980%14 = OpConstant %4 1
2981%15 = OpConstant %4 2
2982%16 = OpConstantComposite %13 %14 %15
2983%17 = OpConstant %4 3
2984%18 = OpConstant %4 0
2985%20 = OpTypeInt 32 1
2986%19 = OpTypeVector %20 2
2987%21 = OpConstant %20 4
2988%22 = OpConstant %20 5
2989%23 = OpConstantComposite %19 %21 %22
2990)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002991 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002992%9 = OpLoad %7 %5
2993%10 = OpLoad %3 %1
2994%12 = OpSampledImage %11 %10 %9
2995%8 = OpImageSampleDrefExplicitLod %4 %12 %16 %17 Lod|ConstOffset %18 %23
2996)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00002997 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00002998)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00002999 case ValidTextureOverload::kSampleCompareLevelDepth2dArrayF32:
3000 return {
3001 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003002%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003003%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003004%2 = OpTypePointer UniformConstant %3
3005%1 = OpVariable %2 UniformConstant
3006%7 = OpTypeSampler
3007%6 = OpTypePointer UniformConstant %7
3008%5 = OpVariable %6 UniformConstant
3009%11 = OpTypeSampledImage %3
3010%13 = OpTypeVector %4 3
3011%14 = OpConstant %4 1
3012%15 = OpConstant %4 2
3013%17 = OpTypeInt 32 1
3014%18 = OpConstant %17 4
3015%20 = OpConstant %4 3
3016%21 = OpConstant %4 0
3017)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003018 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003019%9 = OpLoad %7 %5
3020%10 = OpLoad %3 %1
3021%12 = OpSampledImage %11 %10 %9
3022%16 = OpConvertSToF %4 %18
3023%19 = OpCompositeConstruct %13 %14 %15 %16
3024%8 = OpImageSampleDrefExplicitLod %4 %12 %19 %20 Lod %21
3025)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003026 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003027)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003028 case ValidTextureOverload::kSampleCompareLevelDepth2dArrayOffsetF32:
3029 return {
3030 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003031%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003032%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003033%2 = OpTypePointer UniformConstant %3
3034%1 = OpVariable %2 UniformConstant
3035%7 = OpTypeSampler
3036%6 = OpTypePointer UniformConstant %7
3037%5 = OpVariable %6 UniformConstant
3038%11 = OpTypeSampledImage %3
3039%13 = OpTypeVector %4 3
3040%14 = OpConstant %4 1
3041%15 = OpConstant %4 2
3042%17 = OpTypeInt 32 1
3043%18 = OpConstant %17 4
3044%20 = OpConstant %4 3
3045%21 = OpConstant %4 0
3046%22 = OpTypeVector %17 2
3047%23 = OpConstant %17 5
3048%24 = OpConstant %17 6
3049%25 = OpConstantComposite %22 %23 %24
3050)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003051 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003052%9 = OpLoad %7 %5
3053%10 = OpLoad %3 %1
3054%12 = OpSampledImage %11 %10 %9
3055%16 = OpConvertSToF %4 %18
3056%19 = OpCompositeConstruct %13 %14 %15 %16
3057%8 = OpImageSampleDrefExplicitLod %4 %12 %19 %20 Lod|ConstOffset %21 %25
3058)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003059 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003060)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003061 case ValidTextureOverload::kSampleCompareLevelDepthCubeF32:
3062 return {
3063 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003064%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003065%3 = OpTypeImage %4 Cube 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003066%2 = OpTypePointer UniformConstant %3
3067%1 = OpVariable %2 UniformConstant
3068%7 = OpTypeSampler
3069%6 = OpTypePointer UniformConstant %7
3070%5 = OpVariable %6 UniformConstant
3071%11 = OpTypeSampledImage %3
3072%13 = OpTypeVector %4 3
3073%14 = OpConstant %4 1
3074%15 = OpConstant %4 2
3075%16 = OpConstant %4 3
3076%17 = OpConstantComposite %13 %14 %15 %16
3077%18 = OpConstant %4 4
3078%19 = OpConstant %4 0
3079)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003080 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003081%9 = OpLoad %7 %5
3082%10 = OpLoad %3 %1
3083%12 = OpSampledImage %11 %10 %9
3084%8 = OpImageSampleDrefExplicitLod %4 %12 %17 %18 Lod %19
3085)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003086 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003087)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003088 case ValidTextureOverload::kSampleCompareLevelDepthCubeArrayF32:
3089 return {
3090 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003091%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003092%3 = OpTypeImage %4 Cube 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003093%2 = OpTypePointer UniformConstant %3
3094%1 = OpVariable %2 UniformConstant
3095%7 = OpTypeSampler
3096%6 = OpTypePointer UniformConstant %7
3097%5 = OpVariable %6 UniformConstant
3098%11 = OpTypeSampledImage %3
3099%13 = OpTypeVector %4 4
3100%14 = OpConstant %4 1
3101%15 = OpConstant %4 2
3102%16 = OpConstant %4 3
3103%18 = OpTypeInt 32 1
3104%19 = OpConstant %18 4
3105%21 = OpConstant %4 5
3106%22 = OpConstant %4 0
3107)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003108 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003109%9 = OpLoad %7 %5
3110%10 = OpLoad %3 %1
3111%12 = OpSampledImage %11 %10 %9
3112%17 = OpConvertSToF %4 %19
3113%20 = OpCompositeConstruct %13 %14 %15 %16 %17
3114%8 = OpImageSampleDrefExplicitLod %4 %12 %20 %21 Lod %22
3115)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003116 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003117OpCapability SampledCubeArray
3118)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003119 case ValidTextureOverload::kLoad1dLevelF32:
3120 return {
3121 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003122%4 = OpTypeFloat 32
3123%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
3124%2 = OpTypePointer UniformConstant %3
3125%1 = OpVariable %2 UniformConstant
3126%7 = OpTypeSampler
3127%6 = OpTypePointer UniformConstant %7
3128%5 = OpVariable %6 UniformConstant
3129%9 = OpTypeVector %4 4
3130%11 = OpTypeInt 32 1
3131%12 = OpConstant %11 1
3132%13 = OpConstant %11 3
3133)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003134 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003135%10 = OpLoad %3 %1
3136%8 = OpImageFetch %9 %10 %12 Lod %13
3137)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003138 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003139OpCapability Sampled1D
3140)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003141 case ValidTextureOverload::kLoad1dLevelU32:
3142 return {
3143 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003144%4 = OpTypeInt 32 0
3145%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
3146%2 = OpTypePointer UniformConstant %3
3147%1 = OpVariable %2 UniformConstant
3148%7 = OpTypeSampler
3149%6 = OpTypePointer UniformConstant %7
3150%5 = OpVariable %6 UniformConstant
3151%9 = OpTypeVector %4 4
3152%11 = OpTypeInt 32 1
3153%12 = OpConstant %11 1
3154%13 = OpConstant %11 3
3155)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003156 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003157%10 = OpLoad %3 %1
3158%8 = OpImageFetch %9 %10 %12 Lod %13
3159)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003160 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003161OpCapability Sampled1D
3162)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003163 case ValidTextureOverload::kLoad1dLevelI32:
3164 return {
3165 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003166%4 = OpTypeInt 32 1
3167%3 = OpTypeImage %4 1D 0 0 0 1 Unknown
3168%2 = OpTypePointer UniformConstant %3
3169%1 = OpVariable %2 UniformConstant
3170%7 = OpTypeSampler
3171%6 = OpTypePointer UniformConstant %7
3172%5 = OpVariable %6 UniformConstant
3173%9 = OpTypeVector %4 4
3174%11 = OpConstant %4 1
3175%12 = OpConstant %4 3
3176)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003177 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003178%10 = OpLoad %3 %1
3179%8 = OpImageFetch %9 %10 %11 Lod %12
3180)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003181 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003182OpCapability Sampled1D
3183)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003184 case ValidTextureOverload::kLoad2dLevelF32:
3185 return {
3186 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003187%4 = OpTypeFloat 32
3188%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
3189%2 = OpTypePointer UniformConstant %3
3190%1 = OpVariable %2 UniformConstant
3191%7 = OpTypeSampler
3192%6 = OpTypePointer UniformConstant %7
3193%5 = OpVariable %6 UniformConstant
3194%9 = OpTypeVector %4 4
3195%12 = OpTypeInt 32 1
3196%11 = OpTypeVector %12 2
3197%13 = OpConstant %12 1
3198%14 = OpConstant %12 2
3199%15 = OpConstantComposite %11 %13 %14
3200%16 = OpConstant %12 3
3201)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003202 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003203%10 = OpLoad %3 %1
3204%8 = OpImageFetch %9 %10 %15 Lod %16
3205)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003206 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003207)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003208 case ValidTextureOverload::kLoad2dLevelU32:
3209 return {
3210 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003211%4 = OpTypeInt 32 0
3212%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
3213%2 = OpTypePointer UniformConstant %3
3214%1 = OpVariable %2 UniformConstant
3215%7 = OpTypeSampler
3216%6 = OpTypePointer UniformConstant %7
3217%5 = OpVariable %6 UniformConstant
3218%9 = OpTypeVector %4 4
3219%12 = OpTypeInt 32 1
3220%11 = OpTypeVector %12 2
3221%13 = OpConstant %12 1
3222%14 = OpConstant %12 2
3223%15 = OpConstantComposite %11 %13 %14
3224%16 = OpConstant %12 3
3225)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003226 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003227%10 = OpLoad %3 %1
3228%8 = OpImageFetch %9 %10 %15 Lod %16
3229)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003230 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003231)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003232 case ValidTextureOverload::kLoad2dLevelI32:
3233 return {
3234 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003235%4 = OpTypeInt 32 1
3236%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
3237%2 = OpTypePointer UniformConstant %3
3238%1 = OpVariable %2 UniformConstant
3239%7 = OpTypeSampler
3240%6 = OpTypePointer UniformConstant %7
3241%5 = OpVariable %6 UniformConstant
3242%9 = OpTypeVector %4 4
3243%11 = OpTypeVector %4 2
3244%12 = OpConstant %4 1
3245%13 = OpConstant %4 2
3246%14 = OpConstantComposite %11 %12 %13
3247%15 = OpConstant %4 3
3248)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003249 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003250%10 = OpLoad %3 %1
3251%8 = OpImageFetch %9 %10 %14 Lod %15
3252)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003253 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003254)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003255 case ValidTextureOverload::kLoad2dArrayLevelF32:
3256 return {
3257 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003258%4 = OpTypeFloat 32
3259%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
3260%2 = OpTypePointer UniformConstant %3
3261%1 = OpVariable %2 UniformConstant
3262%7 = OpTypeSampler
3263%6 = OpTypePointer UniformConstant %7
3264%5 = OpVariable %6 UniformConstant
3265%9 = OpTypeVector %4 4
3266%12 = OpTypeInt 32 1
3267%11 = OpTypeVector %12 3
3268%13 = OpConstant %12 1
3269%14 = OpConstant %12 2
3270%15 = OpConstant %12 3
3271%16 = OpConstantComposite %11 %13 %14 %15
3272%17 = OpConstant %12 4
3273)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003274 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003275%10 = OpLoad %3 %1
3276%8 = OpImageFetch %9 %10 %16 Lod %17
3277)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003278 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003279)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003280 case ValidTextureOverload::kLoad2dArrayLevelU32:
3281 return {
3282 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003283%4 = OpTypeInt 32 0
3284%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
3285%2 = OpTypePointer UniformConstant %3
3286%1 = OpVariable %2 UniformConstant
3287%7 = OpTypeSampler
3288%6 = OpTypePointer UniformConstant %7
3289%5 = OpVariable %6 UniformConstant
3290%9 = OpTypeVector %4 4
3291%12 = OpTypeInt 32 1
3292%11 = OpTypeVector %12 3
3293%13 = OpConstant %12 1
3294%14 = OpConstant %12 2
3295%15 = OpConstant %12 3
3296%16 = OpConstantComposite %11 %13 %14 %15
3297%17 = OpConstant %12 4
3298)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003299 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003300%10 = OpLoad %3 %1
3301%8 = OpImageFetch %9 %10 %16 Lod %17
3302)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003303 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003304)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003305 case ValidTextureOverload::kLoad2dArrayLevelI32:
3306 return {
3307 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003308%4 = OpTypeInt 32 1
3309%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
3310%2 = OpTypePointer UniformConstant %3
3311%1 = OpVariable %2 UniformConstant
3312%7 = OpTypeSampler
3313%6 = OpTypePointer UniformConstant %7
3314%5 = OpVariable %6 UniformConstant
3315%9 = OpTypeVector %4 4
3316%11 = OpTypeVector %4 3
3317%12 = OpConstant %4 1
3318%13 = OpConstant %4 2
3319%14 = OpConstant %4 3
3320%15 = OpConstantComposite %11 %12 %13 %14
3321%16 = OpConstant %4 4
3322)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003323 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003324%10 = OpLoad %3 %1
3325%8 = OpImageFetch %9 %10 %15 Lod %16
3326)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003327 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003328)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003329 case ValidTextureOverload::kLoad3dLevelF32:
3330 return {
3331 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003332%4 = OpTypeFloat 32
3333%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
3334%2 = OpTypePointer UniformConstant %3
3335%1 = OpVariable %2 UniformConstant
3336%7 = OpTypeSampler
3337%6 = OpTypePointer UniformConstant %7
3338%5 = OpVariable %6 UniformConstant
3339%9 = OpTypeVector %4 4
3340%12 = OpTypeInt 32 1
3341%11 = OpTypeVector %12 3
3342%13 = OpConstant %12 1
3343%14 = OpConstant %12 2
3344%15 = OpConstant %12 3
3345%16 = OpConstantComposite %11 %13 %14 %15
3346%17 = OpConstant %12 4
3347)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003348 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003349%10 = OpLoad %3 %1
3350%8 = OpImageFetch %9 %10 %16 Lod %17
3351)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003352 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003353)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003354 case ValidTextureOverload::kLoad3dLevelU32:
3355 return {
3356 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003357%4 = OpTypeInt 32 0
3358%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
3359%2 = OpTypePointer UniformConstant %3
3360%1 = OpVariable %2 UniformConstant
3361%7 = OpTypeSampler
3362%6 = OpTypePointer UniformConstant %7
3363%5 = OpVariable %6 UniformConstant
3364%9 = OpTypeVector %4 4
3365%12 = OpTypeInt 32 1
3366%11 = OpTypeVector %12 3
3367%13 = OpConstant %12 1
3368%14 = OpConstant %12 2
3369%15 = OpConstant %12 3
3370%16 = OpConstantComposite %11 %13 %14 %15
3371%17 = OpConstant %12 4
3372)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003373 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003374%10 = OpLoad %3 %1
3375%8 = OpImageFetch %9 %10 %16 Lod %17
3376)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003377 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003378)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003379 case ValidTextureOverload::kLoad3dLevelI32:
3380 return {
3381 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003382%4 = OpTypeInt 32 1
3383%3 = OpTypeImage %4 3D 0 0 0 1 Unknown
3384%2 = OpTypePointer UniformConstant %3
3385%1 = OpVariable %2 UniformConstant
3386%7 = OpTypeSampler
3387%6 = OpTypePointer UniformConstant %7
3388%5 = OpVariable %6 UniformConstant
3389%9 = OpTypeVector %4 4
3390%11 = OpTypeVector %4 3
3391%12 = OpConstant %4 1
3392%13 = OpConstant %4 2
3393%14 = OpConstant %4 3
3394%15 = OpConstantComposite %11 %12 %13 %14
3395%16 = OpConstant %4 4
3396)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003397 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003398%10 = OpLoad %3 %1
3399%8 = OpImageFetch %9 %10 %15 Lod %16
3400)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003401 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003402)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003403 case ValidTextureOverload::kLoadMultisampled2dF32:
3404 return {
3405 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003406%4 = OpTypeFloat 32
3407%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
3408%2 = OpTypePointer UniformConstant %3
3409%1 = OpVariable %2 UniformConstant
3410%7 = OpTypeSampler
3411%6 = OpTypePointer UniformConstant %7
3412%5 = OpVariable %6 UniformConstant
3413%9 = OpTypeVector %4 4
3414%12 = OpTypeInt 32 1
3415%11 = OpTypeVector %12 2
3416%13 = OpConstant %12 1
3417%14 = OpConstant %12 2
3418%15 = OpConstantComposite %11 %13 %14
3419%16 = OpConstant %12 3
3420)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003421 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003422%10 = OpLoad %3 %1
3423%8 = OpImageFetch %9 %10 %15 Sample %16
3424)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003425 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003426)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003427 case ValidTextureOverload::kLoadMultisampled2dU32:
3428 return {
3429 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003430%4 = OpTypeInt 32 0
3431%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
3432%2 = OpTypePointer UniformConstant %3
3433%1 = OpVariable %2 UniformConstant
3434%7 = OpTypeSampler
3435%6 = OpTypePointer UniformConstant %7
3436%5 = OpVariable %6 UniformConstant
3437%9 = OpTypeVector %4 4
3438%12 = OpTypeInt 32 1
3439%11 = OpTypeVector %12 2
3440%13 = OpConstant %12 1
3441%14 = OpConstant %12 2
3442%15 = OpConstantComposite %11 %13 %14
3443%16 = OpConstant %12 3
3444)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003445 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003446%10 = OpLoad %3 %1
3447%8 = OpImageFetch %9 %10 %15 Sample %16
3448)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003449 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003450)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003451 case ValidTextureOverload::kLoadMultisampled2dI32:
3452 return {
3453 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003454%4 = OpTypeInt 32 1
3455%3 = OpTypeImage %4 2D 0 0 1 1 Unknown
3456%2 = OpTypePointer UniformConstant %3
3457%1 = OpVariable %2 UniformConstant
3458%7 = OpTypeSampler
3459%6 = OpTypePointer UniformConstant %7
3460%5 = OpVariable %6 UniformConstant
3461%9 = OpTypeVector %4 4
3462%11 = OpTypeVector %4 2
3463%12 = OpConstant %4 1
3464%13 = OpConstant %4 2
3465%14 = OpConstantComposite %11 %12 %13
3466%15 = OpConstant %4 3
3467)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003468 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003469%10 = OpLoad %3 %1
3470%8 = OpImageFetch %9 %10 %14 Sample %15
3471)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003472 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003473)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003474 case ValidTextureOverload::kLoadDepth2dLevelF32:
3475 return {
3476 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003477%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003478%3 = OpTypeImage %4 2D 0 0 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003479%2 = OpTypePointer UniformConstant %3
3480%1 = OpVariable %2 UniformConstant
3481%7 = OpTypeSampler
3482%6 = OpTypePointer UniformConstant %7
3483%5 = OpVariable %6 UniformConstant
3484%10 = OpTypeVector %4 4
3485%13 = OpTypeInt 32 1
3486%12 = OpTypeVector %13 2
3487%14 = OpConstant %13 1
3488%15 = OpConstant %13 2
3489%16 = OpConstantComposite %12 %14 %15
3490%17 = OpConstant %13 3
3491)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003492 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003493%11 = OpLoad %3 %1
3494%9 = OpImageFetch %10 %11 %16 Lod %17
3495%8 = OpCompositeExtract %4 %9 0
3496)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003497 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003498)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003499 case ValidTextureOverload::kLoadDepth2dArrayLevelF32:
3500 return {
3501 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003502%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003503%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003504%2 = OpTypePointer UniformConstant %3
3505%1 = OpVariable %2 UniformConstant
3506%7 = OpTypeSampler
3507%6 = OpTypePointer UniformConstant %7
3508%5 = OpVariable %6 UniformConstant
3509%10 = OpTypeVector %4 4
3510%13 = OpTypeInt 32 1
3511%12 = OpTypeVector %13 3
3512%14 = OpConstant %13 1
3513%15 = OpConstant %13 2
3514%16 = OpConstant %13 3
3515%17 = OpConstantComposite %12 %14 %15 %16
3516%18 = OpConstant %13 4
3517)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003518 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003519%11 = OpLoad %3 %1
3520%9 = OpImageFetch %10 %11 %17 Lod %18
3521%8 = OpCompositeExtract %4 %9 0
3522)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003523 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003524)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003525 case ValidTextureOverload::kLoadDepthMultisampled2dF32:
3526 return {
3527 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003528%4 = OpTypeFloat 32
Jiawei Shao9d27aaa2022-04-08 08:33:28 +00003529%3 = OpTypeImage %4 2D 0 1 0 1 Unknown
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003530%2 = OpTypePointer UniformConstant %3
3531%1 = OpVariable %2 UniformConstant
3532%7 = OpTypeSampler
3533%6 = OpTypePointer UniformConstant %7
3534%5 = OpVariable %6 UniformConstant
3535%10 = OpTypeVector %4 4
3536%13 = OpTypeInt 32 1
3537%12 = OpTypeVector %13 3
3538%14 = OpConstant %13 1
3539%15 = OpConstant %13 2
3540%16 = OpConstant %13 3
3541%17 = OpConstantComposite %12 %14 %15 %16
3542%18 = OpConstant %13 4
3543)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003544 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003545%11 = OpLoad %3 %1
3546%9 = OpImageFetch %10 %11 %17 Sample %18
3547%8 = OpCompositeExtract %4 %9 0
3548)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003549 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003550)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003551 case ValidTextureOverload::kStoreWO1dRgba32float:
3552 return {
3553 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003554%4 = OpTypeFloat 32
3555%3 = OpTypeImage %4 1D 0 0 0 2 Rgba32f
3556%2 = OpTypePointer UniformConstant %3
3557%1 = OpVariable %2 UniformConstant
3558%7 = OpTypeSampler
3559%6 = OpTypePointer UniformConstant %7
3560%5 = OpVariable %6 UniformConstant
3561%9 = OpTypeVoid
3562%11 = OpTypeInt 32 1
3563%12 = OpConstant %11 1
3564%13 = OpTypeVector %4 4
3565%14 = OpConstant %4 2
3566%15 = OpConstant %4 3
3567%16 = OpConstant %4 4
3568%17 = OpConstant %4 5
3569%18 = OpConstantComposite %13 %14 %15 %16 %17
3570)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003571 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003572%10 = OpLoad %3 %1
3573OpImageWrite %10 %12 %18
3574)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003575 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003576OpCapability Image1D
3577)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003578 case ValidTextureOverload::kStoreWO2dRgba32float:
3579 return {
3580 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003581%4 = OpTypeFloat 32
3582%3 = OpTypeImage %4 2D 0 0 0 2 Rgba32f
3583%2 = OpTypePointer UniformConstant %3
3584%1 = OpVariable %2 UniformConstant
3585%7 = OpTypeSampler
3586%6 = OpTypePointer UniformConstant %7
3587%5 = OpVariable %6 UniformConstant
3588%9 = OpTypeVoid
3589%12 = OpTypeInt 32 1
3590%11 = OpTypeVector %12 2
3591%13 = OpConstant %12 1
3592%14 = OpConstant %12 2
3593%15 = OpConstantComposite %11 %13 %14
3594%16 = OpTypeVector %4 4
3595%17 = OpConstant %4 3
3596%18 = OpConstant %4 4
3597%19 = OpConstant %4 5
3598%20 = OpConstant %4 6
3599%21 = OpConstantComposite %16 %17 %18 %19 %20
3600)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003601 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003602%10 = OpLoad %3 %1
3603OpImageWrite %10 %15 %21
3604)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003605 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003606)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003607 case ValidTextureOverload::kStoreWO2dArrayRgba32float:
3608 return {
3609 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003610%4 = OpTypeFloat 32
3611%3 = OpTypeImage %4 2D 0 1 0 2 Rgba32f
3612%2 = OpTypePointer UniformConstant %3
3613%1 = OpVariable %2 UniformConstant
3614%7 = OpTypeSampler
3615%6 = OpTypePointer UniformConstant %7
3616%5 = OpVariable %6 UniformConstant
3617%9 = OpTypeVoid
3618%12 = OpTypeInt 32 1
3619%11 = OpTypeVector %12 3
3620%13 = OpConstant %12 1
3621%14 = OpConstant %12 2
3622%15 = OpConstant %12 3
3623%16 = OpConstantComposite %11 %13 %14 %15
3624%17 = OpTypeVector %4 4
3625%18 = OpConstant %4 4
3626%19 = OpConstant %4 5
3627%20 = OpConstant %4 6
3628%21 = OpConstant %4 7
3629%22 = OpConstantComposite %17 %18 %19 %20 %21
3630)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003631 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003632%10 = OpLoad %3 %1
3633OpImageWrite %10 %16 %22
3634)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003635 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003636)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003637 case ValidTextureOverload::kStoreWO3dRgba32float:
3638 return {
3639 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003640%4 = OpTypeFloat 32
3641%3 = OpTypeImage %4 3D 0 0 0 2 Rgba32f
3642%2 = OpTypePointer UniformConstant %3
3643%1 = OpVariable %2 UniformConstant
3644%7 = OpTypeSampler
3645%6 = OpTypePointer UniformConstant %7
3646%5 = OpVariable %6 UniformConstant
3647%9 = OpTypeVoid
3648%12 = OpTypeInt 32 1
3649%11 = OpTypeVector %12 3
3650%13 = OpConstant %12 1
3651%14 = OpConstant %12 2
3652%15 = OpConstant %12 3
3653%16 = OpConstantComposite %11 %13 %14 %15
3654%17 = OpTypeVector %4 4
3655%18 = OpConstant %4 4
3656%19 = OpConstant %4 5
3657%20 = OpConstant %4 6
3658%21 = OpConstant %4 7
3659%22 = OpConstantComposite %17 %18 %19 %20 %21
3660)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003661 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003662%10 = OpLoad %3 %1
3663OpImageWrite %10 %16 %22
3664)",
dan sinclair41e4d9a2022-05-01 14:40:55 +00003665 R"(
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003666)"};
dan sinclair41e4d9a2022-05-01 14:40:55 +00003667 }
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003668
dan sinclair41e4d9a2022-05-01 14:40:55 +00003669 return {"<unmatched texture overload>", "<unmatched texture overload>",
3670 "<unmatched texture overload>"};
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003671} // NOLINT - Ignore the length of this function
3672
dan sinclair41e4d9a2022-05-01 14:40:55 +00003673using BuiltinTextureTest = TestParamHelper<ast::builtin::test::TextureOverloadCase>;
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003674
dan sinclair41e4d9a2022-05-01 14:40:55 +00003675INSTANTIATE_TEST_SUITE_P(BuiltinTextureTest,
3676 BuiltinTextureTest,
3677 testing::ValuesIn(ast::builtin::test::TextureOverloadCase::ValidCases()));
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003678
3679TEST_P(BuiltinTextureTest, Call) {
dan sinclair41e4d9a2022-05-01 14:40:55 +00003680 auto param = GetParam();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003681
dan sinclair41e4d9a2022-05-01 14:40:55 +00003682 auto* texture = param.BuildTextureVariable(this);
3683 auto* sampler = param.BuildSamplerVariable(this);
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003684
dan sinclair41e4d9a2022-05-01 14:40:55 +00003685 auto* call = Call(param.function, param.args(this));
3686 auto* stmt = CallStmt(call);
Ben Clayton783b1692022-08-02 17:03:35 +00003687 Func("func", utils::Empty, ty.void_(), utils::Vector{stmt},
3688 utils::Vector{
3689 Stage(ast::PipelineStage::kFragment),
3690 });
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003691
dan sinclair41e4d9a2022-05-01 14:40:55 +00003692 spirv::Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003693
dan sinclair41e4d9a2022-05-01 14:40:55 +00003694 b.push_function(Function{});
3695 ASSERT_TRUE(b.GenerateGlobalVariable(texture)) << b.error();
3696 ASSERT_TRUE(b.GenerateGlobalVariable(sampler)) << b.error();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003697
dan sinclair41e4d9a2022-05-01 14:40:55 +00003698 EXPECT_EQ(b.GenerateExpression(call), 8u) << b.error();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003699
dan sinclair41e4d9a2022-05-01 14:40:55 +00003700 auto expected = expected_texture_overload(param.overload);
3701 EXPECT_EQ(expected.types, "\n" + DumpInstructions(b.types()));
3702 EXPECT_EQ(expected.instructions, "\n" + DumpInstructions(b.functions()[0].instructions()));
3703 EXPECT_EQ(expected.capabilities, "\n" + DumpInstructions(b.capabilities()));
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003704}
3705
3706// Check the SPIRV generated passes validation
3707TEST_P(BuiltinTextureTest, ValidateSPIRV) {
dan sinclair41e4d9a2022-05-01 14:40:55 +00003708 auto param = GetParam();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003709
dan sinclair41e4d9a2022-05-01 14:40:55 +00003710 param.BuildTextureVariable(this);
3711 param.BuildSamplerVariable(this);
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003712
dan sinclair41e4d9a2022-05-01 14:40:55 +00003713 auto* call = Call(param.function, param.args(this));
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003714
dan sinclair41e4d9a2022-05-01 14:40:55 +00003715 auto* stmt = CallStmt(call);
Ben Clayton783b1692022-08-02 17:03:35 +00003716 Func("main", utils::Empty, ty.void_(), utils::Vector{stmt},
3717 utils::Vector{
3718 Stage(ast::PipelineStage::kFragment),
3719 });
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003720
dan sinclair41e4d9a2022-05-01 14:40:55 +00003721 spirv::Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003722
dan sinclair41e4d9a2022-05-01 14:40:55 +00003723 ASSERT_TRUE(b.Build()) << b.error();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003724
dan sinclair41e4d9a2022-05-01 14:40:55 +00003725 Validate(b);
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003726}
3727
3728TEST_P(BuiltinTextureTest, OutsideFunction_IsError) {
dan sinclair41e4d9a2022-05-01 14:40:55 +00003729 auto param = GetParam();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003730
dan sinclair41e4d9a2022-05-01 14:40:55 +00003731 // The point of this test is to try to generate the texture
3732 // builtin call outside a function.
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003733
dan sinclair41e4d9a2022-05-01 14:40:55 +00003734 auto* texture = param.BuildTextureVariable(this);
3735 auto* sampler = param.BuildSamplerVariable(this);
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003736
dan sinclair41e4d9a2022-05-01 14:40:55 +00003737 auto* call = Call(param.function, param.args(this));
3738 auto* stmt = CallStmt(call);
Ben Clayton783b1692022-08-02 17:03:35 +00003739 Func("func", utils::Empty, ty.void_(), utils::Vector{stmt},
3740 utils::Vector{
3741 Stage(ast::PipelineStage::kFragment),
3742 });
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003743
dan sinclair41e4d9a2022-05-01 14:40:55 +00003744 spirv::Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003745
dan sinclair41e4d9a2022-05-01 14:40:55 +00003746 ASSERT_TRUE(b.GenerateGlobalVariable(texture)) << b.error();
3747 ASSERT_TRUE(b.GenerateGlobalVariable(sampler)) << b.error();
3748 EXPECT_EQ(b.GenerateExpression(call), 0u);
3749 EXPECT_THAT(b.error(),
3750 ::testing::StartsWith("Internal error: trying to add SPIR-V instruction "));
3751 EXPECT_THAT(b.error(), ::testing::EndsWith(" outside a function"));
Ryan Harrisondbc13af2022-02-21 15:19:07 +00003752}
3753
3754} // namespace
dan sinclair411d0652022-04-07 14:16:34 +00003755} // namespace tint::writer::spirv