1 // 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 "src/ast/intrinsic_texture_helper_test.h"
16
17 #include "src/sem/depth_texture_type.h"
18 #include "src/sem/multisampled_texture_type.h"
19 #include "src/sem/sampled_texture_type.h"
20
21 namespace tint {
22 namespace ast {
23 namespace intrinsic {
24 namespace test {
25
26 using u32 = ProgramBuilder::u32;
27 using i32 = ProgramBuilder::i32;
28 using f32 = ProgramBuilder::f32;
29
TextureOverloadCase(ValidTextureOverload o,const char * desc,TextureKind tk,ast::SamplerKind sk,ast::TextureDimension dims,TextureDataType datatype,const char * f,std::function<ExpressionList (ProgramBuilder *)> a)30 TextureOverloadCase::TextureOverloadCase(
31 ValidTextureOverload o,
32 const char* desc,
33 TextureKind tk,
34 ast::SamplerKind sk,
35 ast::TextureDimension dims,
36 TextureDataType datatype,
37 const char* f,
38 std::function<ExpressionList(ProgramBuilder*)> a)
39 : overload(o),
40 description(desc),
41 texture_kind(tk),
42 sampler_kind(sk),
43 texture_dimension(dims),
44 texture_data_type(datatype),
45 function(f),
46 args(std::move(a)) {}
TextureOverloadCase(ValidTextureOverload o,const char * desc,TextureKind tk,ast::TextureDimension dims,TextureDataType datatype,const char * f,std::function<ExpressionList (ProgramBuilder *)> a)47 TextureOverloadCase::TextureOverloadCase(
48 ValidTextureOverload o,
49 const char* desc,
50 TextureKind tk,
51 ast::TextureDimension dims,
52 TextureDataType datatype,
53 const char* f,
54 std::function<ExpressionList(ProgramBuilder*)> a)
55 : overload(o),
56 description(desc),
57 texture_kind(tk),
58 texture_dimension(dims),
59 texture_data_type(datatype),
60 function(f),
61 args(std::move(a)) {}
TextureOverloadCase(ValidTextureOverload o,const char * d,Access acc,ast::ImageFormat i,ast::TextureDimension dims,TextureDataType datatype,const char * f,std::function<ExpressionList (ProgramBuilder *)> a)62 TextureOverloadCase::TextureOverloadCase(
63 ValidTextureOverload o,
64 const char* d,
65 Access acc,
66 ast::ImageFormat i,
67 ast::TextureDimension dims,
68 TextureDataType datatype,
69 const char* f,
70 std::function<ExpressionList(ProgramBuilder*)> a)
71 : overload(o),
72 description(d),
73 texture_kind(TextureKind::kStorage),
74 access(acc),
75 image_format(i),
76 texture_dimension(dims),
77 texture_data_type(datatype),
78 function(f),
79 args(std::move(a)) {}
80 TextureOverloadCase::TextureOverloadCase(const TextureOverloadCase&) = default;
81 TextureOverloadCase::~TextureOverloadCase() = default;
82
operator <<(std::ostream & out,const TextureKind & kind)83 std::ostream& operator<<(std::ostream& out, const TextureKind& kind) {
84 switch (kind) {
85 case TextureKind::kRegular:
86 out << "regular";
87 break;
88 case TextureKind::kDepth:
89 out << "depth";
90 break;
91 case TextureKind::kDepthMultisampled:
92 out << "depth-multisampled";
93 break;
94 case TextureKind::kMultisampled:
95 out << "multisampled";
96 break;
97 case TextureKind::kStorage:
98 out << "storage";
99 break;
100 }
101 return out;
102 }
103
operator <<(std::ostream & out,const TextureDataType & ty)104 std::ostream& operator<<(std::ostream& out, const TextureDataType& ty) {
105 switch (ty) {
106 case TextureDataType::kF32:
107 out << "f32";
108 break;
109 case TextureDataType::kU32:
110 out << "u32";
111 break;
112 case TextureDataType::kI32:
113 out << "i32";
114 break;
115 }
116 return out;
117 }
118
operator <<(std::ostream & out,const TextureOverloadCase & data)119 std::ostream& operator<<(std::ostream& out, const TextureOverloadCase& data) {
120 out << "TextureOverloadCase " << static_cast<int>(data.overload) << "\n";
121 out << data.description << "\n";
122 out << "texture_kind: " << data.texture_kind << "\n";
123 out << "sampler_kind: ";
124 if (data.texture_kind != TextureKind::kStorage) {
125 out << data.sampler_kind;
126 } else {
127 out << "<unused>";
128 }
129 out << "\n";
130 out << "access: " << data.access << "\n";
131 out << "image_format: " << data.image_format << "\n";
132 out << "texture_dimension: " << data.texture_dimension << "\n";
133 out << "texture_data_type: " << data.texture_data_type << "\n";
134 return out;
135 }
136
BuildResultVectorComponentType(ProgramBuilder * b) const137 const ast::Type* TextureOverloadCase::BuildResultVectorComponentType(
138 ProgramBuilder* b) const {
139 switch (texture_data_type) {
140 case ast::intrinsic::test::TextureDataType::kF32:
141 return b->ty.f32();
142 case ast::intrinsic::test::TextureDataType::kU32:
143 return b->ty.u32();
144 case ast::intrinsic::test::TextureDataType::kI32:
145 return b->ty.i32();
146 }
147
148 TINT_UNREACHABLE(AST, b->Diagnostics());
149 return {};
150 }
151
BuildTextureVariable(ProgramBuilder * b) const152 const ast::Variable* TextureOverloadCase::BuildTextureVariable(
153 ProgramBuilder* b) const {
154 DecorationList decos = {
155 b->create<ast::GroupDecoration>(0),
156 b->create<ast::BindingDecoration>(0),
157 };
158 switch (texture_kind) {
159 case ast::intrinsic::test::TextureKind::kRegular:
160 return b->Global("texture",
161 b->ty.sampled_texture(texture_dimension,
162 BuildResultVectorComponentType(b)),
163 decos);
164
165 case ast::intrinsic::test::TextureKind::kDepth:
166 return b->Global("texture", b->ty.depth_texture(texture_dimension),
167 decos);
168
169 case ast::intrinsic::test::TextureKind::kDepthMultisampled:
170 return b->Global("texture",
171 b->ty.depth_multisampled_texture(texture_dimension),
172 decos);
173
174 case ast::intrinsic::test::TextureKind::kMultisampled:
175 return b->Global(
176 "texture",
177 b->ty.multisampled_texture(texture_dimension,
178 BuildResultVectorComponentType(b)),
179 decos);
180
181 case ast::intrinsic::test::TextureKind::kStorage: {
182 auto* st = b->ty.storage_texture(texture_dimension, image_format, access);
183 return b->Global("texture", st, decos);
184 }
185 }
186
187 TINT_UNREACHABLE(AST, b->Diagnostics());
188 return nullptr;
189 }
190
BuildSamplerVariable(ProgramBuilder * b) const191 const ast::Variable* TextureOverloadCase::BuildSamplerVariable(
192 ProgramBuilder* b) const {
193 DecorationList decos = {
194 b->create<ast::GroupDecoration>(0),
195 b->create<ast::BindingDecoration>(1),
196 };
197 return b->Global("sampler", b->ty.sampler(sampler_kind), decos);
198 }
199
ValidCases()200 std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
201 return {
202 {
203 ValidTextureOverload::kDimensions1d,
204 "textureDimensions(t : texture_1d<f32>) -> i32",
205 TextureKind::kRegular,
206 ast::SamplerKind::kSampler,
207 ast::TextureDimension::k1d,
208 TextureDataType::kF32,
209 "textureDimensions",
210 [](ProgramBuilder* b) { return b->ExprList("texture"); },
211 },
212 {
213 ValidTextureOverload::kDimensions2d,
214 "textureDimensions(t : texture_2d<f32>) -> vec2<i32>",
215 TextureKind::kRegular,
216 ast::SamplerKind::kSampler,
217 ast::TextureDimension::k2d,
218 TextureDataType::kF32,
219 "textureDimensions",
220 [](ProgramBuilder* b) { return b->ExprList("texture"); },
221 },
222 {
223 ValidTextureOverload::kDimensions2dLevel,
224 "textureDimensions(t : texture_2d<f32>,\n"
225 " level : i32) -> vec2<i32>",
226 TextureKind::kRegular,
227 ast::SamplerKind::kSampler,
228 ast::TextureDimension::k2d,
229 TextureDataType::kF32,
230 "textureDimensions",
231 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
232 },
233 {
234 ValidTextureOverload::kDimensions2dArray,
235 "textureDimensions(t : texture_2d_array<f32>) -> vec2<i32>",
236 TextureKind::kRegular,
237 ast::SamplerKind::kSampler,
238 ast::TextureDimension::k2dArray,
239 TextureDataType::kF32,
240 "textureDimensions",
241 [](ProgramBuilder* b) { return b->ExprList("texture"); },
242 },
243 {
244 ValidTextureOverload::kDimensions2dArrayLevel,
245 "textureDimensions(t : texture_2d_array<f32>,\n"
246 " level : i32) -> vec2<i32>",
247 TextureKind::kRegular,
248 ast::SamplerKind::kSampler,
249 ast::TextureDimension::k2dArray,
250 TextureDataType::kF32,
251 "textureDimensions",
252 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
253 },
254 {
255 ValidTextureOverload::kDimensions3d,
256 "textureDimensions(t : texture_3d<f32>) -> vec3<i32>",
257 TextureKind::kRegular,
258 ast::SamplerKind::kSampler,
259 ast::TextureDimension::k3d,
260 TextureDataType::kF32,
261 "textureDimensions",
262 [](ProgramBuilder* b) { return b->ExprList("texture"); },
263 },
264 {
265 ValidTextureOverload::kDimensions3dLevel,
266 "textureDimensions(t : texture_3d<f32>,\n"
267 " level : i32) -> vec3<i32>",
268 TextureKind::kRegular,
269 ast::SamplerKind::kSampler,
270 ast::TextureDimension::k3d,
271 TextureDataType::kF32,
272 "textureDimensions",
273 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
274 },
275 {
276 ValidTextureOverload::kDimensionsCube,
277 "textureDimensions(t : texture_cube<f32>) -> vec2<i32>",
278 TextureKind::kRegular,
279 ast::SamplerKind::kSampler,
280 ast::TextureDimension::kCube,
281 TextureDataType::kF32,
282 "textureDimensions",
283 [](ProgramBuilder* b) { return b->ExprList("texture"); },
284 },
285 {
286 ValidTextureOverload::kDimensionsCubeLevel,
287 "textureDimensions(t : texture_cube<f32>,\n"
288 " level : i32) -> vec2<i32>",
289 TextureKind::kRegular,
290 ast::SamplerKind::kSampler,
291 ast::TextureDimension::kCube,
292 TextureDataType::kF32,
293 "textureDimensions",
294 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
295 },
296 {
297 ValidTextureOverload::kDimensionsCubeArray,
298 "textureDimensions(t : texture_cube_array<f32>) -> vec2<i32>",
299 TextureKind::kRegular,
300 ast::SamplerKind::kSampler,
301 ast::TextureDimension::kCubeArray,
302 TextureDataType::kF32,
303 "textureDimensions",
304 [](ProgramBuilder* b) { return b->ExprList("texture"); },
305 },
306 {
307 ValidTextureOverload::kDimensionsCubeArrayLevel,
308 "textureDimensions(t : texture_cube_array<f32>,\n"
309 " level : i32) -> vec2<i32>",
310 TextureKind::kRegular,
311 ast::SamplerKind::kSampler,
312 ast::TextureDimension::kCubeArray,
313 TextureDataType::kF32,
314 "textureDimensions",
315 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
316 },
317 {
318 ValidTextureOverload::kDimensionsMultisampled2d,
319 "textureDimensions(t : texture_multisampled_2d<f32>)-> vec2<i32>",
320 TextureKind::kMultisampled,
321 ast::SamplerKind::kSampler,
322 ast::TextureDimension::k2d,
323 TextureDataType::kF32,
324 "textureDimensions",
325 [](ProgramBuilder* b) { return b->ExprList("texture"); },
326 },
327 {
328 ValidTextureOverload::kDimensionsDepth2d,
329 "textureDimensions(t : texture_depth_2d) -> vec2<i32>",
330 TextureKind::kDepth,
331 ast::SamplerKind::kSampler,
332 ast::TextureDimension::k2d,
333 TextureDataType::kF32,
334 "textureDimensions",
335 [](ProgramBuilder* b) { return b->ExprList("texture"); },
336 },
337 {
338 ValidTextureOverload::kDimensionsDepth2dLevel,
339 "textureDimensions(t : texture_depth_2d,\n"
340 " level : i32) -> vec2<i32>",
341 TextureKind::kDepth,
342 ast::SamplerKind::kSampler,
343 ast::TextureDimension::k2d,
344 TextureDataType::kF32,
345 "textureDimensions",
346 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
347 },
348 {
349 ValidTextureOverload::kDimensionsDepth2dArray,
350 "textureDimensions(t : texture_depth_2d_array) -> vec2<i32>",
351 TextureKind::kDepth,
352 ast::SamplerKind::kSampler,
353 ast::TextureDimension::k2dArray,
354 TextureDataType::kF32,
355 "textureDimensions",
356 [](ProgramBuilder* b) { return b->ExprList("texture"); },
357 },
358 {
359 ValidTextureOverload::kDimensionsDepth2dArrayLevel,
360 "textureDimensions(t : texture_depth_2d_array,\n"
361 " level : i32) -> vec2<i32>",
362 TextureKind::kDepth,
363 ast::SamplerKind::kSampler,
364 ast::TextureDimension::k2dArray,
365 TextureDataType::kF32,
366 "textureDimensions",
367 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
368 },
369 {
370 ValidTextureOverload::kDimensionsDepthCube,
371 "textureDimensions(t : texture_depth_cube) -> vec2<i32>",
372 TextureKind::kDepth,
373 ast::SamplerKind::kSampler,
374 ast::TextureDimension::kCube,
375 TextureDataType::kF32,
376 "textureDimensions",
377 [](ProgramBuilder* b) { return b->ExprList("texture"); },
378 },
379 {
380 ValidTextureOverload::kDimensionsDepthCubeLevel,
381 "textureDimensions(t : texture_depth_cube,\n"
382 " level : i32) -> vec2<i32>",
383 TextureKind::kDepth,
384 ast::SamplerKind::kSampler,
385 ast::TextureDimension::kCube,
386 TextureDataType::kF32,
387 "textureDimensions",
388 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
389 },
390 {
391 ValidTextureOverload::kDimensionsDepthCubeArray,
392 "textureDimensions(t : texture_depth_cube_array) -> vec2<i32>",
393 TextureKind::kDepth,
394 ast::SamplerKind::kSampler,
395 ast::TextureDimension::kCubeArray,
396 TextureDataType::kF32,
397 "textureDimensions",
398 [](ProgramBuilder* b) { return b->ExprList("texture"); },
399 },
400 {
401 ValidTextureOverload::kDimensionsDepthCubeArrayLevel,
402 "textureDimensions(t : texture_depth_cube_array,\n"
403 " level : i32) -> vec2<i32>",
404 TextureKind::kDepth,
405 ast::SamplerKind::kSampler,
406 ast::TextureDimension::kCubeArray,
407 TextureDataType::kF32,
408 "textureDimensions",
409 [](ProgramBuilder* b) { return b->ExprList("texture", 1); },
410 },
411 {
412 ValidTextureOverload::kDimensionsDepthMultisampled2d,
413 "textureDimensions(t : texture_depth_multisampled_2d) -> vec2<i32>",
414 TextureKind::kDepthMultisampled,
415 ast::SamplerKind::kSampler,
416 ast::TextureDimension::k2d,
417 TextureDataType::kF32,
418 "textureDimensions",
419 [](ProgramBuilder* b) { return b->ExprList("texture"); },
420 },
421 {
422 ValidTextureOverload::kDimensionsStorageWO1d,
423 "textureDimensions(t : texture_storage_1d<rgba32float>) -> i32",
424 ast::Access::kWrite,
425 ast::ImageFormat::kRgba32Float,
426 ast::TextureDimension::k1d,
427 TextureDataType::kF32,
428 "textureDimensions",
429 [](ProgramBuilder* b) { return b->ExprList("texture"); },
430 },
431 {
432 ValidTextureOverload::kDimensionsStorageWO2d,
433 "textureDimensions(t : texture_storage_2d<rgba32float>) -> "
434 "vec2<i32>",
435 ast::Access::kWrite,
436 ast::ImageFormat::kRgba32Float,
437 ast::TextureDimension::k2d,
438 TextureDataType::kF32,
439 "textureDimensions",
440 [](ProgramBuilder* b) { return b->ExprList("texture"); },
441 },
442 {
443 ValidTextureOverload::kDimensionsStorageWO2dArray,
444 "textureDimensions(t : texture_storage_2d_array<rgba32float>) -> "
445 "vec2<i32>",
446 ast::Access::kWrite,
447 ast::ImageFormat::kRgba32Float,
448 ast::TextureDimension::k2dArray,
449 TextureDataType::kF32,
450 "textureDimensions",
451 [](ProgramBuilder* b) { return b->ExprList("texture"); },
452 },
453 {
454 ValidTextureOverload::kDimensionsStorageWO3d,
455 "textureDimensions(t : texture_storage_3d<rgba32float>) -> "
456 "vec3<i32>",
457 ast::Access::kWrite,
458 ast::ImageFormat::kRgba32Float,
459 ast::TextureDimension::k3d,
460 TextureDataType::kF32,
461 "textureDimensions",
462 [](ProgramBuilder* b) { return b->ExprList("texture"); },
463 },
464
465 {
466 ValidTextureOverload::kGather2dF32,
467 "textureGather(component : i32,\n"
468 " t : texture_2d<T>,\n"
469 " s : sampler,\n"
470 " coords : vec2<f32>) -> vec4<T>",
471 TextureKind::kRegular,
472 ast::SamplerKind::kSampler,
473 ast::TextureDimension::k2d,
474 TextureDataType::kF32,
475 "textureGather",
476 [](ProgramBuilder* b) {
477 return b->ExprList(0, // component
478 "texture", // t
479 "sampler", // s
480 b->vec2<f32>(1.f, 2.f)); // coords
481 },
482 },
483 {
484 ValidTextureOverload::kGather2dOffsetF32,
485 "textureGather(component : i32,\n"
486 " t : texture_2d<T>,\n"
487 " s : sampler,\n"
488 " coords : vec2<f32>,\n"
489 " offset : vec2<i32>) -> vec4<T>",
490 TextureKind::kRegular,
491 ast::SamplerKind::kSampler,
492 ast::TextureDimension::k2d,
493 TextureDataType::kF32,
494 "textureGather",
495 [](ProgramBuilder* b) {
496 return b->ExprList(0, // component
497 "texture", // t
498 "sampler", // s
499 b->vec2<f32>(1.f, 2.f), // coords
500 b->vec2<i32>(3, 4)); // offset
501 },
502 },
503 {
504 ValidTextureOverload::kGather2dArrayF32,
505 "textureGather(component : i32,\n"
506 " t : texture_2d_array<T>,\n"
507 " s : sampler,\n"
508 " coords : vec2<f32>,\n"
509 " array_index : i32) -> vec4<T>",
510 TextureKind::kRegular,
511 ast::SamplerKind::kSampler,
512 ast::TextureDimension::k2dArray,
513 TextureDataType::kF32,
514 "textureGather",
515 [](ProgramBuilder* b) {
516 return b->ExprList(0, // component
517 "texture", // t
518 "sampler", // s
519 b->vec2<f32>(1.f, 2.f), // coords
520 3); // array index
521 },
522 },
523 {
524 ValidTextureOverload::kGather2dArrayOffsetF32,
525 "textureGather(component : i32,\n"
526 " t : texture_2d_array<T>,\n"
527 " s : sampler,\n"
528 " coords : vec2<f32>,\n"
529 " array_index : i32,\n"
530 " offset : vec2<i32>) -> vec4<T>",
531 TextureKind::kRegular,
532 ast::SamplerKind::kSampler,
533 ast::TextureDimension::k2dArray,
534 TextureDataType::kF32,
535 "textureGather",
536 [](ProgramBuilder* b) {
537 return b->ExprList(0, // component
538 "texture", // t
539 "sampler", // s
540 b->vec2<f32>(1.f, 2.f), // coords
541 3, // array_index
542 b->vec2<i32>(4, 5)); // offset
543 },
544 },
545 {
546 ValidTextureOverload::kGatherCubeF32,
547 "textureGather(component : i32,\n"
548 " t : texture_cube<T>,\n"
549 " s : sampler,\n"
550 " coords : vec3<f32>) -> vec4<T>",
551 TextureKind::kRegular,
552 ast::SamplerKind::kSampler,
553 ast::TextureDimension::kCube,
554 TextureDataType::kF32,
555 "textureGather",
556 [](ProgramBuilder* b) {
557 return b->ExprList(0, // component
558 "texture", // t
559 "sampler", // s
560 b->vec3<f32>(1.f, 2.f, 3.f)); // coords
561 },
562 },
563 {
564 ValidTextureOverload::kGatherCubeArrayF32,
565 "textureGather(component : i32,\n"
566 " t : texture_cube_array<T>,\n"
567 " s : sampler,\n"
568 " coords : vec3<f32>,\n"
569 " array_index : i32) -> vec4<T>",
570 TextureKind::kRegular,
571 ast::SamplerKind::kSampler,
572 ast::TextureDimension::kCubeArray,
573 TextureDataType::kF32,
574 "textureGather",
575 [](ProgramBuilder* b) {
576 return b->ExprList(0, // component
577 "texture", // t
578 "sampler", // s
579 b->vec3<f32>(1.f, 2.f, 3.f), // coords
580 4); // array_index
581 },
582 },
583 {
584 ValidTextureOverload::kGatherDepth2dF32,
585 "textureGather(t : texture_depth_2d,\n"
586 " s : sampler,\n"
587 " coords : vec2<f32>) -> vec4<f32>",
588 TextureKind::kDepth,
589 ast::SamplerKind::kSampler,
590 ast::TextureDimension::k2d,
591 TextureDataType::kF32,
592 "textureGather",
593 [](ProgramBuilder* b) {
594 return b->ExprList("texture", // t
595 "sampler", // s
596 b->vec2<f32>(1.f, 2.f)); // coords
597 },
598 },
599 {
600 ValidTextureOverload::kGatherDepth2dOffsetF32,
601 "textureGather(t : texture_depth_2d,\n"
602 " s : sampler,\n"
603 " coords : vec2<f32>,\n"
604 " offset : vec2<i32>) -> vec4<f32>",
605 TextureKind::kDepth,
606 ast::SamplerKind::kSampler,
607 ast::TextureDimension::k2d,
608 TextureDataType::kF32,
609 "textureGather",
610 [](ProgramBuilder* b) {
611 return b->ExprList("texture", // t
612 "sampler", // s
613 b->vec2<f32>(1.f, 2.f), // coords
614 b->vec2<i32>(3, 4)); // offset
615 },
616 },
617 {
618 ValidTextureOverload::kGatherDepth2dArrayF32,
619 "textureGather(t : texture_depth_2d_array,\n"
620 " s : sampler,\n"
621 " coords : vec2<f32>,\n"
622 " array_index : i32) -> vec4<f32>",
623 TextureKind::kDepth,
624 ast::SamplerKind::kSampler,
625 ast::TextureDimension::k2dArray,
626 TextureDataType::kF32,
627 "textureGather",
628 [](ProgramBuilder* b) {
629 return b->ExprList("texture", // t
630 "sampler", // s
631 b->vec2<f32>(1.f, 2.f), // coords
632 3); // array_index
633 },
634 },
635 {
636 ValidTextureOverload::kGatherDepth2dArrayOffsetF32,
637 "textureGather(t : texture_depth_2d_array,\n"
638 " s : sampler,\n"
639 " coords : vec2<f32>,\n"
640 " array_index : i32,\n"
641 " offset : vec2<i32>) -> vec4<f32>",
642 TextureKind::kDepth,
643 ast::SamplerKind::kSampler,
644 ast::TextureDimension::k2dArray,
645 TextureDataType::kF32,
646 "textureGather",
647 [](ProgramBuilder* b) {
648 return b->ExprList("texture", // t
649 "sampler", // s
650 b->vec2<f32>(1.f, 2.f), // coords
651 3, // array_index
652 b->vec2<i32>(4, 5)); // offset
653 },
654 },
655 {
656 ValidTextureOverload::kGatherDepthCubeF32,
657 "textureGather(t : texture_depth_cube,\n"
658 " s : sampler,\n"
659 " coords : vec3<f32>) -> vec4<f32>",
660 TextureKind::kDepth,
661 ast::SamplerKind::kSampler,
662 ast::TextureDimension::kCube,
663 TextureDataType::kF32,
664 "textureGather",
665 [](ProgramBuilder* b) {
666 return b->ExprList("texture", // t
667 "sampler", // s
668 b->vec3<f32>(1.f, 2.f, 3.f)); // coords
669 },
670 },
671 {
672 ValidTextureOverload::kGatherDepthCubeArrayF32,
673 "textureGather(t : texture_depth_cube_array,\n"
674 " s : sampler,\n"
675 " coords : vec3<f32>,\n"
676 " array_index : i32) -> vec4<f32>",
677 TextureKind::kDepth,
678 ast::SamplerKind::kSampler,
679 ast::TextureDimension::kCubeArray,
680 TextureDataType::kF32,
681 "textureGather",
682 [](ProgramBuilder* b) {
683 return b->ExprList("texture", // t
684 "sampler", // s
685 b->vec3<f32>(1.f, 2.f, 3.f), // coords
686 4); // array_index
687 },
688 },
689 {
690 ValidTextureOverload::kGatherCompareDepth2dF32,
691 "textureGatherCompare(t : texture_depth_2d,\n"
692 " s : sampler_comparison,\n"
693 " coords : vec2<f32>,\n"
694 " depth_ref : f32) -> vec4<f32>",
695 TextureKind::kDepth,
696 ast::SamplerKind::kComparisonSampler,
697 ast::TextureDimension::k2d,
698 TextureDataType::kF32,
699 "textureGatherCompare",
700 [](ProgramBuilder* b) {
701 return b->ExprList("texture", // t
702 "sampler", // s
703 b->vec2<f32>(1.f, 2.f), // coords
704 3.f); // depth_ref
705 },
706 },
707 {
708 ValidTextureOverload::kGatherCompareDepth2dOffsetF32,
709 "textureGatherCompare(t : texture_depth_2d,\n"
710 " s : sampler_comparison,\n"
711 " coords : vec2<f32>,\n"
712 " depth_ref : f32,\n"
713 " offset : vec2<i32>) -> vec4<f32>",
714 TextureKind::kDepth,
715 ast::SamplerKind::kComparisonSampler,
716 ast::TextureDimension::k2d,
717 TextureDataType::kF32,
718 "textureGatherCompare",
719 [](ProgramBuilder* b) {
720 return b->ExprList("texture", // t
721 "sampler", // s
722 b->vec2<f32>(1.f, 2.f), // coords
723 3.f, // depth_ref
724 b->vec2<i32>(4, 5)); // offset
725 },
726 },
727 {
728 ValidTextureOverload::kGatherCompareDepth2dArrayF32,
729 "textureGatherCompare(t : texture_depth_2d_array,\n"
730 " s : sampler_comparison,\n"
731 " coords : vec2<f32>,\n"
732 " array_index : i32,\n"
733 " depth_ref : f32) -> vec4<f32>",
734 TextureKind::kDepth,
735 ast::SamplerKind::kComparisonSampler,
736 ast::TextureDimension::k2dArray,
737 TextureDataType::kF32,
738 "textureGatherCompare",
739 [](ProgramBuilder* b) {
740 return b->ExprList("texture", // t
741 "sampler", // s
742 b->vec2<f32>(1.f, 2.f), // coords
743 3, // array_index
744 4.f); // depth_ref
745 },
746 },
747 {
748 ValidTextureOverload::kGatherCompareDepth2dArrayOffsetF32,
749 "textureGatherCompare(t : texture_depth_2d_array,\n"
750 " s : sampler_comparison,\n"
751 " coords : vec2<f32>,\n"
752 " array_index : i32,\n"
753 " depth_ref : f32,\n"
754 " offset : vec2<i32>) -> vec4<f32>",
755 TextureKind::kDepth,
756 ast::SamplerKind::kComparisonSampler,
757 ast::TextureDimension::k2dArray,
758 TextureDataType::kF32,
759 "textureGatherCompare",
760 [](ProgramBuilder* b) {
761 return b->ExprList("texture", // t
762 "sampler", // s
763 b->vec2<f32>(1.f, 2.f), // coords
764 3, // array_index
765 4.f, // depth_ref
766 b->vec2<i32>(5, 6)); // offset
767 },
768 },
769 {
770 ValidTextureOverload::kGatherCompareDepthCubeF32,
771 "textureGatherCompare(t : texture_depth_cube,\n"
772 " s : sampler_comparison,\n"
773 " coords : vec3<f32>,\n"
774 " depth_ref : f32) -> vec4<f32>",
775 TextureKind::kDepth,
776 ast::SamplerKind::kComparisonSampler,
777 ast::TextureDimension::kCube,
778 TextureDataType::kF32,
779 "textureGatherCompare",
780 [](ProgramBuilder* b) {
781 return b->ExprList("texture", // t
782 "sampler", // s
783 b->vec3<f32>(1.f, 2.f, 3.f), // coords
784 4.f); // depth_ref
785 },
786 },
787 {
788 ValidTextureOverload::kGatherCompareDepthCubeArrayF32,
789 "textureGatherCompare(t : texture_depth_cube_array,\n"
790 " s : sampler_comparison,\n"
791 " coords : vec3<f32>,\n"
792 " array_index : i32,\n"
793 " depth_ref : f32) -> vec4<f32>",
794 TextureKind::kDepth,
795 ast::SamplerKind::kComparisonSampler,
796 ast::TextureDimension::kCubeArray,
797 TextureDataType::kF32,
798 "textureGatherCompare",
799 [](ProgramBuilder* b) {
800 return b->ExprList("texture", // t
801 "sampler", // s
802 b->vec3<f32>(1.f, 2.f, 3.f), // coords
803 4, // array_index
804 5.f); // depth_ref
805 },
806 },
807 {
808 ValidTextureOverload::kNumLayers2dArray,
809 "textureNumLayers(t : texture_2d_array<f32>) -> i32",
810 TextureKind::kRegular,
811 ast::SamplerKind::kSampler,
812 ast::TextureDimension::k2dArray,
813 TextureDataType::kF32,
814 "textureNumLayers",
815 [](ProgramBuilder* b) { return b->ExprList("texture"); },
816 },
817 {
818 ValidTextureOverload::kNumLayersCubeArray,
819 "textureNumLayers(t : texture_cube_array<f32>) -> i32",
820 TextureKind::kRegular,
821 ast::SamplerKind::kSampler,
822 ast::TextureDimension::kCubeArray,
823 TextureDataType::kF32,
824 "textureNumLayers",
825 [](ProgramBuilder* b) { return b->ExprList("texture"); },
826 },
827 {
828 ValidTextureOverload::kNumLayersDepth2dArray,
829 "textureNumLayers(t : texture_depth_2d_array) -> i32",
830 TextureKind::kDepth,
831 ast::SamplerKind::kSampler,
832 ast::TextureDimension::k2dArray,
833 TextureDataType::kF32,
834 "textureNumLayers",
835 [](ProgramBuilder* b) { return b->ExprList("texture"); },
836 },
837 {
838 ValidTextureOverload::kNumLayersDepthCubeArray,
839 "textureNumLayers(t : texture_depth_cube_array) -> i32",
840 TextureKind::kDepth,
841 ast::SamplerKind::kSampler,
842 ast::TextureDimension::kCubeArray,
843 TextureDataType::kF32,
844 "textureNumLayers",
845 [](ProgramBuilder* b) { return b->ExprList("texture"); },
846 },
847 {
848 ValidTextureOverload::kNumLayersStorageWO2dArray,
849 "textureNumLayers(t : texture_storage_2d_array<rgba32float>) -> i32",
850 ast::Access::kWrite,
851 ast::ImageFormat::kRgba32Float,
852 ast::TextureDimension::k2dArray,
853 TextureDataType::kF32,
854 "textureNumLayers",
855 [](ProgramBuilder* b) { return b->ExprList("texture"); },
856 },
857 {
858 ValidTextureOverload::kNumLevels2d,
859 "textureNumLevels(t : texture_2d<f32>) -> i32",
860 TextureKind::kRegular,
861 ast::SamplerKind::kSampler,
862 ast::TextureDimension::k2d,
863 TextureDataType::kF32,
864 "textureNumLevels",
865 [](ProgramBuilder* b) { return b->ExprList("texture"); },
866 },
867 {
868 ValidTextureOverload::kNumLevels2dArray,
869 "textureNumLevels(t : texture_2d_array<f32>) -> i32",
870 TextureKind::kRegular,
871 ast::SamplerKind::kSampler,
872 ast::TextureDimension::k2dArray,
873 TextureDataType::kF32,
874 "textureNumLevels",
875 [](ProgramBuilder* b) { return b->ExprList("texture"); },
876 },
877 {
878 ValidTextureOverload::kNumLevels3d,
879 "textureNumLevels(t : texture_3d<f32>) -> i32",
880 TextureKind::kRegular,
881 ast::SamplerKind::kSampler,
882 ast::TextureDimension::k3d,
883 TextureDataType::kF32,
884 "textureNumLevels",
885 [](ProgramBuilder* b) { return b->ExprList("texture"); },
886 },
887 {
888 ValidTextureOverload::kNumLevelsCube,
889 "textureNumLevels(t : texture_cube<f32>) -> i32",
890 TextureKind::kRegular,
891 ast::SamplerKind::kSampler,
892 ast::TextureDimension::kCube,
893 TextureDataType::kF32,
894 "textureNumLevels",
895 [](ProgramBuilder* b) { return b->ExprList("texture"); },
896 },
897 {
898 ValidTextureOverload::kNumLevelsCubeArray,
899 "textureNumLevels(t : texture_cube_array<f32>) -> i32",
900 TextureKind::kRegular,
901 ast::SamplerKind::kSampler,
902 ast::TextureDimension::kCubeArray,
903 TextureDataType::kF32,
904 "textureNumLevels",
905 [](ProgramBuilder* b) { return b->ExprList("texture"); },
906 },
907 {
908 ValidTextureOverload::kNumLevelsDepth2d,
909 "textureNumLevels(t : texture_depth_2d) -> i32",
910 TextureKind::kDepth,
911 ast::SamplerKind::kSampler,
912 ast::TextureDimension::k2d,
913 TextureDataType::kF32,
914 "textureNumLevels",
915 [](ProgramBuilder* b) { return b->ExprList("texture"); },
916 },
917 {
918 ValidTextureOverload::kNumLevelsDepth2dArray,
919 "textureNumLevels(t : texture_depth_2d_array) -> i32",
920 TextureKind::kDepth,
921 ast::SamplerKind::kSampler,
922 ast::TextureDimension::k2dArray,
923 TextureDataType::kF32,
924 "textureNumLevels",
925 [](ProgramBuilder* b) { return b->ExprList("texture"); },
926 },
927 {
928 ValidTextureOverload::kNumLevelsDepthCube,
929 "textureNumLevels(t : texture_depth_cube) -> i32",
930 TextureKind::kDepth,
931 ast::SamplerKind::kSampler,
932 ast::TextureDimension::kCube,
933 TextureDataType::kF32,
934 "textureNumLevels",
935 [](ProgramBuilder* b) { return b->ExprList("texture"); },
936 },
937 {
938 ValidTextureOverload::kNumLevelsDepthCubeArray,
939 "textureNumLevels(t : texture_depth_cube_array) -> i32",
940 TextureKind::kDepth,
941 ast::SamplerKind::kSampler,
942 ast::TextureDimension::kCubeArray,
943 TextureDataType::kF32,
944 "textureNumLevels",
945 [](ProgramBuilder* b) { return b->ExprList("texture"); },
946 },
947 {
948 ValidTextureOverload::kNumSamplesMultisampled2d,
949 "textureNumSamples(t : texture_multisampled_2d<f32>) -> i32",
950 TextureKind::kMultisampled,
951 ast::SamplerKind::kSampler,
952 ast::TextureDimension::k2d,
953 TextureDataType::kF32,
954 "textureNumSamples",
955 [](ProgramBuilder* b) { return b->ExprList("texture"); },
956 },
957 {
958 ValidTextureOverload::kSample1dF32,
959 "textureSample(t : texture_1d<f32>,\n"
960 " s : sampler,\n"
961 " coords : f32) -> vec4<f32>",
962 TextureKind::kRegular,
963 ast::SamplerKind::kSampler,
964 ast::TextureDimension::k1d,
965 TextureDataType::kF32,
966 "textureSample",
967 [](ProgramBuilder* b) {
968 return b->ExprList("texture", // t
969 "sampler", // s
970 1.0f); // coords
971 },
972 },
973 {
974 ValidTextureOverload::kSample2dF32,
975 "textureSample(t : texture_2d<f32>,\n"
976 " s : sampler,\n"
977 " coords : vec2<f32>) -> vec4<f32>",
978 TextureKind::kRegular,
979 ast::SamplerKind::kSampler,
980 ast::TextureDimension::k2d,
981 TextureDataType::kF32,
982 "textureSample",
983 [](ProgramBuilder* b) {
984 return b->ExprList("texture", // t
985 "sampler", // s
986 b->vec2<f32>(1.f, 2.f)); // coords
987 },
988 },
989 {
990 ValidTextureOverload::kSample2dOffsetF32,
991 "textureSample(t : texture_2d<f32>,\n"
992 " s : sampler,\n"
993 " coords : vec2<f32>\n"
994 " offset : vec2<i32>) -> vec4<f32>",
995 TextureKind::kRegular,
996 ast::SamplerKind::kSampler,
997 ast::TextureDimension::k2d,
998 TextureDataType::kF32,
999 "textureSample",
1000 [](ProgramBuilder* b) {
1001 return b->ExprList("texture", // t
1002 "sampler", // s
1003 b->vec2<f32>(1.f, 2.f), // coords
1004 b->vec2<i32>(3, 4)); // offset
1005 },
1006 },
1007 {
1008 ValidTextureOverload::kSample2dArrayF32,
1009 "textureSample(t : texture_2d_array<f32>,\n"
1010 " s : sampler,\n"
1011 " coords : vec2<f32>,\n"
1012 " array_index : i32) -> vec4<f32>",
1013 TextureKind::kRegular,
1014 ast::SamplerKind::kSampler,
1015 ast::TextureDimension::k2dArray,
1016 TextureDataType::kF32,
1017 "textureSample",
1018 [](ProgramBuilder* b) {
1019 return b->ExprList("texture", // t
1020 "sampler", // s
1021 b->vec2<f32>(1.f, 2.f), // coords
1022 3); // array_index
1023 },
1024 },
1025 {
1026 ValidTextureOverload::kSample2dArrayOffsetF32,
1027 "textureSample(t : texture_2d_array<f32>,\n"
1028 " s : sampler,\n"
1029 " coords : vec2<f32>,\n"
1030 " array_index : i32\n"
1031 " offset : vec2<i32>) -> vec4<f32>",
1032 TextureKind::kRegular,
1033 ast::SamplerKind::kSampler,
1034 ast::TextureDimension::k2dArray,
1035 TextureDataType::kF32,
1036 "textureSample",
1037 [](ProgramBuilder* b) {
1038 return b->ExprList("texture", // t
1039 "sampler", // s
1040 b->vec2<f32>(1.f, 2.f), // coords
1041 3, // array_index
1042 b->vec2<i32>(4, 5)); // offset
1043 },
1044 },
1045 {
1046 ValidTextureOverload::kSample3dF32,
1047 "textureSample(t : texture_3d<f32>,\n"
1048 " s : sampler,\n"
1049 " coords : vec3<f32>) -> vec4<f32>",
1050 TextureKind::kRegular,
1051 ast::SamplerKind::kSampler,
1052 ast::TextureDimension::k3d,
1053 TextureDataType::kF32,
1054 "textureSample",
1055 [](ProgramBuilder* b) {
1056 return b->ExprList("texture", // t
1057 "sampler", // s
1058 b->vec3<f32>(1.f, 2.f, 3.f)); // coords
1059 },
1060 },
1061 {
1062 ValidTextureOverload::kSample3dOffsetF32,
1063 "textureSample(t : texture_3d<f32>,\n"
1064 " s : sampler,\n"
1065 " coords : vec3<f32>\n"
1066 " offset : vec3<i32>) -> vec4<f32>",
1067 TextureKind::kRegular,
1068 ast::SamplerKind::kSampler,
1069 ast::TextureDimension::k3d,
1070 TextureDataType::kF32,
1071 "textureSample",
1072 [](ProgramBuilder* b) {
1073 return b->ExprList("texture", // t
1074 "sampler", // s
1075 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1076 b->vec3<i32>(4, 5, 6)); // offset
1077 },
1078 },
1079 {
1080 ValidTextureOverload::kSampleCubeF32,
1081 "textureSample(t : texture_cube<f32>,\n"
1082 " s : sampler,\n"
1083 " coords : vec3<f32>) -> vec4<f32>",
1084 TextureKind::kRegular,
1085 ast::SamplerKind::kSampler,
1086 ast::TextureDimension::kCube,
1087 TextureDataType::kF32,
1088 "textureSample",
1089 [](ProgramBuilder* b) {
1090 return b->ExprList("texture", // t
1091 "sampler", // s
1092 b->vec3<f32>(1.f, 2.f, 3.f)); // coords
1093 },
1094 },
1095 {
1096 ValidTextureOverload::kSampleCubeArrayF32,
1097 "textureSample(t : texture_cube_array<f32>,\n"
1098 " s : sampler,\n"
1099 " coords : vec3<f32>,\n"
1100 " array_index : i32) -> vec4<f32>",
1101 TextureKind::kRegular,
1102 ast::SamplerKind::kSampler,
1103 ast::TextureDimension::kCubeArray,
1104 TextureDataType::kF32,
1105 "textureSample",
1106 [](ProgramBuilder* b) {
1107 return b->ExprList("texture", // t
1108 "sampler", // s
1109 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1110 4); // array_index
1111 },
1112 },
1113 {
1114 ValidTextureOverload::kSampleDepth2dF32,
1115 "textureSample(t : texture_depth_2d,\n"
1116 " s : sampler,\n"
1117 " coords : vec2<f32>) -> f32",
1118 TextureKind::kDepth,
1119 ast::SamplerKind::kSampler,
1120 ast::TextureDimension::k2d,
1121 TextureDataType::kF32,
1122 "textureSample",
1123 [](ProgramBuilder* b) {
1124 return b->ExprList("texture", // t
1125 "sampler", // s
1126 b->vec2<f32>(1.f, 2.f)); // coords
1127 },
1128 },
1129 {
1130 ValidTextureOverload::kSampleDepth2dOffsetF32,
1131 "textureSample(t : texture_depth_2d,\n"
1132 " s : sampler,\n"
1133 " coords : vec2<f32>\n"
1134 " offset : vec2<i32>) -> f32",
1135 TextureKind::kDepth,
1136 ast::SamplerKind::kSampler,
1137 ast::TextureDimension::k2d,
1138 TextureDataType::kF32,
1139 "textureSample",
1140 [](ProgramBuilder* b) {
1141 return b->ExprList("texture", // t
1142 "sampler", // s
1143 b->vec2<f32>(1.f, 2.f), // coords
1144 b->vec2<i32>(3, 4)); // offset
1145 },
1146 },
1147 {
1148 ValidTextureOverload::kSampleDepth2dArrayF32,
1149 "textureSample(t : texture_depth_2d_array,\n"
1150 " s : sampler,\n"
1151 " coords : vec2<f32>,\n"
1152 " array_index : i32) -> f32",
1153 TextureKind::kDepth,
1154 ast::SamplerKind::kSampler,
1155 ast::TextureDimension::k2dArray,
1156 TextureDataType::kF32,
1157 "textureSample",
1158 [](ProgramBuilder* b) {
1159 return b->ExprList("texture", // t
1160 "sampler", // s
1161 b->vec2<f32>(1.f, 2.f), // coords
1162 3); // array_index
1163 },
1164 },
1165 {
1166 ValidTextureOverload::kSampleDepth2dArrayOffsetF32,
1167 "textureSample(t : texture_depth_2d_array,\n"
1168 " s : sampler,\n"
1169 " coords : vec2<f32>,\n"
1170 " array_index : i32\n"
1171 " offset : vec2<i32>) -> f32",
1172 TextureKind::kDepth,
1173 ast::SamplerKind::kSampler,
1174 ast::TextureDimension::k2dArray,
1175 TextureDataType::kF32,
1176 "textureSample",
1177 [](ProgramBuilder* b) {
1178 return b->ExprList("texture", // t
1179 "sampler", // s
1180 b->vec2<f32>(1.f, 2.f), // coords
1181 3, // array_index
1182 b->vec2<i32>(4, 5)); // offset
1183 },
1184 },
1185 {
1186 ValidTextureOverload::kSampleDepthCubeF32,
1187 "textureSample(t : texture_depth_cube,\n"
1188 " s : sampler,\n"
1189 " coords : vec3<f32>) -> f32",
1190 TextureKind::kDepth,
1191 ast::SamplerKind::kSampler,
1192 ast::TextureDimension::kCube,
1193 TextureDataType::kF32,
1194 "textureSample",
1195 [](ProgramBuilder* b) {
1196 return b->ExprList("texture", // t
1197 "sampler", // s
1198 b->vec3<f32>(1.f, 2.f, 3.f)); // coords
1199 },
1200 },
1201 {
1202 ValidTextureOverload::kSampleDepthCubeArrayF32,
1203 "textureSample(t : texture_depth_cube_array,\n"
1204 " s : sampler,\n"
1205 " coords : vec3<f32>,\n"
1206 " array_index : i32) -> f32",
1207 TextureKind::kDepth,
1208 ast::SamplerKind::kSampler,
1209 ast::TextureDimension::kCubeArray,
1210 TextureDataType::kF32,
1211 "textureSample",
1212 [](ProgramBuilder* b) {
1213 return b->ExprList("texture", // t
1214 "sampler", // s
1215 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1216 4); // array_index
1217 },
1218 },
1219 {
1220 ValidTextureOverload::kSampleBias2dF32,
1221 "textureSampleBias(t : texture_2d<f32>,\n"
1222 " s : sampler,\n"
1223 " coords : vec2<f32>,\n"
1224 " bias : f32) -> vec4<f32>",
1225 TextureKind::kRegular,
1226 ast::SamplerKind::kSampler,
1227 ast::TextureDimension::k2d,
1228 TextureDataType::kF32,
1229 "textureSampleBias",
1230 [](ProgramBuilder* b) {
1231 return b->ExprList("texture", // t
1232 "sampler", // s
1233 b->vec2<f32>(1.f, 2.f), // coords
1234 3.f); // bias
1235 },
1236 },
1237 {
1238 ValidTextureOverload::kSampleBias2dOffsetF32,
1239 "textureSampleBias(t : texture_2d<f32>,\n"
1240 " s : sampler,\n"
1241 " coords : vec2<f32>,\n"
1242 " bias : f32,\n"
1243 " offset : vec2<i32>) -> vec4<f32>",
1244 TextureKind::kRegular,
1245 ast::SamplerKind::kSampler,
1246 ast::TextureDimension::k2d,
1247 TextureDataType::kF32,
1248 "textureSampleBias",
1249 [](ProgramBuilder* b) {
1250 return b->ExprList("texture", // t
1251 "sampler", // s
1252 b->vec2<f32>(1.f, 2.f), // coords
1253 3.f, // bias
1254 b->vec2<i32>(4, 5)); // offset
1255 },
1256 },
1257 {
1258 ValidTextureOverload::kSampleBias2dArrayF32,
1259 "textureSampleBias(t : texture_2d_array<f32>,\n"
1260 " s : sampler,\n"
1261 " coords : vec2<f32>,\n"
1262 " array_index : i32,\n"
1263 " bias : f32) -> vec4<f32>",
1264 TextureKind::kRegular,
1265 ast::SamplerKind::kSampler,
1266 ast::TextureDimension::k2dArray,
1267 TextureDataType::kF32,
1268 "textureSampleBias",
1269 [](ProgramBuilder* b) {
1270 return b->ExprList("texture", // t
1271 "sampler", // s
1272 b->vec2<f32>(1.f, 2.f), // coords
1273 4, // array_index
1274 3.f); // bias
1275 },
1276 },
1277 {
1278 ValidTextureOverload::kSampleBias2dArrayOffsetF32,
1279 "textureSampleBias(t : texture_2d_array<f32>,\n"
1280 " s : sampler,\n"
1281 " coords : vec2<f32>,\n"
1282 " array_index : i32,\n"
1283 " bias : f32,\n"
1284 " offset : vec2<i32>) -> vec4<f32>",
1285 TextureKind::kRegular,
1286 ast::SamplerKind::kSampler,
1287 ast::TextureDimension::k2dArray,
1288 TextureDataType::kF32,
1289 "textureSampleBias",
1290 [](ProgramBuilder* b) {
1291 return b->ExprList("texture", // t
1292 "sampler", // s
1293 b->vec2<f32>(1.f, 2.f), // coords
1294 3, // array_index
1295 4.f, // bias
1296 b->vec2<i32>(5, 6)); // offset
1297 },
1298 },
1299 {
1300 ValidTextureOverload::kSampleBias3dF32,
1301 "textureSampleBias(t : texture_3d<f32>,\n"
1302 " s : sampler,\n"
1303 " coords : vec3<f32>,\n"
1304 " bias : f32) -> vec4<f32>",
1305 TextureKind::kRegular,
1306 ast::SamplerKind::kSampler,
1307 ast::TextureDimension::k3d,
1308 TextureDataType::kF32,
1309 "textureSampleBias",
1310 [](ProgramBuilder* b) {
1311 return b->ExprList("texture", // t
1312 "sampler", // s
1313 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1314 4.f); // bias
1315 },
1316 },
1317 {
1318 ValidTextureOverload::kSampleBias3dOffsetF32,
1319 "textureSampleBias(t : texture_3d<f32>,\n"
1320 " s : sampler,\n"
1321 " coords : vec3<f32>,\n"
1322 " bias : f32,\n"
1323 " offset : vec3<i32>) -> vec4<f32>",
1324 TextureKind::kRegular,
1325 ast::SamplerKind::kSampler,
1326 ast::TextureDimension::k3d,
1327 TextureDataType::kF32,
1328 "textureSampleBias",
1329 [](ProgramBuilder* b) {
1330 return b->ExprList("texture", // t
1331 "sampler", // s
1332 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1333 4.f, // bias
1334 b->vec3<i32>(5, 6, 7)); // offset
1335 },
1336 },
1337 {
1338 ValidTextureOverload::kSampleBiasCubeF32,
1339 "textureSampleBias(t : texture_cube<f32>,\n"
1340 " s : sampler,\n"
1341 " coords : vec3<f32>,\n"
1342 " bias : f32) -> vec4<f32>",
1343 TextureKind::kRegular,
1344 ast::SamplerKind::kSampler,
1345 ast::TextureDimension::kCube,
1346 TextureDataType::kF32,
1347 "textureSampleBias",
1348 [](ProgramBuilder* b) {
1349 return b->ExprList("texture", // t
1350 "sampler", // s
1351 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1352 4.f); // bias
1353 },
1354 },
1355 {
1356 ValidTextureOverload::kSampleBiasCubeArrayF32,
1357 "textureSampleBias(t : texture_cube_array<f32>,\n"
1358 " s : sampler,\n"
1359 " coords : vec3<f32>,\n"
1360 " array_index : i32,\n"
1361 " bias : f32) -> vec4<f32>",
1362 TextureKind::kRegular,
1363 ast::SamplerKind::kSampler,
1364 ast::TextureDimension::kCubeArray,
1365 TextureDataType::kF32,
1366 "textureSampleBias",
1367 [](ProgramBuilder* b) {
1368 return b->ExprList("texture", // t
1369 "sampler", // s
1370 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1371 3, // array_index
1372 4.f); // bias
1373 },
1374 },
1375 {
1376 ValidTextureOverload::kSampleLevel2dF32,
1377 "textureSampleLevel(t : texture_2d<f32>,\n"
1378 " s : sampler,\n"
1379 " coords : vec2<f32>,\n"
1380 " level : f32) -> vec4<f32>",
1381 TextureKind::kRegular,
1382 ast::SamplerKind::kSampler,
1383 ast::TextureDimension::k2d,
1384 TextureDataType::kF32,
1385 "textureSampleLevel",
1386 [](ProgramBuilder* b) {
1387 return b->ExprList("texture", // t
1388 "sampler", // s
1389 b->vec2<f32>(1.f, 2.f), // coords
1390 3.f); // level
1391 },
1392 },
1393 {
1394 ValidTextureOverload::kSampleLevel2dOffsetF32,
1395 "textureSampleLevel(t : texture_2d<f32>,\n"
1396 " s : sampler,\n"
1397 " coords : vec2<f32>,\n"
1398 " level : f32,\n"
1399 " offset : vec2<i32>) -> vec4<f32>",
1400 TextureKind::kRegular,
1401 ast::SamplerKind::kSampler,
1402 ast::TextureDimension::k2d,
1403 TextureDataType::kF32,
1404 "textureSampleLevel",
1405 [](ProgramBuilder* b) {
1406 return b->ExprList("texture", // t
1407 "sampler", // s
1408 b->vec2<f32>(1.f, 2.f), // coords
1409 3.f, // level
1410 b->vec2<i32>(4, 5)); // offset
1411 },
1412 },
1413 {
1414 ValidTextureOverload::kSampleLevel2dArrayF32,
1415 "textureSampleLevel(t : texture_2d_array<f32>,\n"
1416 " s : sampler,\n"
1417 " coords : vec2<f32>,\n"
1418 " array_index : i32,\n"
1419 " level : f32) -> vec4<f32>",
1420 TextureKind::kRegular,
1421 ast::SamplerKind::kSampler,
1422 ast::TextureDimension::k2dArray,
1423 TextureDataType::kF32,
1424 "textureSampleLevel",
1425 [](ProgramBuilder* b) {
1426 return b->ExprList("texture", // t
1427 "sampler", // s
1428 b->vec2<f32>(1.f, 2.f), // coords
1429 3, // array_index
1430 4.f); // level
1431 },
1432 },
1433 {
1434 ValidTextureOverload::kSampleLevel2dArrayOffsetF32,
1435 "textureSampleLevel(t : texture_2d_array<f32>,\n"
1436 " s : sampler,\n"
1437 " coords : vec2<f32>,\n"
1438 " array_index : i32,\n"
1439 " level : f32,\n"
1440 " offset : vec2<i32>) -> vec4<f32>",
1441 TextureKind::kRegular,
1442 ast::SamplerKind::kSampler,
1443 ast::TextureDimension::k2dArray,
1444 TextureDataType::kF32,
1445 "textureSampleLevel",
1446 [](ProgramBuilder* b) {
1447 return b->ExprList("texture", // t
1448 "sampler", // s
1449 b->vec2<f32>(1.f, 2.f), // coords
1450 3, // array_index
1451 4.f, // level
1452 b->vec2<i32>(5, 6)); // offset
1453 },
1454 },
1455 {
1456 ValidTextureOverload::kSampleLevel3dF32,
1457 "textureSampleLevel(t : texture_3d<f32>,\n"
1458 " s : sampler,\n"
1459 " coords : vec3<f32>,\n"
1460 " level : f32) -> vec4<f32>",
1461 TextureKind::kRegular,
1462 ast::SamplerKind::kSampler,
1463 ast::TextureDimension::k3d,
1464 TextureDataType::kF32,
1465 "textureSampleLevel",
1466 [](ProgramBuilder* b) {
1467 return b->ExprList("texture", // t
1468 "sampler", // s
1469 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1470 4.f); // level
1471 },
1472 },
1473 {
1474 ValidTextureOverload::kSampleLevel3dOffsetF32,
1475 "textureSampleLevel(t : texture_3d<f32>,\n"
1476 " s : sampler,\n"
1477 " coords : vec3<f32>,\n"
1478 " level : f32,\n"
1479 " offset : vec3<i32>) -> vec4<f32>",
1480 TextureKind::kRegular,
1481 ast::SamplerKind::kSampler,
1482 ast::TextureDimension::k3d,
1483 TextureDataType::kF32,
1484 "textureSampleLevel",
1485 [](ProgramBuilder* b) {
1486 return b->ExprList("texture", // t
1487 "sampler", // s
1488 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1489 4.f, // level
1490 b->vec3<i32>(5, 6, 7)); // offset
1491 },
1492 },
1493 {
1494 ValidTextureOverload::kSampleLevelCubeF32,
1495 "textureSampleLevel(t : texture_cube<f32>,\n"
1496 " s : sampler,\n"
1497 " coords : vec3<f32>,\n"
1498 " level : f32) -> vec4<f32>",
1499 TextureKind::kRegular,
1500 ast::SamplerKind::kSampler,
1501 ast::TextureDimension::kCube,
1502 TextureDataType::kF32,
1503 "textureSampleLevel",
1504 [](ProgramBuilder* b) {
1505 return b->ExprList("texture", // t
1506 "sampler", // s
1507 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1508 4.f); // level
1509 },
1510 },
1511 {
1512 ValidTextureOverload::kSampleLevelCubeArrayF32,
1513 "textureSampleLevel(t : texture_cube_array<f32>,\n"
1514 " s : sampler,\n"
1515 " coords : vec3<f32>,\n"
1516 " array_index : i32,\n"
1517 " level : f32) -> vec4<f32>",
1518 TextureKind::kRegular,
1519 ast::SamplerKind::kSampler,
1520 ast::TextureDimension::kCubeArray,
1521 TextureDataType::kF32,
1522 "textureSampleLevel",
1523 [](ProgramBuilder* b) {
1524 return b->ExprList("texture", // t
1525 "sampler", // s
1526 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1527 4, // array_index
1528 5.f); // level
1529 },
1530 },
1531 {
1532 ValidTextureOverload::kSampleLevelDepth2dF32,
1533 "textureSampleLevel(t : texture_depth_2d,\n"
1534 " s : sampler,\n"
1535 " coords : vec2<f32>,\n"
1536 " level : i32) -> f32",
1537 TextureKind::kDepth,
1538 ast::SamplerKind::kSampler,
1539 ast::TextureDimension::k2d,
1540 TextureDataType::kF32,
1541 "textureSampleLevel",
1542 [](ProgramBuilder* b) {
1543 return b->ExprList("texture", // t
1544 "sampler", // s
1545 b->vec2<f32>(1.f, 2.f), // coords
1546 3); // level
1547 },
1548 },
1549 {
1550 ValidTextureOverload::kSampleLevelDepth2dOffsetF32,
1551 "textureSampleLevel(t : texture_depth_2d,\n"
1552 " s : sampler,\n"
1553 " coords : vec2<f32>,\n"
1554 " level : i32,\n"
1555 " offset : vec2<i32>) -> f32",
1556 TextureKind::kDepth,
1557 ast::SamplerKind::kSampler,
1558 ast::TextureDimension::k2d,
1559 TextureDataType::kF32,
1560 "textureSampleLevel",
1561 [](ProgramBuilder* b) {
1562 return b->ExprList("texture", // t
1563 "sampler", // s
1564 b->vec2<f32>(1.f, 2.f), // coords
1565 3, // level
1566 b->vec2<i32>(4, 5)); // offset
1567 },
1568 },
1569 {
1570 ValidTextureOverload::kSampleLevelDepth2dArrayF32,
1571 "textureSampleLevel(t : texture_depth_2d_array,\n"
1572 " s : sampler,\n"
1573 " coords : vec2<f32>,\n"
1574 " array_index : i32,\n"
1575 " level : i32) -> f32",
1576 TextureKind::kDepth,
1577 ast::SamplerKind::kSampler,
1578 ast::TextureDimension::k2dArray,
1579 TextureDataType::kF32,
1580 "textureSampleLevel",
1581 [](ProgramBuilder* b) {
1582 return b->ExprList("texture", // t
1583 "sampler", // s
1584 b->vec2<f32>(1.f, 2.f), // coords
1585 3, // array_index
1586 4); // level
1587 },
1588 },
1589 {
1590 ValidTextureOverload::kSampleLevelDepth2dArrayOffsetF32,
1591 "textureSampleLevel(t : texture_depth_2d_array,\n"
1592 " s : sampler,\n"
1593 " coords : vec2<f32>,\n"
1594 " array_index : i32,\n"
1595 " level : i32,\n"
1596 " offset : vec2<i32>) -> f32",
1597 TextureKind::kDepth,
1598 ast::SamplerKind::kSampler,
1599 ast::TextureDimension::k2dArray,
1600 TextureDataType::kF32,
1601 "textureSampleLevel",
1602 [](ProgramBuilder* b) {
1603 return b->ExprList("texture", // t
1604 "sampler", // s
1605 b->vec2<f32>(1.f, 2.f), // coords
1606 3, // array_index
1607 4, // level
1608 b->vec2<i32>(5, 6)); // offset
1609 },
1610 },
1611 {
1612 ValidTextureOverload::kSampleLevelDepthCubeF32,
1613 "textureSampleLevel(t : texture_depth_cube,\n"
1614 " s : sampler,\n"
1615 " coords : vec3<f32>,\n"
1616 " level : i32) -> f32",
1617 TextureKind::kDepth,
1618 ast::SamplerKind::kSampler,
1619 ast::TextureDimension::kCube,
1620 TextureDataType::kF32,
1621 "textureSampleLevel",
1622 [](ProgramBuilder* b) {
1623 return b->ExprList("texture", // t
1624 "sampler", // s
1625 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1626 4); // level
1627 },
1628 },
1629 {
1630 ValidTextureOverload::kSampleLevelDepthCubeArrayF32,
1631 "textureSampleLevel(t : texture_depth_cube_array,\n"
1632 " s : sampler,\n"
1633 " coords : vec3<f32>,\n"
1634 " array_index : i32,\n"
1635 " level : i32) -> f32",
1636 TextureKind::kDepth,
1637 ast::SamplerKind::kSampler,
1638 ast::TextureDimension::kCubeArray,
1639 TextureDataType::kF32,
1640 "textureSampleLevel",
1641 [](ProgramBuilder* b) {
1642 return b->ExprList("texture", // t
1643 "sampler", // s
1644 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1645 4, // array_index
1646 5); // level
1647 },
1648 },
1649 {
1650 ValidTextureOverload::kSampleGrad2dF32,
1651 "textureSampleGrad(t : texture_2d<f32>,\n"
1652 " s : sampler,\n"
1653 " coords : vec2<f32>\n"
1654 " ddx : vec2<f32>,\n"
1655 " ddy : vec2<f32>) -> vec4<f32>",
1656 TextureKind::kRegular,
1657 ast::SamplerKind::kSampler,
1658 ast::TextureDimension::k2d,
1659 TextureDataType::kF32,
1660 "textureSampleGrad",
1661 [](ProgramBuilder* b) {
1662 return b->ExprList("texture", // t
1663 "sampler", // s
1664 b->vec2<f32>(1.0f, 2.0f), // coords
1665 b->vec2<f32>(3.0f, 4.0f), // ddx
1666 b->vec2<f32>(5.0f, 6.0f)); // ddy
1667 },
1668 },
1669 {
1670 ValidTextureOverload::kSampleGrad2dOffsetF32,
1671 "textureSampleGrad(t : texture_2d<f32>,\n"
1672 " s : sampler,\n"
1673 " coords : vec2<f32>,\n"
1674 " ddx : vec2<f32>,\n"
1675 " ddy : vec2<f32>,\n"
1676 " offset : vec2<i32>) -> vec4<f32>",
1677 TextureKind::kRegular,
1678 ast::SamplerKind::kSampler,
1679 ast::TextureDimension::k2d,
1680 TextureDataType::kF32,
1681 "textureSampleGrad",
1682 [](ProgramBuilder* b) {
1683 return b->ExprList("texture", // t
1684 "sampler", // s
1685 b->vec2<f32>(1.f, 2.f), // coords
1686 b->vec2<f32>(3.f, 4.f), // ddx
1687 b->vec2<f32>(5.f, 6.f), // ddy
1688 b->vec2<i32>(7, 7)); // offset
1689 },
1690 },
1691 {
1692 ValidTextureOverload::kSampleGrad2dArrayF32,
1693 "textureSampleGrad(t : texture_2d_array<f32>,\n"
1694 " s : sampler,\n"
1695 " coords : vec2<f32>,\n"
1696 " array_index : i32,\n"
1697 " ddx : vec2<f32>,\n"
1698 " ddy : vec2<f32>) -> vec4<f32>",
1699 TextureKind::kRegular,
1700 ast::SamplerKind::kSampler,
1701 ast::TextureDimension::k2dArray,
1702 TextureDataType::kF32,
1703 "textureSampleGrad",
1704 [](ProgramBuilder* b) {
1705 return b->ExprList("texture", // t
1706 "sampler", // s
1707 b->vec2<f32>(1.f, 2.f), // coords
1708 3, // array_index
1709 b->vec2<f32>(4.f, 5.f), // ddx
1710 b->vec2<f32>(6.f, 7.f)); // ddy
1711 },
1712 },
1713 {
1714 ValidTextureOverload::kSampleGrad2dArrayOffsetF32,
1715 "textureSampleGrad(t : texture_2d_array<f32>,\n"
1716 " s : sampler,\n"
1717 " coords : vec2<f32>,\n"
1718 " array_index : i32,\n"
1719 " ddx : vec2<f32>,\n"
1720 " ddy : vec2<f32>,\n"
1721 " offset : vec2<i32>) -> vec4<f32>",
1722 TextureKind::kRegular,
1723 ast::SamplerKind::kSampler,
1724 ast::TextureDimension::k2dArray,
1725 TextureDataType::kF32,
1726 "textureSampleGrad",
1727 [](ProgramBuilder* b) {
1728 return b->ExprList("texture", // t
1729 "sampler", // s
1730 b->vec2<f32>(1.f, 2.f), // coords
1731 3, // array_index
1732 b->vec2<f32>(4.f, 5.f), // ddx
1733 b->vec2<f32>(6.f, 7.f), // ddy
1734 b->vec2<i32>(6, 7)); // offset
1735 },
1736 },
1737 {
1738 ValidTextureOverload::kSampleGrad3dF32,
1739 "textureSampleGrad(t : texture_3d<f32>,\n"
1740 " s : sampler,\n"
1741 " coords : vec3<f32>,\n"
1742 " ddx : vec3<f32>,\n"
1743 " ddy : vec3<f32>) -> vec4<f32>",
1744 TextureKind::kRegular,
1745 ast::SamplerKind::kSampler,
1746 ast::TextureDimension::k3d,
1747 TextureDataType::kF32,
1748 "textureSampleGrad",
1749 [](ProgramBuilder* b) {
1750 return b->ExprList("texture", // t
1751 "sampler", // s
1752 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1753 b->vec3<f32>(4.f, 5.f, 6.f), // ddx
1754 b->vec3<f32>(7.f, 8.f, 9.f)); // ddy
1755 },
1756 },
1757 {
1758 ValidTextureOverload::kSampleGrad3dOffsetF32,
1759 "textureSampleGrad(t : texture_3d<f32>,\n"
1760 " s : sampler,\n"
1761 " coords : vec3<f32>,\n"
1762 " ddx : vec3<f32>,\n"
1763 " ddy : vec3<f32>,\n"
1764 " offset : vec3<i32>) -> vec4<f32>",
1765 TextureKind::kRegular,
1766 ast::SamplerKind::kSampler,
1767 ast::TextureDimension::k3d,
1768 TextureDataType::kF32,
1769 "textureSampleGrad",
1770 [](ProgramBuilder* b) {
1771 return b->ExprList("texture", // t
1772 "sampler", // s
1773 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1774 b->vec3<f32>(4.f, 5.f, 6.f), // ddx
1775 b->vec3<f32>(7.f, 8.f, 9.f), // ddy
1776 b->vec3<i32>(0, 1, 2)); // offset
1777 },
1778 },
1779 {
1780 ValidTextureOverload::kSampleGradCubeF32,
1781 "textureSampleGrad(t : texture_cube<f32>,\n"
1782 " s : sampler,\n"
1783 " coords : vec3<f32>,\n"
1784 " ddx : vec3<f32>,\n"
1785 " ddy : vec3<f32>) -> vec4<f32>",
1786 TextureKind::kRegular,
1787 ast::SamplerKind::kSampler,
1788 ast::TextureDimension::kCube,
1789 TextureDataType::kF32,
1790 "textureSampleGrad",
1791 [](ProgramBuilder* b) {
1792 return b->ExprList("texture", // t
1793 "sampler", // s
1794 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1795 b->vec3<f32>(4.f, 5.f, 6.f), // ddx
1796 b->vec3<f32>(7.f, 8.f, 9.f)); // ddy
1797 },
1798 },
1799 {
1800 ValidTextureOverload::kSampleGradCubeArrayF32,
1801 "textureSampleGrad(t : texture_cube_array<f32>,\n"
1802 " s : sampler,\n"
1803 " coords : vec3<f32>,\n"
1804 " array_index : i32,\n"
1805 " ddx : vec3<f32>,\n"
1806 " ddy : vec3<f32>) -> vec4<f32>",
1807 TextureKind::kRegular,
1808 ast::SamplerKind::kSampler,
1809 ast::TextureDimension::kCubeArray,
1810 TextureDataType::kF32,
1811 "textureSampleGrad",
1812 [](ProgramBuilder* b) {
1813 return b->ExprList("texture", // t
1814 "sampler", // s
1815 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1816 4, // array_index
1817 b->vec3<f32>(5.f, 6.f, 7.f), // ddx
1818 b->vec3<f32>(8.f, 9.f, 10.f)); // ddy
1819 },
1820 },
1821 {
1822 ValidTextureOverload::kSampleCompareDepth2dF32,
1823 "textureSampleCompare(t : texture_depth_2d,\n"
1824 " s : sampler_comparison,\n"
1825 " coords : vec2<f32>,\n"
1826 " depth_ref : f32) -> f32",
1827 TextureKind::kDepth,
1828 ast::SamplerKind::kComparisonSampler,
1829 ast::TextureDimension::k2d,
1830 TextureDataType::kF32,
1831 "textureSampleCompare",
1832 [](ProgramBuilder* b) {
1833 return b->ExprList("texture", // t
1834 "sampler", // s
1835 b->vec2<f32>(1.f, 2.f), // coords
1836 3.f); // depth_ref
1837 },
1838 },
1839 {
1840 ValidTextureOverload::kSampleCompareDepth2dOffsetF32,
1841 "textureSampleCompare(t : texture_depth_2d,\n"
1842 " s : sampler_comparison,\n"
1843 " coords : vec2<f32>,\n"
1844 " depth_ref : f32,\n"
1845 " offset : vec2<i32>) -> f32",
1846 TextureKind::kDepth,
1847 ast::SamplerKind::kComparisonSampler,
1848 ast::TextureDimension::k2d,
1849 TextureDataType::kF32,
1850 "textureSampleCompare",
1851 [](ProgramBuilder* b) {
1852 return b->ExprList("texture", // t
1853 "sampler", // s
1854 b->vec2<f32>(1.f, 2.f), // coords
1855 3.f, // depth_ref
1856 b->vec2<i32>(4, 5)); // offset
1857 },
1858 },
1859 {
1860 ValidTextureOverload::kSampleCompareDepth2dArrayF32,
1861 "textureSampleCompare(t : texture_depth_2d_array,\n"
1862 " s : sampler_comparison,\n"
1863 " coords : vec2<f32>,\n"
1864 " array_index : i32,\n"
1865 " depth_ref : f32) -> f32",
1866 TextureKind::kDepth,
1867 ast::SamplerKind::kComparisonSampler,
1868 ast::TextureDimension::k2dArray,
1869 TextureDataType::kF32,
1870 "textureSampleCompare",
1871 [](ProgramBuilder* b) {
1872 return b->ExprList("texture", // t
1873 "sampler", // s
1874 b->vec2<f32>(1.f, 2.f), // coords
1875 4, // array_index
1876 3.f); // depth_ref
1877 },
1878 },
1879 {
1880 ValidTextureOverload::kSampleCompareDepth2dArrayOffsetF32,
1881 "textureSampleCompare(t : texture_depth_2d_array,\n"
1882 " s : sampler_comparison,\n"
1883 " coords : vec2<f32>,\n"
1884 " array_index : i32,\n"
1885 " depth_ref : f32,\n"
1886 " offset : vec2<i32>) -> f32",
1887 TextureKind::kDepth,
1888 ast::SamplerKind::kComparisonSampler,
1889 ast::TextureDimension::k2dArray,
1890 TextureDataType::kF32,
1891 "textureSampleCompare",
1892 [](ProgramBuilder* b) {
1893 return b->ExprList("texture", // t
1894 "sampler", // s
1895 b->vec2<f32>(1.f, 2.f), // coords
1896 4, // array_index
1897 3.f, // depth_ref
1898 b->vec2<i32>(5, 6)); // offset
1899 },
1900 },
1901 {
1902 ValidTextureOverload::kSampleCompareDepthCubeF32,
1903 "textureSampleCompare(t : texture_depth_cube,\n"
1904 " s : sampler_comparison,\n"
1905 " coords : vec3<f32>,\n"
1906 " depth_ref : f32) -> f32",
1907 TextureKind::kDepth,
1908 ast::SamplerKind::kComparisonSampler,
1909 ast::TextureDimension::kCube,
1910 TextureDataType::kF32,
1911 "textureSampleCompare",
1912 [](ProgramBuilder* b) {
1913 return b->ExprList("texture", // t
1914 "sampler", // s
1915 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1916 4.f); // depth_ref
1917 },
1918 },
1919 {
1920 ValidTextureOverload::kSampleCompareDepthCubeArrayF32,
1921 "textureSampleCompare(t : texture_depth_cube_array,\n"
1922 " s : sampler_comparison,\n"
1923 " coords : vec3<f32>,\n"
1924 " array_index : i32,\n"
1925 " depth_ref : f32) -> f32",
1926 TextureKind::kDepth,
1927 ast::SamplerKind::kComparisonSampler,
1928 ast::TextureDimension::kCubeArray,
1929 TextureDataType::kF32,
1930 "textureSampleCompare",
1931 [](ProgramBuilder* b) {
1932 return b->ExprList("texture", // t
1933 "sampler", // s
1934 b->vec3<f32>(1.f, 2.f, 3.f), // coords
1935 4, // array_index
1936 5.f); // depth_ref
1937 },
1938 },
1939 {
1940 ValidTextureOverload::kLoad1dLevelF32,
1941 "textureLoad(t : texture_1d<f32>,\n"
1942 " coords : i32,\n"
1943 " level : i32) -> vec4<f32>",
1944 TextureKind::kRegular,
1945 ast::TextureDimension::k1d,
1946 TextureDataType::kF32,
1947 "textureLoad",
1948 [](ProgramBuilder* b) {
1949 return b->ExprList("texture", // t
1950 1, // coords
1951 3); // level
1952 },
1953 },
1954 {
1955 ValidTextureOverload::kLoad1dLevelU32,
1956 "textureLoad(t : texture_1d<u32>,\n"
1957 " coords : i32,\n"
1958 " level : i32) -> vec4<u32>",
1959 TextureKind::kRegular,
1960 ast::TextureDimension::k1d,
1961 TextureDataType::kU32,
1962 "textureLoad",
1963 [](ProgramBuilder* b) {
1964 return b->ExprList("texture", // t
1965 1, // coords
1966 3); // level
1967 },
1968 },
1969 {
1970 ValidTextureOverload::kLoad1dLevelI32,
1971 "textureLoad(t : texture_1d<i32>,\n"
1972 " coords : i32,\n"
1973 " level : i32) -> vec4<i32>",
1974 TextureKind::kRegular,
1975 ast::TextureDimension::k1d,
1976 TextureDataType::kI32,
1977 "textureLoad",
1978 [](ProgramBuilder* b) {
1979 return b->ExprList("texture", // t
1980 1, // coords
1981 3); // level
1982 },
1983 },
1984 {
1985 ValidTextureOverload::kLoad2dLevelF32,
1986 "textureLoad(t : texture_2d<f32>,\n"
1987 " coords : vec2<i32>,\n"
1988 " level : i32) -> vec4<f32>",
1989 TextureKind::kRegular,
1990 ast::TextureDimension::k2d,
1991 TextureDataType::kF32,
1992 "textureLoad",
1993 [](ProgramBuilder* b) {
1994 return b->ExprList("texture", // t
1995 b->vec2<i32>(1, 2), // coords
1996 3); // level
1997 },
1998 },
1999 {
2000 ValidTextureOverload::kLoad2dLevelU32,
2001 "textureLoad(t : texture_2d<u32>,\n"
2002 " coords : vec2<i32>,\n"
2003 " level : i32) -> vec4<u32>",
2004 TextureKind::kRegular,
2005 ast::TextureDimension::k2d,
2006 TextureDataType::kU32,
2007 "textureLoad",
2008 [](ProgramBuilder* b) {
2009 return b->ExprList("texture", // t
2010 b->vec2<i32>(1, 2), // coords
2011 3); // level
2012 },
2013 },
2014 {
2015 ValidTextureOverload::kLoad2dLevelI32,
2016 "textureLoad(t : texture_2d<i32>,\n"
2017 " coords : vec2<i32>,\n"
2018 " level : i32) -> vec4<i32>",
2019 TextureKind::kRegular,
2020 ast::TextureDimension::k2d,
2021 TextureDataType::kI32,
2022 "textureLoad",
2023 [](ProgramBuilder* b) {
2024 return b->ExprList("texture", // t
2025 b->vec2<i32>(1, 2), // coords
2026 3); // level
2027 },
2028 },
2029 {
2030 ValidTextureOverload::kLoad2dArrayLevelF32,
2031 "textureLoad(t : texture_2d_array<f32>,\n"
2032 " coords : vec2<i32>,\n"
2033 " array_index : i32,\n"
2034 " level : i32) -> vec4<f32>",
2035 TextureKind::kRegular,
2036 ast::TextureDimension::k2dArray,
2037 TextureDataType::kF32,
2038 "textureLoad",
2039 [](ProgramBuilder* b) {
2040 return b->ExprList("texture", // t
2041 b->vec2<i32>(1, 2), // coords
2042 3, // array_index
2043 4); // level
2044 },
2045 },
2046 {
2047 ValidTextureOverload::kLoad2dArrayLevelU32,
2048 "textureLoad(t : texture_2d_array<u32>,\n"
2049 " coords : vec2<i32>,\n"
2050 " array_index : i32,\n"
2051 " level : i32) -> vec4<u32>",
2052 TextureKind::kRegular,
2053 ast::TextureDimension::k2dArray,
2054 TextureDataType::kU32,
2055 "textureLoad",
2056 [](ProgramBuilder* b) {
2057 return b->ExprList("texture", // t
2058 b->vec2<i32>(1, 2), // coords
2059 3, // array_index
2060 4); // level
2061 },
2062 },
2063 {
2064 ValidTextureOverload::kLoad2dArrayLevelI32,
2065 "textureLoad(t : texture_2d_array<i32>,\n"
2066 " coords : vec2<i32>,\n"
2067 " array_index : i32,\n"
2068 " level : i32) -> vec4<i32>",
2069 TextureKind::kRegular,
2070 ast::TextureDimension::k2dArray,
2071 TextureDataType::kI32,
2072 "textureLoad",
2073 [](ProgramBuilder* b) {
2074 return b->ExprList("texture", // t
2075 b->vec2<i32>(1, 2), // coords
2076 3, // array_index
2077 4); // level
2078 },
2079 },
2080 {
2081 ValidTextureOverload::kLoad3dLevelF32,
2082 "textureLoad(t : texture_3d<f32>,\n"
2083 " coords : vec3<i32>,\n"
2084 " level : i32) -> vec4<f32>",
2085 TextureKind::kRegular,
2086 ast::TextureDimension::k3d,
2087 TextureDataType::kF32,
2088 "textureLoad",
2089 [](ProgramBuilder* b) {
2090 return b->ExprList("texture", // t
2091 b->vec3<i32>(1, 2, 3), // coords
2092 4); // level
2093 },
2094 },
2095 {
2096 ValidTextureOverload::kLoad3dLevelU32,
2097 "textureLoad(t : texture_3d<u32>,\n"
2098 " coords : vec3<i32>,\n"
2099 " level : i32) -> vec4<u32>",
2100 TextureKind::kRegular,
2101 ast::TextureDimension::k3d,
2102 TextureDataType::kU32,
2103 "textureLoad",
2104 [](ProgramBuilder* b) {
2105 return b->ExprList("texture", // t
2106 b->vec3<i32>(1, 2, 3), // coords
2107 4); // level
2108 },
2109 },
2110 {
2111 ValidTextureOverload::kLoad3dLevelI32,
2112 "textureLoad(t : texture_3d<i32>,\n"
2113 " coords : vec3<i32>,\n"
2114 " level : i32) -> vec4<i32>",
2115 TextureKind::kRegular,
2116 ast::TextureDimension::k3d,
2117 TextureDataType::kI32,
2118 "textureLoad",
2119 [](ProgramBuilder* b) {
2120 return b->ExprList("texture", // t
2121 b->vec3<i32>(1, 2, 3), // coords
2122 4); // level
2123 },
2124 },
2125 {
2126 ValidTextureOverload::kLoadMultisampled2dF32,
2127 "textureLoad(t : texture_multisampled_2d<f32>,\n"
2128 " coords : vec2<i32>,\n"
2129 " sample_index : i32) -> vec4<f32>",
2130 TextureKind::kMultisampled,
2131 ast::TextureDimension::k2d,
2132 TextureDataType::kF32,
2133 "textureLoad",
2134 [](ProgramBuilder* b) {
2135 return b->ExprList("texture", // t
2136 b->vec2<i32>(1, 2), // coords
2137 3); // sample_index
2138 },
2139 },
2140 {
2141 ValidTextureOverload::kLoadMultisampled2dU32,
2142 "textureLoad(t : texture_multisampled_2d<u32>,\n"
2143 " coords : vec2<i32>,\n"
2144 " sample_index : i32) -> vec4<u32>",
2145 TextureKind::kMultisampled,
2146 ast::TextureDimension::k2d,
2147 TextureDataType::kU32,
2148 "textureLoad",
2149 [](ProgramBuilder* b) {
2150 return b->ExprList("texture", // t
2151 b->vec2<i32>(1, 2), // coords
2152 3); // sample_index
2153 },
2154 },
2155 {
2156 ValidTextureOverload::kLoadMultisampled2dI32,
2157 "textureLoad(t : texture_multisampled_2d<i32>,\n"
2158 " coords : vec2<i32>,\n"
2159 " sample_index : i32) -> vec4<i32>",
2160 TextureKind::kMultisampled,
2161 ast::TextureDimension::k2d,
2162 TextureDataType::kI32,
2163 "textureLoad",
2164 [](ProgramBuilder* b) {
2165 return b->ExprList("texture", // t
2166 b->vec2<i32>(1, 2), // coords
2167 3); // sample_index
2168 },
2169 },
2170 {
2171 ValidTextureOverload::kLoadDepth2dLevelF32,
2172 "textureLoad(t : texture_depth_2d,\n"
2173 " coords : vec2<i32>,\n"
2174 " level : i32) -> f32",
2175 TextureKind::kDepth,
2176 ast::TextureDimension::k2d,
2177 TextureDataType::kF32,
2178 "textureLoad",
2179 [](ProgramBuilder* b) {
2180 return b->ExprList("texture", // t
2181 b->vec2<i32>(1, 2), // coords
2182 3); // level
2183 },
2184 },
2185 {
2186 ValidTextureOverload::kLoadDepth2dArrayLevelF32,
2187 "textureLoad(t : texture_depth_2d_array,\n"
2188 " coords : vec2<i32>,\n"
2189 " array_index : i32,\n"
2190 " level : i32) -> f32",
2191 TextureKind::kDepth,
2192 ast::TextureDimension::k2dArray,
2193 TextureDataType::kF32,
2194 "textureLoad",
2195 [](ProgramBuilder* b) {
2196 return b->ExprList("texture", // t
2197 b->vec2<i32>(1, 2), // coords
2198 3, // array_index
2199 4); // level
2200 },
2201 },
2202 {
2203 ValidTextureOverload::kStoreWO1dRgba32float,
2204 "textureStore(t : texture_storage_1d<rgba32float>,\n"
2205 " coords : i32,\n"
2206 " value : vec4<T>)",
2207 ast::Access::kWrite,
2208 ast::ImageFormat::kRgba32Float,
2209 ast::TextureDimension::k1d,
2210 TextureDataType::kF32,
2211 "textureStore",
2212 [](ProgramBuilder* b) {
2213 return b->ExprList("texture", // t
2214 1, // coords
2215 b->vec4<f32>(2.f, 3.f, 4.f, 5.f)); // value
2216 },
2217 },
2218 {
2219 ValidTextureOverload::kStoreWO2dRgba32float,
2220 "textureStore(t : texture_storage_2d<rgba32float>,\n"
2221 " coords : vec2<i32>,\n"
2222 " value : vec4<T>)",
2223 ast::Access::kWrite,
2224 ast::ImageFormat::kRgba32Float,
2225 ast::TextureDimension::k2d,
2226 TextureDataType::kF32,
2227 "textureStore",
2228 [](ProgramBuilder* b) {
2229 return b->ExprList("texture", // t
2230 b->vec2<i32>(1, 2), // coords
2231 b->vec4<f32>(3.f, 4.f, 5.f, 6.f)); // value
2232 },
2233 },
2234 {
2235 ValidTextureOverload::kStoreWO2dArrayRgba32float,
2236 "textureStore(t : texture_storage_2d_array<rgba32float>,\n"
2237 " coords : vec2<i32>,\n"
2238 " array_index : i32,\n"
2239 " value : vec4<T>)",
2240 ast::Access::kWrite,
2241 ast::ImageFormat::kRgba32Float,
2242 ast::TextureDimension::k2dArray,
2243 TextureDataType::kF32,
2244 "textureStore",
2245 [](ProgramBuilder* b) {
2246 return b->ExprList("texture", // t
2247 b->vec2<i32>(1, 2), // coords
2248 3, // array_index
2249 b->vec4<f32>(4.f, 5.f, 6.f, 7.f)); // value
2250 },
2251 },
2252 {
2253 ValidTextureOverload::kStoreWO3dRgba32float,
2254 "textureStore(t : texture_storage_3d<rgba32float>,\n"
2255 " coords : vec3<i32>,\n"
2256 " value : vec4<T>)",
2257 ast::Access::kWrite,
2258 ast::ImageFormat::kRgba32Float,
2259 ast::TextureDimension::k3d,
2260 TextureDataType::kF32,
2261 "textureStore",
2262 [](ProgramBuilder* b) {
2263 return b->ExprList("texture", // t
2264 b->vec3<i32>(1, 2, 3), // coords
2265 b->vec4<f32>(4.f, 5.f, 6.f, 7.f)); // value
2266 },
2267 },
2268 };
2269 }
2270
ReturnsVoid(ValidTextureOverload texture_overload)2271 bool ReturnsVoid(ValidTextureOverload texture_overload) {
2272 switch (texture_overload) {
2273 case ValidTextureOverload::kStoreWO1dRgba32float:
2274 case ValidTextureOverload::kStoreWO2dRgba32float:
2275 case ValidTextureOverload::kStoreWO2dArrayRgba32float:
2276 case ValidTextureOverload::kStoreWO3dRgba32float:
2277 return true;
2278 default:
2279 return false;
2280 }
2281 }
2282
2283 } // namespace test
2284 } // namespace intrinsic
2285 } // namespace ast
2286 } // namespace tint
2287