tint/intrinsics: Allow mixing of signed / unsigned integer arguments
Fixed: tint:1733
Change-Id: Id83c5c5a59df062320a9a9fde087a34b85fbaa2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107160
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/test/tint/benchmark/particles.wgsl.expected.glsl b/test/tint/benchmark/particles.wgsl.expected.glsl
index 431b67f..1e8d94b 100644
--- a/test/tint/benchmark/particles.wgsl.expected.glsl
+++ b/test/tint/benchmark/particles.wgsl.expected.glsl
@@ -191,7 +191,7 @@
}
vec2 uv = (vec2(coord) / vec2(uvec2(textureSize(tint_symbol_6, 0))));
particle.position = vec3((((uv - 0.5f) * 3.0f) * vec2(1.0f, -1.0f)), 0.0f);
- particle.color = texelFetch(tint_symbol_6, ivec2(coord), int(0u));
+ particle.color = texelFetch(tint_symbol_6, ivec2(coord), 0);
float tint_symbol_1 = rand();
particle.velocity.x = ((tint_symbol_1 - 0.5f) * 0.100000001f);
float tint_symbol_2 = rand();
diff --git a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl
index 811cc1c..2044cbb 100644
--- a/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl
+++ b/test/tint/bug/tint/534.wgsl.expected.dxc.hlsl
@@ -26,8 +26,8 @@
if ((uniforms[0].x == 1u)) {
srcTexCoord.y = ((size.y - dstTexCoord.y) - 1u);
}
- float4 srcColor = src.Load(uint3(srcTexCoord, 0u));
- float4 dstColor = tint_symbol.Load(uint3(dstTexCoord, 0u));
+ float4 srcColor = src.Load(uint3(srcTexCoord, uint(0)));
+ float4 dstColor = tint_symbol.Load(uint3(dstTexCoord, uint(0)));
bool success = true;
uint4 srcColorBits = uint4(0u, 0u, 0u, 0u);
uint4 dstColorBits = uint4(dstColor);
diff --git a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl
index 811cc1c..2044cbb 100644
--- a/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl
+++ b/test/tint/bug/tint/534.wgsl.expected.fxc.hlsl
@@ -26,8 +26,8 @@
if ((uniforms[0].x == 1u)) {
srcTexCoord.y = ((size.y - dstTexCoord.y) - 1u);
}
- float4 srcColor = src.Load(uint3(srcTexCoord, 0u));
- float4 dstColor = tint_symbol.Load(uint3(dstTexCoord, 0u));
+ float4 srcColor = src.Load(uint3(srcTexCoord, uint(0)));
+ float4 dstColor = tint_symbol.Load(uint3(dstTexCoord, uint(0)));
bool success = true;
uint4 srcColorBits = uint4(0u, 0u, 0u, 0u);
uint4 dstColorBits = uint4(dstColor);
diff --git a/test/tint/bug/tint/534.wgsl.expected.glsl b/test/tint/bug/tint/534.wgsl.expected.glsl
index a0c2e1f..2f905b5 100644
--- a/test/tint/bug/tint/534.wgsl.expected.glsl
+++ b/test/tint/bug/tint/534.wgsl.expected.glsl
@@ -24,8 +24,8 @@
if ((uniforms.dstTextureFlipY == 1u)) {
srcTexCoord.y = ((size.y - dstTexCoord.y) - 1u);
}
- vec4 srcColor = texelFetch(src_1, ivec2(srcTexCoord), int(0u));
- vec4 dstColor = texelFetch(dst_1, ivec2(dstTexCoord), int(0u));
+ vec4 srcColor = texelFetch(src_1, ivec2(srcTexCoord), 0);
+ vec4 dstColor = texelFetch(dst_1, ivec2(dstTexCoord), 0);
bool success = true;
uvec4 srcColorBits = uvec4(0u, 0u, 0u, 0u);
uvec4 dstColorBits = uvec4(dstColor);
diff --git a/test/tint/bug/tint/534.wgsl.expected.msl b/test/tint/bug/tint/534.wgsl.expected.msl
index 04bad3a..37b12cf 100644
--- a/test/tint/bug/tint/534.wgsl.expected.msl
+++ b/test/tint/bug/tint/534.wgsl.expected.msl
@@ -36,8 +36,8 @@
if (((*(tint_symbol_3)).dstTextureFlipY == 1u)) {
srcTexCoord[1] = ((size[1] - dstTexCoord[1]) - 1u);
}
- float4 srcColor = tint_symbol_2.read(uint2(srcTexCoord), 0u);
- float4 dstColor = tint_symbol_4.read(uint2(dstTexCoord), 0u);
+ float4 srcColor = tint_symbol_2.read(uint2(srcTexCoord), 0);
+ float4 dstColor = tint_symbol_4.read(uint2(dstTexCoord), 0);
bool success = true;
uint4 srcColorBits = 0u;
uint4 dstColorBits = uint4(dstColor);
diff --git a/test/tint/bug/tint/534.wgsl.expected.spvasm b/test/tint/bug/tint/534.wgsl.expected.spvasm
index 0839d14..d9b0972 100644
--- a/test/tint/bug/tint/534.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/534.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 133
+; Bound: 134
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
@@ -83,7 +83,7 @@
%bool = OpTypeBool
%_ptr_Function_uint = OpTypePointer Function %uint
%v4float = OpTypeVector %float 4
- %59 = OpConstantNull %uint
+ %59 = OpConstantNull %int
%_ptr_Function_v4float = OpTypePointer Function %v4float
%62 = OpConstantNull %v4float
%true = OpConstantTrue %bool
@@ -92,10 +92,11 @@
%v4uint = OpTypeVector %uint 4
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
%74 = OpConstantNull %v4uint
+ %78 = OpConstantNull %uint
%uint_3 = OpConstant %uint 3
%_ptr_Function_float = OpTypePointer Function %float
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
- %128 = OpTypeFunction %void
+ %129 = OpTypeFunction %void
%ConvertToFp16FloatValue = OpFunction %uint None %17
%fp32 = OpFunctionParameter %float
%20 = OpLabel
@@ -112,8 +113,8 @@
%success = OpVariable %_ptr_Function_bool Function %70
%srcColorBits = OpVariable %_ptr_Function_v4uint Function %74
%dstColorBits = OpVariable %_ptr_Function_v4uint Function %74
- %i = OpVariable %_ptr_Function_uint Function %59
-%outputIndex = OpVariable %_ptr_Function_uint Function %59
+ %i = OpVariable %_ptr_Function_uint Function %78
+%outputIndex = OpVariable %_ptr_Function_uint Function %78
%29 = OpLoad %7 %src
%27 = OpImageQuerySizeLod %v2uint %29 %int_0
OpStore %size %27
@@ -149,77 +150,77 @@
%76 = OpLoad %v4float %dstColor
%75 = OpConvertFToU %v4uint %76
OpStore %dstColorBits %75
- OpStore %i %59
- OpBranch %79
- %79 = OpLabel
- OpLoopMerge %80 %81 None
+ OpStore %i %78
+ OpBranch %80
+ %80 = OpLabel
+ OpLoopMerge %81 %82 None
+ OpBranch %83
+ %83 = OpLabel
+ %85 = OpLoad %uint %i
+ %87 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3
+ %88 = OpLoad %uint %87
+ %89 = OpULessThan %bool %85 %88
+ %84 = OpLogicalNot %bool %89
+ OpSelectionMerge %90 None
+ OpBranchConditional %84 %91 %90
+ %91 = OpLabel
+ OpBranch %81
+ %90 = OpLabel
+ %93 = OpLoad %uint %i
+ %95 = OpAccessChain %_ptr_Function_float %srcColor %93
+ %96 = OpLoad %float %95
+ %92 = OpFunctionCall %uint %ConvertToFp16FloatValue %96
+ %97 = OpLoad %uint %i
+ %98 = OpAccessChain %_ptr_Function_uint %srcColorBits %97
+ OpStore %98 %92
+ %99 = OpLoad %bool %success
+ OpSelectionMerge %100 None
+ OpBranchConditional %99 %101 %100
+ %101 = OpLabel
+ %102 = OpLoad %uint %i
+ %103 = OpAccessChain %_ptr_Function_uint %srcColorBits %102
+ %104 = OpLoad %uint %103
+ %105 = OpLoad %uint %i
+ %106 = OpAccessChain %_ptr_Function_uint %dstColorBits %105
+ %107 = OpLoad %uint %106
+ %108 = OpIEqual %bool %104 %107
+ OpBranch %100
+ %100 = OpLabel
+ %109 = OpPhi %bool %99 %90 %108 %101
+ OpStore %success %109
OpBranch %82
%82 = OpLabel
- %84 = OpLoad %uint %i
- %86 = OpAccessChain %_ptr_Uniform_uint %uniforms %uint_3
- %87 = OpLoad %uint %86
- %88 = OpULessThan %bool %84 %87
- %83 = OpLogicalNot %bool %88
- OpSelectionMerge %89 None
- OpBranchConditional %83 %90 %89
- %90 = OpLabel
+ %110 = OpLoad %uint %i
+ %111 = OpIAdd %uint %110 %uint_1
+ OpStore %i %111
OpBranch %80
- %89 = OpLabel
- %92 = OpLoad %uint %i
- %94 = OpAccessChain %_ptr_Function_float %srcColor %92
- %95 = OpLoad %float %94
- %91 = OpFunctionCall %uint %ConvertToFp16FloatValue %95
- %96 = OpLoad %uint %i
- %97 = OpAccessChain %_ptr_Function_uint %srcColorBits %96
- OpStore %97 %91
- %98 = OpLoad %bool %success
- OpSelectionMerge %99 None
- OpBranchConditional %98 %100 %99
- %100 = OpLabel
- %101 = OpLoad %uint %i
- %102 = OpAccessChain %_ptr_Function_uint %srcColorBits %101
- %103 = OpLoad %uint %102
- %104 = OpLoad %uint %i
- %105 = OpAccessChain %_ptr_Function_uint %dstColorBits %104
- %106 = OpLoad %uint %105
- %107 = OpIEqual %bool %103 %106
- OpBranch %99
- %99 = OpLabel
- %108 = OpPhi %bool %98 %89 %107 %100
- OpStore %success %108
- OpBranch %81
%81 = OpLabel
- %109 = OpLoad %uint %i
- %110 = OpIAdd %uint %109 %uint_1
- OpStore %i %110
- OpBranch %79
- %80 = OpLabel
- %111 = OpCompositeExtract %uint %GlobalInvocationID 1
- %113 = OpAccessChain %_ptr_Function_uint %size %uint_0
- %114 = OpLoad %uint %113
- %115 = OpIMul %uint %111 %114
- %116 = OpCompositeExtract %uint %GlobalInvocationID 0
- %117 = OpIAdd %uint %115 %116
- OpStore %outputIndex %117
- %119 = OpLoad %bool %success
- OpSelectionMerge %120 None
- OpBranchConditional %119 %121 %122
- %121 = OpLabel
- %123 = OpLoad %uint %outputIndex
- %125 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %123
- OpStore %125 %uint_1
- OpBranch %120
+ %112 = OpCompositeExtract %uint %GlobalInvocationID 1
+ %114 = OpAccessChain %_ptr_Function_uint %size %uint_0
+ %115 = OpLoad %uint %114
+ %116 = OpIMul %uint %112 %115
+ %117 = OpCompositeExtract %uint %GlobalInvocationID 0
+ %118 = OpIAdd %uint %116 %117
+ OpStore %outputIndex %118
+ %120 = OpLoad %bool %success
+ OpSelectionMerge %121 None
+ OpBranchConditional %120 %122 %123
%122 = OpLabel
- %126 = OpLoad %uint %outputIndex
- %127 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %126
- OpStore %127 %59
- OpBranch %120
- %120 = OpLabel
+ %124 = OpLoad %uint %outputIndex
+ %126 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %124
+ OpStore %126 %uint_1
+ OpBranch %121
+ %123 = OpLabel
+ %127 = OpLoad %uint %outputIndex
+ %128 = OpAccessChain %_ptr_StorageBuffer_uint %output %uint_0 %127
+ OpStore %128 %78
+ OpBranch %121
+ %121 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %128
- %130 = OpLabel
- %132 = OpLoad %v3uint %GlobalInvocationID_1
- %131 = OpFunctionCall %void %main_inner %132
+ %main = OpFunction %void None %129
+ %131 = OpLabel
+ %133 = OpLoad %v3uint %GlobalInvocationID_1
+ %132 = OpFunctionCall %void %main_inner %133
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl
index 6d12c78..0f6d84c 100644
--- a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: u32) -> vec4<f32>
fn textureGather_17baac() {
- var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u);
+ var res: vec4<f32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.glsl
index 25e22eb..e180946 100644
--- a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.glsl
@@ -3,7 +3,7 @@
uniform highp sampler2DArray arg_1_arg_2;
void textureGather_17baac() {
- vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
vec4 vertex_main() {
@@ -25,7 +25,7 @@
uniform highp sampler2DArray arg_1_arg_2;
void textureGather_17baac() {
- vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
void fragment_main() {
@@ -41,7 +41,7 @@
uniform highp sampler2DArray arg_1_arg_2;
void textureGather_17baac() {
- vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.spvasm
index 3e3e581..7734fec 100644
--- a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 46
+; Bound: 48
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -47,8 +47,10 @@
%float_0 = OpConstant %float 0
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %32 = OpTypeFunction %v4float
+ %34 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_17baac = OpFunction %void None %15
%18 = OpLabel
@@ -58,29 +60,29 @@
%23 = OpSampledImage %22 %21 %20
%26 = OpConvertUToF %float %uint_1
%29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
- %19 = OpImageGather %v4float %23 %29 %uint_1
+ %19 = OpImageGather %v4float %23 %29 %int_1
OpStore %res %19
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %32
- %34 = OpLabel
- %35 = OpFunctionCall %void %textureGather_17baac
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureGather_17baac
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %15
- %37 = OpLabel
- %38 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %38
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
- %41 = OpLabel
- %42 = OpFunctionCall %void %textureGather_17baac
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureGather_17baac
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
- %44 = OpLabel
- %45 = OpFunctionCall %void %textureGather_17baac
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_17baac
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.wgsl
index 52cc99b..9735392 100644
--- a/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/17baac.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_17baac() {
- var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u);
+ var res : vec4<f32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl
new file mode 100644
index 0000000..7d9468c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_24b0bd() {
+ var res: vec4<f32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_24b0bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_24b0bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_24b0bd();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..68596e1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_24b0bd() {
+ float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_24b0bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_24b0bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_24b0bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..68596e1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_24b0bd() {
+ float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_24b0bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_24b0bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_24b0bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.glsl
new file mode 100644
index 0000000..ee71f66
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_24b0bd() {
+ vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_24b0bd();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_24b0bd() {
+ vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_24b0bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_24b0bd() {
+ vec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+void compute_main() {
+ textureGather_24b0bd();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.msl
new file mode 100644
index 0000000..0cc11c3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_24b0bd(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_24b0bd(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_24b0bd(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_24b0bd(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..a3a420b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_24b0bd "textureGather_24b0bd"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %22 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_24b0bd = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %20 = OpLoad %14 %arg_2
+ %21 = OpLoad %11 %arg_1
+ %23 = OpSampledImage %22 %21 %20
+ %26 = OpConvertSToF %float %int_1
+ %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
+ %19 = OpImageGather %v4float %23 %29 %uint_1
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureGather_24b0bd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureGather_24b0bd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_24b0bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..46c8b4d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/24b0bd.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_24b0bd() {
+ var res : vec4<f32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_24b0bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_24b0bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_24b0bd();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl b/test/tint/builtins/gen/literal/textureGather/445793.wgsl
new file mode 100644
index 0000000..2ad1513
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<i32>
+fn textureGather_445793() {
+ var res: vec4<i32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_445793();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_445793();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_445793();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..286350f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_445793() {
+ int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_445793();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_445793();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_445793();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..286350f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_445793() {
+ int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_445793();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_445793();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_445793();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.glsl
new file mode 100644
index 0000000..a39af11
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_445793() {
+ ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_445793();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_445793() {
+ ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_445793();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_445793() {
+ ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+void compute_main() {
+ textureGather_445793();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.msl
new file mode 100644
index 0000000..a194b15
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_445793(texture2d_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_445793(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_445793(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_445793(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.spvasm
new file mode 100644
index 0000000..4af17b3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_445793 "textureGather_445793"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %24 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %35 = OpConstantNull %v4int
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_445793 = OpFunction %void None %16
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %35
+ %22 = OpLoad %15 %arg_2
+ %23 = OpLoad %11 %arg_1
+ %25 = OpSampledImage %24 %23 %22
+ %28 = OpConvertSToF %float %int_1
+ %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28
+ %20 = OpImageGather %v4int %25 %30 %uint_1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_445793
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_445793
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_445793
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.wgsl
new file mode 100644
index 0000000..93e20ca
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/445793.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_445793() {
+ var res : vec4<i32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_445793();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_445793();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_445793();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl
index 851446a..974421c 100644
--- a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: u32) -> vec4<i32>
fn textureGather_4e8ac5() {
- var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u);
+ var res: vec4<i32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.glsl
index cc5ccde..8495304 100644
--- a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.glsl
@@ -3,7 +3,7 @@
uniform highp isampler2DArray arg_1_arg_2;
void textureGather_4e8ac5() {
- ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
vec4 vertex_main() {
@@ -25,7 +25,7 @@
uniform highp isampler2DArray arg_1_arg_2;
void textureGather_4e8ac5() {
- ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
void fragment_main() {
@@ -41,7 +41,7 @@
uniform highp isampler2DArray arg_1_arg_2;
void textureGather_4e8ac5() {
- ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.spvasm
index 452ff4f..c7ac20a 100644
--- a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 50
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -49,41 +49,42 @@
%float_0 = OpConstant %float 0
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4int = OpTypePointer Function %v4int
- %34 = OpConstantNull %v4int
- %35 = OpTypeFunction %v4float
+ %35 = OpConstantNull %v4int
+ %36 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_4e8ac5 = OpFunction %void None %16
%19 = OpLabel
- %res = OpVariable %_ptr_Function_v4int Function %34
+ %res = OpVariable %_ptr_Function_v4int Function %35
%22 = OpLoad %15 %arg_2
%23 = OpLoad %11 %arg_1
%25 = OpSampledImage %24 %23 %22
%28 = OpConvertUToF %float %uint_1
%31 = OpCompositeConstruct %v3float %float_0 %float_0 %28
- %20 = OpImageGather %v4int %25 %31 %uint_1
+ %20 = OpImageGather %v4int %25 %31 %int_1
OpStore %res %20
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %35
- %37 = OpLabel
- %38 = OpFunctionCall %void %textureGather_4e8ac5
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_4e8ac5
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %40 = OpLabel
- %41 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %41
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %44 = OpLabel
- %45 = OpFunctionCall %void %textureGather_4e8ac5
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_4e8ac5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %47 = OpLabel
- %48 = OpFunctionCall %void %textureGather_4e8ac5
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_4e8ac5
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.wgsl
index 650b75d..20cd25b 100644
--- a/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/4e8ac5.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_4e8ac5() {
- var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u);
+ var res : vec4<i32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl
index 7655962..afea32f 100644
--- a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: u32, @const offset: vec2<i32>) -> vec4<f32>
fn textureGather_59372a() {
- var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
+ var res: vec4<f32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.glsl
index c6455a3..dd6f659 100644
--- a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.glsl
@@ -3,7 +3,7 @@
uniform highp sampler2DArray arg_1_arg_2;
void textureGather_59372a() {
- vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
vec4 vertex_main() {
@@ -25,7 +25,7 @@
uniform highp sampler2DArray arg_1_arg_2;
void textureGather_59372a() {
- vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
void fragment_main() {
@@ -41,7 +41,7 @@
uniform highp sampler2DArray arg_1_arg_2;
void textureGather_59372a() {
- vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.spvasm
index 5aaf916..5a520aa 100644
--- a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 49
+; Bound: 50
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -48,10 +48,11 @@
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%v2int = OpTypeVector %int 2
- %32 = OpConstantNull %v2int
+ %33 = OpConstantNull %v2int
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %35 = OpTypeFunction %v4float
+ %36 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_59372a = OpFunction %void None %15
%18 = OpLabel
@@ -61,29 +62,29 @@
%23 = OpSampledImage %22 %21 %20
%26 = OpConvertUToF %float %uint_1
%29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
- %19 = OpImageGather %v4float %23 %29 %uint_1 ConstOffset %32
+ %19 = OpImageGather %v4float %23 %29 %int_1 ConstOffset %33
OpStore %res %19
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %35
- %37 = OpLabel
- %38 = OpFunctionCall %void %textureGather_59372a
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_59372a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %15
- %40 = OpLabel
- %41 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %41
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
- %44 = OpLabel
- %45 = OpFunctionCall %void %textureGather_59372a
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_59372a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
- %47 = OpLabel
- %48 = OpFunctionCall %void %textureGather_59372a
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_59372a
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.wgsl
index ba0ecac..e558dea 100644
--- a/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/59372a.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_59372a() {
- var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
+ var res : vec4<f32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/788010.wgsl b/test/tint/builtins/gen/literal/textureGather/788010.wgsl
index bec214c..da9987d 100644
--- a/test/tint/builtins/gen/literal/textureGather/788010.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/788010.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_cube_array<i32>, sampler: sampler, coords: vec3<f32>, array_index: u32) -> vec4<i32>
fn textureGather_788010() {
- var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1u);
+ var res: vec4<i32> = textureGather(1i, arg_1, arg_2, vec3<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.glsl
index 9f39bc6..e22bd90 100644
--- a/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.glsl
@@ -5,7 +5,7 @@
uniform highp isamplerCubeArray arg_1_arg_2;
void textureGather_788010() {
- ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
vec4 vertex_main() {
@@ -34,7 +34,7 @@
uniform highp isamplerCubeArray arg_1_arg_2;
void textureGather_788010() {
- ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
void fragment_main() {
@@ -57,7 +57,7 @@
uniform highp isamplerCubeArray arg_1_arg_2;
void textureGather_788010() {
- ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.spvasm
index 420fdeb..c699707 100644
--- a/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 49
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -49,41 +49,42 @@
%float_0 = OpConstant %float 0
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4int = OpTypePointer Function %v4int
- %33 = OpConstantNull %v4int
- %34 = OpTypeFunction %v4float
+ %34 = OpConstantNull %v4int
+ %35 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_788010 = OpFunction %void None %16
%19 = OpLabel
- %res = OpVariable %_ptr_Function_v4int Function %33
+ %res = OpVariable %_ptr_Function_v4int Function %34
%22 = OpLoad %15 %arg_2
%23 = OpLoad %11 %arg_1
%25 = OpSampledImage %24 %23 %22
%27 = OpConvertUToF %float %uint_1
%30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27
- %20 = OpImageGather %v4int %25 %30 %uint_1
+ %20 = OpImageGather %v4int %25 %30 %int_1
OpStore %res %20
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %34
- %36 = OpLabel
- %37 = OpFunctionCall %void %textureGather_788010
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_788010
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %39 = OpLabel
- %40 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %40
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %43 = OpLabel
- %44 = OpFunctionCall %void %textureGather_788010
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureGather_788010
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %46 = OpLabel
- %47 = OpFunctionCall %void %textureGather_788010
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_788010
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.wgsl
index 1dbb53f..dec67b9 100644
--- a/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/788010.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_788010() {
- var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1u);
+ var res : vec4<i32> = textureGather(1i, arg_1, arg_2, vec3<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/829357.wgsl b/test/tint/builtins/gen/literal/textureGather/829357.wgsl
index 154c598..be8e1e5 100644
--- a/test/tint/builtins/gen/literal/textureGather/829357.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/829357.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: u32) -> vec4<f32>
fn textureGather_829357() {
- var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1u);
+ var res: vec4<f32> = textureGather(1i, arg_1, arg_2, vec3<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.glsl
index 083b9ac..32ae841 100644
--- a/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.glsl
@@ -5,7 +5,7 @@
uniform highp samplerCubeArray arg_1_arg_2;
void textureGather_829357() {
- vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
vec4 vertex_main() {
@@ -34,7 +34,7 @@
uniform highp samplerCubeArray arg_1_arg_2;
void textureGather_829357() {
- vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
void fragment_main() {
@@ -57,7 +57,7 @@
uniform highp samplerCubeArray arg_1_arg_2;
void textureGather_829357() {
- vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.spvasm
index 0a4125b..ee1c7cc 100644
--- a/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 45
+; Bound: 47
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -47,8 +47,10 @@
%float_0 = OpConstant %float 0
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %31 = OpTypeFunction %v4float
+ %33 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_829357 = OpFunction %void None %15
%18 = OpLabel
@@ -58,29 +60,29 @@
%23 = OpSampledImage %22 %21 %20
%25 = OpConvertUToF %float %uint_1
%28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25
- %19 = OpImageGather %v4float %23 %28 %uint_1
+ %19 = OpImageGather %v4float %23 %28 %int_1
OpStore %res %19
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %31
- %33 = OpLabel
- %34 = OpFunctionCall %void %textureGather_829357
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureGather_829357
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %15
- %36 = OpLabel
- %37 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %37
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
- %40 = OpLabel
- %41 = OpFunctionCall %void %textureGather_829357
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureGather_829357
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
- %43 = OpLabel
- %44 = OpFunctionCall %void %textureGather_829357
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_829357
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.wgsl
index 475719e..f7c7885 100644
--- a/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/829357.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_829357() {
- var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1u);
+ var res : vec4<f32> = textureGather(1i, arg_1, arg_2, vec3<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl b/test/tint/builtins/gen/literal/textureGather/831549.wgsl
new file mode 100644
index 0000000..26bbdfe
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGather_831549() {
+ var res: vec4<f32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_831549();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_831549();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_831549();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b4df239
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_831549() {
+ float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_831549();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_831549();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_831549();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b4df239
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_831549() {
+ float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_831549();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_831549();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_831549();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.glsl
new file mode 100644
index 0000000..49e6ad0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_831549() {
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_831549();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_831549() {
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureGather_831549();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_831549() {
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureGather_831549();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.msl
new file mode 100644
index 0000000..5f2d880
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_831549(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_831549(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_831549(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_831549(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.spvasm
new file mode 100644
index 0000000..bba13c2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_831549 "textureGather_831549"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %22 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %33 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_831549 = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %20 = OpLoad %14 %arg_2
+ %21 = OpLoad %11 %arg_1
+ %23 = OpSampledImage %22 %21 %20
+ %26 = OpConvertSToF %float %int_1
+ %29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
+ %19 = OpImageGather %v4float %23 %29 %uint_1 ConstOffset %33
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_831549
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_831549
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_831549
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.wgsl
new file mode 100644
index 0000000..45ab25d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/831549.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_831549() {
+ var res : vec4<f32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_831549();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_831549();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_831549();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl
new file mode 100644
index 0000000..aa35c72
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<u32>
+fn textureGather_92ea47() {
+ var res: vec4<u32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_92ea47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_92ea47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_92ea47();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a5de000
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_92ea47() {
+ uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_92ea47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_92ea47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_92ea47();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a5de000
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_92ea47() {
+ uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_92ea47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_92ea47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_92ea47();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.glsl
new file mode 100644
index 0000000..33de790
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_92ea47() {
+ uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_92ea47();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_92ea47() {
+ uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_92ea47();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_92ea47() {
+ uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), int(1u));
+}
+
+void compute_main() {
+ textureGather_92ea47();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.msl
new file mode 100644
index 0000000..f6c3e37
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_92ea47(texture2d_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_92ea47(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_92ea47(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_92ea47(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.spvasm
new file mode 100644
index 0000000..48e9c34
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_92ea47 "textureGather_92ea47"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %24 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %35 = OpConstantNull %v4uint
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_92ea47 = OpFunction %void None %16
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %35
+ %22 = OpLoad %15 %arg_2
+ %23 = OpLoad %11 %arg_1
+ %25 = OpSampledImage %24 %23 %22
+ %28 = OpConvertSToF %float %int_1
+ %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28
+ %20 = OpImageGather %v4uint %25 %31 %uint_1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_92ea47
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_92ea47
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_92ea47
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.wgsl
new file mode 100644
index 0000000..501d2df
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/92ea47.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_92ea47() {
+ var res : vec4<u32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_92ea47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_92ea47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_92ea47();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl
new file mode 100644
index 0000000..5cc0342
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<i32>
+fn textureGather_9ab41e() {
+ var res: vec4<i32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_9ab41e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_9ab41e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_9ab41e();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d13137c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_9ab41e() {
+ int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_9ab41e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_9ab41e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_9ab41e();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d13137c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_9ab41e() {
+ int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_9ab41e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_9ab41e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_9ab41e();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.glsl
new file mode 100644
index 0000000..a6d26d4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_9ab41e() {
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_9ab41e();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_9ab41e() {
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureGather_9ab41e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_9ab41e() {
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureGather_9ab41e();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.msl
new file mode 100644
index 0000000..3af8f5c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_9ab41e(texture2d_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ int4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_9ab41e(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_9ab41e(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_9ab41e(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.spvasm
new file mode 100644
index 0000000..d9af9f6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_9ab41e "textureGather_9ab41e"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %24 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %34 = OpConstantNull %v2int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %37 = OpConstantNull %v4int
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_9ab41e = OpFunction %void None %16
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %37
+ %22 = OpLoad %15 %arg_2
+ %23 = OpLoad %11 %arg_1
+ %25 = OpSampledImage %24 %23 %22
+ %28 = OpConvertSToF %float %int_1
+ %30 = OpCompositeConstruct %v3float %float_0 %float_0 %28
+ %20 = OpImageGather %v4int %25 %30 %uint_1 ConstOffset %34
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureGather_9ab41e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_9ab41e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_9ab41e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.wgsl
new file mode 100644
index 0000000..71d70bf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/9ab41e.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_9ab41e() {
+ var res : vec4<i32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_9ab41e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_9ab41e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_9ab41e();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl
index 4eca3a2..16deb12 100644
--- a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: u32) -> vec4<u32>
fn textureGather_a0372b() {
- var res: vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u);
+ var res: vec4<u32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.glsl
index 4d3163e..5be694b 100644
--- a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.glsl
@@ -3,7 +3,7 @@
uniform highp usampler2DArray arg_1_arg_2;
void textureGather_a0372b() {
- uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
vec4 vertex_main() {
@@ -25,7 +25,7 @@
uniform highp usampler2DArray arg_1_arg_2;
void textureGather_a0372b() {
- uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
void fragment_main() {
@@ -41,7 +41,7 @@
uniform highp usampler2DArray arg_1_arg_2;
void textureGather_a0372b() {
- uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.spvasm
index 67068b3..d90e3ce 100644
--- a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 48
+; Bound: 50
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -48,41 +48,43 @@
%v3float = OpTypeVector %float 3
%float_0 = OpConstant %float 0
%uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
- %33 = OpConstantNull %v4uint
- %34 = OpTypeFunction %v4float
+ %35 = OpConstantNull %v4uint
+ %36 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_a0372b = OpFunction %void None %16
%19 = OpLabel
- %res = OpVariable %_ptr_Function_v4uint Function %33
+ %res = OpVariable %_ptr_Function_v4uint Function %35
%22 = OpLoad %15 %arg_2
%23 = OpLoad %11 %arg_1
%25 = OpSampledImage %24 %23 %22
%28 = OpConvertUToF %float %uint_1
%30 = OpCompositeConstruct %v3float %float_0 %float_0 %28
- %20 = OpImageGather %v4uint %25 %30 %uint_1
+ %20 = OpImageGather %v4uint %25 %30 %int_1
OpStore %res %20
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %34
- %36 = OpLabel
- %37 = OpFunctionCall %void %textureGather_a0372b
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_a0372b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %39 = OpLabel
- %40 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %40
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %43 = OpLabel
- %44 = OpFunctionCall %void %textureGather_a0372b
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_a0372b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %46 = OpLabel
- %47 = OpFunctionCall %void %textureGather_a0372b
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_a0372b
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.wgsl
index b4702b1..cb4dd68 100644
--- a/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/a0372b.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_a0372b() {
- var res : vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u);
+ var res : vec4<u32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl
new file mode 100644
index 0000000..a80c3db
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube_array<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_cube_array<i32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<i32>
+fn textureGather_aaf6bd() {
+ var res: vec4<i32> = textureGather(1u, arg_1, arg_2, vec3<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_aaf6bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_aaf6bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_aaf6bd();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b7a7ebd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_aaf6bd() {
+ int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_aaf6bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_aaf6bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_aaf6bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b7a7ebd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_aaf6bd() {
+ int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_aaf6bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_aaf6bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_aaf6bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.glsl
new file mode 100644
index 0000000..0ab379a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_aaf6bd() {
+ ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_aaf6bd();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_aaf6bd() {
+ ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_aaf6bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'isamplerCubeArray' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_aaf6bd() {
+ ivec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+void compute_main() {
+ textureGather_aaf6bd();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.msl
new file mode 100644
index 0000000..e738ae2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_aaf6bd(texturecube_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ int4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_aaf6bd(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texturecube_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_aaf6bd(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_aaf6bd(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..6f938f5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_aaf6bd "textureGather_aaf6bd"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %24 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %34 = OpConstantNull %v4int
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_aaf6bd = OpFunction %void None %16
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %34
+ %22 = OpLoad %15 %arg_2
+ %23 = OpLoad %11 %arg_1
+ %25 = OpSampledImage %24 %23 %22
+ %27 = OpConvertSToF %float %int_1
+ %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27
+ %20 = OpImageGather %v4int %25 %29 %uint_1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_aaf6bd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureGather_aaf6bd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_aaf6bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..6d9a186
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/aaf6bd.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_aaf6bd() {
+ var res : vec4<i32> = textureGather(1u, arg_1, arg_2, vec3<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_aaf6bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_aaf6bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_aaf6bd();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl
index d2e5f2f..c750140 100644
--- a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: u32, @const offset: vec2<i32>) -> vec4<i32>
fn textureGather_bd33b6() {
- var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
+ var res: vec4<i32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.glsl
index 3b5c9e8..54aa26c 100644
--- a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.glsl
@@ -3,7 +3,7 @@
uniform highp isampler2DArray arg_1_arg_2;
void textureGather_bd33b6() {
- ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
vec4 vertex_main() {
@@ -25,7 +25,7 @@
uniform highp isampler2DArray arg_1_arg_2;
void textureGather_bd33b6() {
- ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
void fragment_main() {
@@ -41,7 +41,7 @@
uniform highp isampler2DArray arg_1_arg_2;
void textureGather_bd33b6() {
- ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.spvasm
index f3347b1..7d11614 100644
--- a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 52
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -49,43 +49,44 @@
%float_0 = OpConstant %float 0
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
%v2int = OpTypeVector %int 2
- %33 = OpConstantNull %v2int
+ %34 = OpConstantNull %v2int
%_ptr_Function_v4int = OpTypePointer Function %v4int
- %36 = OpConstantNull %v4int
- %37 = OpTypeFunction %v4float
+ %37 = OpConstantNull %v4int
+ %38 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_bd33b6 = OpFunction %void None %16
%19 = OpLabel
- %res = OpVariable %_ptr_Function_v4int Function %36
+ %res = OpVariable %_ptr_Function_v4int Function %37
%22 = OpLoad %15 %arg_2
%23 = OpLoad %11 %arg_1
%25 = OpSampledImage %24 %23 %22
%28 = OpConvertUToF %float %uint_1
%31 = OpCompositeConstruct %v3float %float_0 %float_0 %28
- %20 = OpImageGather %v4int %25 %31 %uint_1 ConstOffset %33
+ %20 = OpImageGather %v4int %25 %31 %int_1 ConstOffset %34
OpStore %res %20
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %37
- %39 = OpLabel
- %40 = OpFunctionCall %void %textureGather_bd33b6
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureGather_bd33b6
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %42 = OpLabel
- %43 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %43
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %46 = OpLabel
- %47 = OpFunctionCall %void %textureGather_bd33b6
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_bd33b6
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %49 = OpLabel
- %50 = OpFunctionCall %void %textureGather_bd33b6
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_bd33b6
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.wgsl
index 1993fea..2f8357e 100644
--- a/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/bd33b6.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_bd33b6() {
- var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
+ var res : vec4<i32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl
index 2928b32..ac220e7 100644
--- a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_cube_array<u32>, sampler: sampler, coords: vec3<f32>, array_index: u32) -> vec4<u32>
fn textureGather_be276f() {
- var res: vec4<u32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1u);
+ var res: vec4<u32> = textureGather(1i, arg_1, arg_2, vec3<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.glsl
index 025d258..58ea7cf 100644
--- a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.glsl
@@ -5,7 +5,7 @@
uniform highp usamplerCubeArray arg_1_arg_2;
void textureGather_be276f() {
- uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
vec4 vertex_main() {
@@ -34,7 +34,7 @@
uniform highp usamplerCubeArray arg_1_arg_2;
void textureGather_be276f() {
- uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
void fragment_main() {
@@ -57,7 +57,7 @@
uniform highp usamplerCubeArray arg_1_arg_2;
void textureGather_be276f() {
- uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1u)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.spvasm
index 22b7575..a9063fa 100644
--- a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 47
+; Bound: 49
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -48,41 +48,43 @@
%24 = OpTypeSampledImage %11
%float_0 = OpConstant %float 0
%uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
- %32 = OpConstantNull %v4uint
- %33 = OpTypeFunction %v4float
+ %34 = OpConstantNull %v4uint
+ %35 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_be276f = OpFunction %void None %16
%19 = OpLabel
- %res = OpVariable %_ptr_Function_v4uint Function %32
+ %res = OpVariable %_ptr_Function_v4uint Function %34
%22 = OpLoad %15 %arg_2
%23 = OpLoad %11 %arg_1
%25 = OpSampledImage %24 %23 %22
%27 = OpConvertUToF %float %uint_1
%29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27
- %20 = OpImageGather %v4uint %25 %29 %uint_1
+ %20 = OpImageGather %v4uint %25 %29 %int_1
OpStore %res %20
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %33
- %35 = OpLabel
- %36 = OpFunctionCall %void %textureGather_be276f
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_be276f
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %38 = OpLabel
- %39 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %39
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %42 = OpLabel
- %43 = OpFunctionCall %void %textureGather_be276f
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureGather_be276f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %45 = OpLabel
- %46 = OpFunctionCall %void %textureGather_be276f
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_be276f
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.wgsl
index c14626e..3067707 100644
--- a/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/be276f.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_be276f() {
- var res : vec4<u32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1u);
+ var res : vec4<u32> = textureGather(1i, arg_1, arg_2, vec3<f32>(), 1u);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl
index 9ab7bfc..6eea4f2 100644
--- a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: u32, @const offset: vec2<i32>) -> vec4<u32>
fn textureGather_ce5578() {
- var res: vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
+ var res: vec4<u32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.glsl
index 001c3b0..9facfd7 100644
--- a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.glsl
@@ -3,7 +3,7 @@
uniform highp usampler2DArray arg_1_arg_2;
void textureGather_ce5578() {
- uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
vec4 vertex_main() {
@@ -25,7 +25,7 @@
uniform highp usampler2DArray arg_1_arg_2;
void textureGather_ce5578() {
- uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
void fragment_main() {
@@ -41,7 +41,7 @@
uniform highp usampler2DArray arg_1_arg_2;
void textureGather_ce5578() {
- uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), int(1u));
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1u)), ivec2(0), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.spvasm
index 367be56..92777fb 100644
--- a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 51
+; Bound: 52
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -49,43 +49,44 @@
%float_0 = OpConstant %float 0
%uint_1 = OpConstant %uint 1
%int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%v2int = OpTypeVector %int 2
- %33 = OpConstantNull %v2int
+ %34 = OpConstantNull %v2int
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
- %36 = OpConstantNull %v4uint
- %37 = OpTypeFunction %v4float
+ %37 = OpConstantNull %v4uint
+ %38 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_ce5578 = OpFunction %void None %16
%19 = OpLabel
- %res = OpVariable %_ptr_Function_v4uint Function %36
+ %res = OpVariable %_ptr_Function_v4uint Function %37
%22 = OpLoad %15 %arg_2
%23 = OpLoad %11 %arg_1
%25 = OpSampledImage %24 %23 %22
%28 = OpConvertUToF %float %uint_1
%30 = OpCompositeConstruct %v3float %float_0 %float_0 %28
- %20 = OpImageGather %v4uint %25 %30 %uint_1 ConstOffset %33
+ %20 = OpImageGather %v4uint %25 %30 %int_1 ConstOffset %34
OpStore %res %20
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %37
- %39 = OpLabel
- %40 = OpFunctionCall %void %textureGather_ce5578
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureGather_ce5578
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %42 = OpLabel
- %43 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %43
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %46 = OpLabel
- %47 = OpFunctionCall %void %textureGather_ce5578
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_ce5578
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %49 = OpLabel
- %50 = OpFunctionCall %void %textureGather_ce5578
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_ce5578
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.wgsl
index f07251c..d923193 100644
--- a/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/textureGather/ce5578.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_ce5578() {
- var res : vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
+ var res : vec4<u32> = textureGather(1i, arg_1, arg_2, vec2<f32>(), 1u, vec2<i32>());
}
@vertex
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl
new file mode 100644
index 0000000..418dd84
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube_array<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_cube_array<u32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<u32>
+fn textureGather_d4b5c6() {
+ var res: vec4<u32> = textureGather(1u, arg_1, arg_2, vec3<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d4b5c6();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d4b5c6();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d4b5c6();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e433e9f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d4b5c6() {
+ uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d4b5c6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d4b5c6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d4b5c6();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e433e9f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d4b5c6() {
+ uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d4b5c6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d4b5c6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d4b5c6();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.glsl
new file mode 100644
index 0000000..09738fa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_d4b5c6() {
+ uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_d4b5c6();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_d4b5c6() {
+ uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_d4b5c6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'usamplerCubeArray' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_d4b5c6() {
+ uvec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+void compute_main() {
+ textureGather_d4b5c6();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.msl
new file mode 100644
index 0000000..bc0c651
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_d4b5c6(texturecube_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_d4b5c6(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texturecube_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_d4b5c6(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_d4b5c6(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.spvasm
new file mode 100644
index 0000000..1a021e7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_d4b5c6 "textureGather_d4b5c6"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %24 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %34 = OpConstantNull %v4uint
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_d4b5c6 = OpFunction %void None %16
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %34
+ %22 = OpLoad %15 %arg_2
+ %23 = OpLoad %11 %arg_1
+ %25 = OpSampledImage %24 %23 %22
+ %27 = OpConvertSToF %float %int_1
+ %30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27
+ %20 = OpImageGather %v4uint %25 %30 %uint_1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_d4b5c6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureGather_d4b5c6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_d4b5c6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.wgsl
new file mode 100644
index 0000000..5d58e82
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d4b5c6.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_d4b5c6() {
+ var res : vec4<u32> = textureGather(1u, arg_1, arg_2, vec3<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d4b5c6();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d4b5c6();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d4b5c6();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl
new file mode 100644
index 0000000..b78c342
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube_array<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_d98d59() {
+ var res: vec4<f32> = textureGather(1u, arg_1, arg_2, vec3<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d98d59();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d98d59();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d98d59();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..10e683d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d98d59() {
+ float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d98d59();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d98d59();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d98d59();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..10e683d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d98d59() {
+ float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d98d59();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d98d59();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d98d59();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.glsl
new file mode 100644
index 0000000..db13502
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_d98d59() {
+ vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_d98d59();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_d98d59() {
+ vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_d98d59();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'samplerCubeArray' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_d98d59() {
+ vec4 res = textureGather(arg_1_arg_2, vec4(0.0f, 0.0f, 0.0f, float(1)), int(1u));
+}
+
+void compute_main() {
+ textureGather_d98d59();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.msl
new file mode 100644
index 0000000..ca2a849
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_d98d59(texturecube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float4 res = tint_symbol_1.gather(tint_symbol_2, float3(0.0f), 1, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_d98d59(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texturecube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_d98d59(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_d98d59(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.spvasm
new file mode 100644
index 0000000..88ac5d0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_d98d59 "textureGather_d98d59"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %22 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_d98d59 = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %20 = OpLoad %14 %arg_2
+ %21 = OpLoad %11 %arg_1
+ %23 = OpSampledImage %22 %21 %20
+ %25 = OpConvertSToF %float %int_1
+ %28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25
+ %19 = OpImageGather %v4float %23 %28 %uint_1
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureGather_d98d59
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureGather_d98d59
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_d98d59
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.wgsl
new file mode 100644
index 0000000..87129c2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/d98d59.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_d98d59() {
+ var res : vec4<f32> = textureGather(1u, arg_1, arg_2, vec3<f32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d98d59();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d98d59();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d98d59();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl
new file mode 100644
index 0000000..f1fc888
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<u32>
+fn textureGather_e3165f() {
+ var res: vec4<u32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_e3165f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_e3165f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_e3165f();
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e5afb5c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_e3165f() {
+ uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_e3165f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_e3165f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_e3165f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e5afb5c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_e3165f() {
+ uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_e3165f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_e3165f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_e3165f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.glsl
new file mode 100644
index 0000000..914af11
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_e3165f() {
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_e3165f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_e3165f() {
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureGather_e3165f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_e3165f() {
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(0.0f, 0.0f, float(1)), ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureGather_e3165f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.msl
new file mode 100644
index 0000000..12b0c1d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_e3165f(texture2d_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(0.0f), 1, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_e3165f(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_e3165f(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_e3165f(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.spvasm
new file mode 100644
index 0000000..4438901
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_e3165f "textureGather_e3165f"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %24 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %34 = OpConstantNull %v2int
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %37 = OpConstantNull %v4uint
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_e3165f = OpFunction %void None %16
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %37
+ %22 = OpLoad %15 %arg_2
+ %23 = OpLoad %11 %arg_1
+ %25 = OpSampledImage %24 %23 %22
+ %28 = OpConvertSToF %float %int_1
+ %31 = OpCompositeConstruct %v3float %float_0 %float_0 %28
+ %20 = OpImageGather %v4uint %25 %31 %uint_1 ConstOffset %34
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureGather_e3165f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_e3165f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_e3165f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.wgsl
new file mode 100644
index 0000000..9f1dab6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureGather/e3165f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_e3165f() {
+ var res : vec4<u32> = textureGather(1u, arg_1, arg_2, vec2<f32>(), 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_e3165f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_e3165f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_e3165f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl
new file mode 100644
index 0000000..5f879ee
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureLoad(texture: texture_3d<f32>, coords: vec3<i32>, level: u32) -> vec4<f32>
+fn textureLoad_019da0() {
+ var res: vec4<f32> = textureLoad(arg_0, vec3<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_019da0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_019da0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_019da0();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..170fe3b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_019da0() {
+ float4 res = arg_0.Load(int4(0, 0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_019da0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_019da0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_019da0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..170fe3b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_019da0() {
+ float4 res = arg_0.Load(int4(0, 0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_019da0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_019da0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_019da0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.glsl
new file mode 100644
index 0000000..faaf797
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_019da0() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_019da0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_019da0() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_019da0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_019da0() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_019da0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.msl
new file mode 100644
index 0000000..045982a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_019da0(texture3d<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint3(int3(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureLoad_019da0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_019da0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_019da0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.spvasm
new file mode 100644
index 0000000..eb8a7d1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_019da0 "textureLoad_019da0"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %20 = OpConstantNull %v3int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_019da0 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %20 Lod %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureLoad_019da0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_019da0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_019da0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.wgsl
new file mode 100644
index 0000000..bff3b36
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/019da0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureLoad_019da0() {
+ var res : vec4<f32> = textureLoad(arg_0, vec3<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_019da0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_019da0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_019da0();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl
new file mode 100644
index 0000000..4a46227
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<u32>, array_index: u32, level: i32) -> vec4<u32>
+fn textureLoad_026217() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_026217();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_026217();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_026217();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5deed86
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_026217() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, 1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_026217();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_026217();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_026217();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5deed86
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_026217() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, 1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_026217();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_026217();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_026217();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.glsl
new file mode 100644
index 0000000..4647792
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_026217() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_026217();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_026217() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_026217();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_026217() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+void compute_main() {
+ textureLoad_026217();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.msl
new file mode 100644
index 0000000..6b84ada
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_026217(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(uint2(0u)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_026217(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_026217(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_026217(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.spvasm
new file mode 100644
index 0000000..8bb3a86
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_026217 "textureLoad_026217"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %23 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %28 = OpConstantNull %v4uint
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_026217 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %28
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %23 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_026217
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_026217
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_026217
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.wgsl
new file mode 100644
index 0000000..927fb49
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/026217.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_026217() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_026217();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_026217();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_026217();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl
new file mode 100644
index 0000000..a7ebfdf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<u32>, array_index: i32, level: u32) -> f32
+fn textureLoad_04b911() {
+ var res: f32 = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_04b911();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_04b911();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_04b911();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5b1cf98
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_04b911() {
+ float res = arg_0.Load(uint4(0u, 0u, uint(1), 1u)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_04b911();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_04b911();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_04b911();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5b1cf98
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_04b911() {
+ float res = arg_0.Load(uint4(0u, 0u, uint(1), 1u)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_04b911();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_04b911();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_04b911();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.glsl
new file mode 100644
index 0000000..045c7b80
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_04b911() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_04b911();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_04b911() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u)).x;
+}
+
+void fragment_main() {
+ textureLoad_04b911();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_04b911() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u)).x;
+}
+
+void compute_main() {
+ textureLoad_04b911();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.msl
new file mode 100644
index 0000000..5b8aa49
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_04b911(depth2d_array<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_04b911(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_04b911(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_04b911(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.spvasm
new file mode 100644
index 0000000..29b2cb3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_04b911 "textureLoad_04b911"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_04b911 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %25 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ %17 = OpImageFetch %v4float %18 %25 Lod %uint_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_04b911
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_04b911
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_04b911
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.wgsl
new file mode 100644
index 0000000..f1d96a8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/04b911.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_04b911() {
+ var res : f32 = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_04b911();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_04b911();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_04b911();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl
new file mode 100644
index 0000000..2de236d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureLoad(texture: texture_1d<f32>, coords: u32, level: i32) -> vec4<f32>
+fn textureLoad_1373dc() {
+ var res: vec4<f32> = textureLoad(arg_0, 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1373dc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1373dc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1373dc();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..30cef21
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_1373dc() {
+ float4 res = arg_0.Load(uint2(1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1373dc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1373dc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1373dc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..30cef21
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_1373dc() {
+ float4 res = arg_0.Load(uint2(1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1373dc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1373dc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1373dc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.glsl
new file mode 100644
index 0000000..4952ed3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_1373dc() {
+ vec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_1373dc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_1373dc() {
+ vec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+void fragment_main() {
+ textureLoad_1373dc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'sampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_1373dc() {
+ vec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+void compute_main() {
+ textureLoad_1373dc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.msl
new file mode 100644
index 0000000..683b90c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_1373dc(texture1d<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint(1u), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureLoad_1373dc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_1373dc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_1373dc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.spvasm
new file mode 100644
index 0000000..c7efb23
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_1373dc "textureLoad_1373dc"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_1373dc = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %uint_1 Lod %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureLoad_1373dc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureLoad_1373dc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_1373dc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.wgsl
new file mode 100644
index 0000000..c304750
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1373dc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureLoad_1373dc() {
+ var res : vec4<f32> = textureLoad(arg_0, 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1373dc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1373dc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1373dc();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl
new file mode 100644
index 0000000..56e1e07
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<u32>, array_index: i32, level: i32) -> vec4<i32>
+fn textureLoad_168dc8() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_168dc8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_168dc8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_168dc8();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..78a1282
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_168dc8() {
+ int4 res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_168dc8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_168dc8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_168dc8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..78a1282
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_168dc8() {
+ int4 res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_168dc8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_168dc8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_168dc8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.glsl
new file mode 100644
index 0000000..208d0ce
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_168dc8() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_168dc8();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_168dc8() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+void fragment_main() {
+ textureLoad_168dc8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_168dc8() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+void compute_main() {
+ textureLoad_168dc8();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.msl
new file mode 100644
index 0000000..407397f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_168dc8(texture2d_array<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_168dc8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_168dc8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_168dc8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.spvasm
new file mode 100644
index 0000000..635d95a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_168dc8 "textureLoad_168dc8"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %28 = OpConstantNull %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_168dc8 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %28
+ %19 = OpLoad %11 %arg_0
+ %23 = OpBitcast %uint %int_1
+ %25 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %23
+ %17 = OpImageFetch %v4int %19 %25 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_168dc8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_168dc8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_168dc8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.wgsl
new file mode 100644
index 0000000..4a87cc4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/168dc8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_168dc8() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_168dc8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_168dc8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_168dc8();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl
new file mode 100644
index 0000000..f137b59
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<i32>, array_index: u32, level: u32) -> vec4<u32>
+fn textureLoad_1b051f() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1b051f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1b051f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1b051f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..52b2377
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_1b051f() {
+ uint4 res = arg_0.Load(int4(0, 0, int(1u), int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1b051f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1b051f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1b051f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..52b2377
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_1b051f() {
+ uint4 res = arg_0.Load(int4(0, 0, int(1u), int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1b051f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1b051f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1b051f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.glsl
new file mode 100644
index 0000000..99a31bb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_1b051f() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_1b051f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_1b051f() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_1b051f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_1b051f() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+void compute_main() {
+ textureLoad_1b051f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.msl
new file mode 100644
index 0000000..77655f2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_1b051f(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(int2(0)), 1u, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_1b051f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_1b051f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_1b051f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.spvasm
new file mode 100644
index 0000000..952a0fb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_1b051f "textureLoad_1b051f"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %28 = OpConstantNull %v4uint
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_1b051f = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %28
+ %19 = OpLoad %11 %arg_0
+ %23 = OpBitcast %int %uint_1
+ %25 = OpCompositeConstruct %v3int %int_0 %int_0 %23
+ %17 = OpImageFetch %v4uint %19 %25 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_1b051f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_1b051f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_1b051f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.wgsl
new file mode 100644
index 0000000..99f3b15
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/1b051f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_1b051f() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1b051f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1b051f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1b051f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
index 76c37ef..a4dd107 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
@@ -33,9 +33,9 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, 0u)).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgb;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, 0u)).r, plane1.Load(uint3(coord, 0u)).rg, 1.0f));
+ color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f));
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
index 76c37ef..a4dd107 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
@@ -33,9 +33,9 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, 0u)).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgb;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, 0u)).r, plane1.Load(uint3(coord, 0u)).rg, 1.0f));
+ color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f));
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
index 214f868..e65e748 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.glsl
@@ -34,9 +34,9 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), int(0u)).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), int(0u)).r, texelFetch(plane1_1, ivec2(coord), int(0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
@@ -102,9 +102,9 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), int(0u)).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), int(0u)).r, texelFetch(plane1_1, ivec2(coord), int(0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
@@ -164,9 +164,9 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), int(0u)).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), int(0u)).r, texelFetch(plane1_1, ivec2(coord), int(0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl
index 81c3daa..e5b7c01 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.msl
@@ -45,9 +45,9 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) {
float3 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = float4(plane0.read(uint2(coord), 0u)).rgb;
+ color = float4(plane0.read(uint2(coord), 0)).rgb;
} else {
- color = (float4(plane0.read(uint2(coord), 0u)[0], float4(plane1.read(uint2(coord), 0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm
index 60ee453..4ac1277 100644
--- a/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureLoad/1bfdfb.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 136
+; Bound: 138
; Schema: 0
OpCapability Shader
%28 = OpExtInstImport "GLSL.std.450"
@@ -107,16 +107,18 @@
%v2uint = OpTypeVector %uint 2
%62 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams
%uint_1 = OpConstant %uint 1
- %78 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %79 = OpConstantNull %int
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
+ %93 = OpConstantNull %uint
%void = OpTypeVoid
- %109 = OpTypeFunction %void
- %116 = OpConstantNull %v2uint
+ %111 = OpTypeFunction %void
+ %118 = OpConstantNull %v2uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %123 = OpTypeFunction %v4float
+ %125 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %22
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -165,79 +167,79 @@
OpSelectionMerge %74 None
OpBranchConditional %73 %75 %76
%75 = OpLabel
- %77 = OpImageFetch %v4float %plane0 %coord Lod %78
- %79 = OpVectorShuffle %v3float %77 %77 0 1 2
- OpStore %color %79
+ %77 = OpImageFetch %v4float %plane0 %coord Lod %79
+ %80 = OpVectorShuffle %v3float %77 %77 0 1 2
+ OpStore %color %80
OpBranch %74
%76 = OpLabel
- %80 = OpImageFetch %v4float %plane0 %coord Lod %78
- %81 = OpCompositeExtract %float %80 0
- %82 = OpImageFetch %v4float %plane1 %coord Lod %78
- %84 = OpVectorShuffle %v2float %82 %82 0 1
- %85 = OpCompositeExtract %float %84 0
- %86 = OpCompositeExtract %float %84 1
- %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1
- %89 = OpCompositeExtract %mat3v4float %params_0 2
- %90 = OpVectorTimesMatrix %v3float %88 %89
- OpStore %color %90
+ %81 = OpImageFetch %v4float %plane0 %coord Lod %79
+ %82 = OpCompositeExtract %float %81 0
+ %83 = OpImageFetch %v4float %plane1 %coord Lod %79
+ %85 = OpVectorShuffle %v2float %83 %83 0 1
+ %86 = OpCompositeExtract %float %85 0
+ %87 = OpCompositeExtract %float %85 1
+ %89 = OpCompositeConstruct %v4float %82 %86 %87 %float_1
+ %90 = OpCompositeExtract %mat3v4float %params_0 2
+ %91 = OpVectorTimesMatrix %v3float %89 %90
+ OpStore %color %91
OpBranch %74
%74 = OpLabel
- %91 = OpCompositeExtract %uint %params_0 1
- %92 = OpIEqual %bool %91 %78
- OpSelectionMerge %93 None
- OpBranchConditional %92 %94 %93
- %94 = OpLabel
- %96 = OpLoad %v3float %color
- %97 = OpCompositeExtract %GammaTransferParams %params_0 3
- %95 = OpFunctionCall %v3float %gammaCorrection %96 %97
- OpStore %color %95
- %98 = OpCompositeExtract %mat3v3float %params_0 5
- %99 = OpLoad %v3float %color
- %100 = OpMatrixTimesVector %v3float %98 %99
- OpStore %color %100
- %102 = OpLoad %v3float %color
- %103 = OpCompositeExtract %GammaTransferParams %params_0 4
- %101 = OpFunctionCall %v3float %gammaCorrection %102 %103
- OpStore %color %101
- OpBranch %93
- %93 = OpLabel
+ %92 = OpCompositeExtract %uint %params_0 1
+ %94 = OpIEqual %bool %92 %93
+ OpSelectionMerge %95 None
+ OpBranchConditional %94 %96 %95
+ %96 = OpLabel
+ %98 = OpLoad %v3float %color
+ %99 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %97 = OpFunctionCall %v3float %gammaCorrection %98 %99
+ OpStore %color %97
+ %100 = OpCompositeExtract %mat3v3float %params_0 5
+ %101 = OpLoad %v3float %color
+ %102 = OpMatrixTimesVector %v3float %100 %101
+ OpStore %color %102
%104 = OpLoad %v3float %color
- %105 = OpCompositeExtract %float %104 0
- %106 = OpCompositeExtract %float %104 1
- %107 = OpCompositeExtract %float %104 2
- %108 = OpCompositeConstruct %v4float %105 %106 %107 %float_1
- OpReturnValue %108
+ %105 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %103 = OpFunctionCall %v3float %gammaCorrection %104 %105
+ OpStore %color %103
+ OpBranch %95
+ %95 = OpLabel
+ %106 = OpLoad %v3float %color
+ %107 = OpCompositeExtract %float %106 0
+ %108 = OpCompositeExtract %float %106 1
+ %109 = OpCompositeExtract %float %106 2
+ %110 = OpCompositeConstruct %v4float %107 %108 %109 %float_1
+ OpReturnValue %110
OpFunctionEnd
-%textureLoad_1bfdfb = OpFunction %void None %109
- %112 = OpLabel
+%textureLoad_1bfdfb = OpFunction %void None %111
+ %114 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %114 = OpLoad %11 %arg_0
- %115 = OpLoad %11 %ext_tex_plane_1
- %119 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
- %120 = OpLoad %ExternalTextureParams %119
- %113 = OpFunctionCall %v4float %textureLoadExternal %114 %115 %116 %120
- OpStore %res %113
+ %116 = OpLoad %11 %arg_0
+ %117 = OpLoad %11 %ext_tex_plane_1
+ %121 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
+ %122 = OpLoad %ExternalTextureParams %121
+ %115 = OpFunctionCall %v4float %textureLoadExternal %116 %117 %118 %122
+ OpStore %res %115
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %123
- %125 = OpLabel
- %126 = OpFunctionCall %void %textureLoad_1bfdfb
+%vertex_main_inner = OpFunction %v4float None %125
+ %127 = OpLabel
+ %128 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %109
- %128 = OpLabel
- %129 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %129
+%vertex_main = OpFunction %void None %111
+ %130 = OpLabel
+ %131 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %131
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %109
- %131 = OpLabel
- %132 = OpFunctionCall %void %textureLoad_1bfdfb
+%fragment_main = OpFunction %void None %111
+ %133 = OpLabel
+ %134 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %109
- %134 = OpLabel
- %135 = OpFunctionCall %void %textureLoad_1bfdfb
+%compute_main = OpFunction %void None %111
+ %136 = OpLabel
+ %137 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl
new file mode 100644
index 0000000..e03b36b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureLoad(texture: texture_1d<u32>, coords: u32, level: i32) -> vec4<u32>
+fn textureLoad_216c37() {
+ var res: vec4<u32> = textureLoad(arg_0, 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_216c37();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_216c37();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_216c37();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4b154a8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_216c37() {
+ uint4 res = arg_0.Load(uint2(1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_216c37();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_216c37();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_216c37();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4b154a8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_216c37() {
+ uint4 res = arg_0.Load(uint2(1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_216c37();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_216c37();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_216c37();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.glsl
new file mode 100644
index 0000000..9bda9d8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_216c37() {
+ uvec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_216c37();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_216c37() {
+ uvec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+void fragment_main() {
+ textureLoad_216c37();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'usampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_216c37() {
+ uvec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+void compute_main() {
+ textureLoad_216c37();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.msl
new file mode 100644
index 0000000..96fe68d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_216c37(texture1d<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint(1u), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureLoad_216c37(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_216c37(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_216c37(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.spvasm
new file mode 100644
index 0000000..d323ef0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_216c37 "textureLoad_216c37"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %25 = OpConstantNull %v4uint
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_216c37 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %25
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %uint_1 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_216c37
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_216c37
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_216c37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.wgsl
new file mode 100644
index 0000000..812abaa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/216c37.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureLoad_216c37() {
+ var res : vec4<u32> = textureLoad(arg_0, 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_216c37();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_216c37();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_216c37();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl
new file mode 100644
index 0000000..c31e51d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureLoad(texture: texture_3d<i32>, coords: vec3<u32>, level: i32) -> vec4<i32>
+fn textureLoad_223246() {
+ var res: vec4<i32> = textureLoad(arg_0, vec3<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_223246();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_223246();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_223246();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c434c8c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_223246() {
+ int4 res = arg_0.Load(uint4(0u, 0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_223246();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_223246();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_223246();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c434c8c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_223246() {
+ int4 res = arg_0.Load(uint4(0u, 0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_223246();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_223246();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_223246();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.glsl
new file mode 100644
index 0000000..39f77c1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_223246() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_223246();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_223246() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_223246();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_223246() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_223246();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.msl
new file mode 100644
index 0000000..3372521
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_223246(texture3d<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint3(uint3(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureLoad_223246(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_223246(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_223246(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.spvasm
new file mode 100644
index 0000000..bba82c9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_223246 "textureLoad_223246"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %22 = OpConstantNull %v3uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_223246 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %22 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_223246
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_223246
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_223246
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.wgsl
new file mode 100644
index 0000000..1a14589
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/223246.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureLoad_223246() {
+ var res : vec4<i32> = textureLoad(arg_0, vec3<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_223246();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_223246();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_223246();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl
new file mode 100644
index 0000000..4d77af6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<u32>, array_index: i32, level: u32) -> vec4<i32>
+fn textureLoad_2363be() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2363be();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2363be();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2363be();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1fcee1b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_2363be() {
+ int4 res = arg_0.Load(uint4(0u, 0u, uint(1), 1u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2363be();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2363be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2363be();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1fcee1b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_2363be() {
+ int4 res = arg_0.Load(uint4(0u, 0u, uint(1), 1u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2363be();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2363be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2363be();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.glsl
new file mode 100644
index 0000000..1854c65
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_2363be() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_2363be();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_2363be() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_2363be();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_2363be() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+void compute_main() {
+ textureLoad_2363be();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.msl
new file mode 100644
index 0000000..2281819
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_2363be(texture2d_array<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_2363be(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_2363be(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_2363be(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.spvasm
new file mode 100644
index 0000000..35dce1e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_2363be "textureLoad_2363be"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpConstantNull %v4int
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_2363be = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %29
+ %19 = OpLoad %11 %arg_0
+ %23 = OpBitcast %uint %int_1
+ %25 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %23
+ %17 = OpImageFetch %v4int %19 %25 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_2363be
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_2363be
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_2363be
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.wgsl
new file mode 100644
index 0000000..295dadc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2363be.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_2363be() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2363be();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2363be();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2363be();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl
new file mode 100644
index 0000000..102ca0b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureLoad(texture: texture_2d<f32>, coords: vec2<i32>, level: u32) -> vec4<f32>
+fn textureLoad_2d479c() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2d479c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2d479c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2d479c();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..48743d7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_2d479c() {
+ float4 res = arg_0.Load(int3(0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2d479c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2d479c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2d479c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..48743d7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_2d479c() {
+ float4 res = arg_0.Load(int3(0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2d479c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2d479c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2d479c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.glsl
new file mode 100644
index 0000000..480acb7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_2d479c() {
+ vec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_2d479c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_2d479c() {
+ vec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_2d479c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_2d479c() {
+ vec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_2d479c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.msl
new file mode 100644
index 0000000..64a9fa9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_2d479c(texture2d<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureLoad_2d479c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_2d479c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_2d479c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.spvasm
new file mode 100644
index 0000000..ea0f240
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_2d479c "textureLoad_2d479c"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %20 = OpConstantNull %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_2d479c = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %20 Lod %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureLoad_2d479c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_2d479c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_2d479c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.wgsl
new file mode 100644
index 0000000..93532d7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/2d479c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureLoad_2d479c() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2d479c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2d479c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2d479c();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl
new file mode 100644
index 0000000..1ba95c1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<i32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<i32>, coords: vec2<i32>, sample_index: u32) -> vec4<i32>
+fn textureLoad_38f8ab() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_38f8ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_38f8ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_38f8ab();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b32e2f0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_38f8ab() {
+ int4 res = arg_0.Load((0).xx, 1u);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_38f8ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_38f8ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_38f8ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b32e2f0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_38f8ab() {
+ int4 res = arg_0.Load((0).xx, 1u);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_38f8ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_38f8ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_38f8ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.glsl
new file mode 100644
index 0000000..199f0a9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_38f8ab() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_38f8ab();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_38f8ab() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_38f8ab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_38f8ab() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_38f8ab();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.msl
new file mode 100644
index 0000000..062a78c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_38f8ab(texture2d_ms<int, access::read> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<int, access::read> tint_symbol_2) {
+ textureLoad_38f8ab(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<int, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<int, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_38f8ab(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_38f8ab(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.spvasm
new file mode 100644
index 0000000..5bcd7ad
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_38f8ab "textureLoad_38f8ab"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %v2int = OpTypeVector %int 2
+ %21 = OpConstantNull %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_38f8ab = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %21 Sample %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_38f8ab
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_38f8ab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_38f8ab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.wgsl
new file mode 100644
index 0000000..0a81a11
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/38f8ab.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureLoad_38f8ab() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_38f8ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_38f8ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_38f8ab();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl
new file mode 100644
index 0000000..f3db7a0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<i32>, array_index: u32, level: u32) -> vec4<f32>
+fn textureLoad_3c96e8() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3c96e8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3c96e8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3c96e8();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1b18d6f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3c96e8() {
+ float4 res = arg_0.Load(int4(0, 0, int(1u), int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3c96e8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3c96e8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3c96e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1b18d6f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3c96e8() {
+ float4 res = arg_0.Load(int4(0, 0, int(1u), int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3c96e8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3c96e8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3c96e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.glsl
new file mode 100644
index 0000000..712a973
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_3c96e8() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_3c96e8();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_3c96e8() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_3c96e8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_3c96e8() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+void compute_main() {
+ textureLoad_3c96e8();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.msl
new file mode 100644
index 0000000..468cb47
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_3c96e8(texture2d_array<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(int2(0)), 1u, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_3c96e8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_3c96e8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_3c96e8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.spvasm
new file mode 100644
index 0000000..4aaf7c8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_3c96e8 "textureLoad_3c96e8"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_3c96e8 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ %16 = OpImageFetch %v4float %17 %24 Lod %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_3c96e8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_3c96e8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_3c96e8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.wgsl
new file mode 100644
index 0000000..487fe60
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3c96e8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_3c96e8() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3c96e8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3c96e8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3c96e8();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl
new file mode 100644
index 0000000..a7f50c3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<u32>, array_index: u32, level: i32) -> vec4<i32>
+fn textureLoad_3d3fd1() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3d3fd1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3d3fd1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3d3fd1();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f31c316
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_3d3fd1() {
+ int4 res = arg_0.Load(uint4(0u, 0u, 1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3d3fd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3d3fd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3d3fd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f31c316
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_3d3fd1() {
+ int4 res = arg_0.Load(uint4(0u, 0u, 1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3d3fd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3d3fd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3d3fd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.glsl
new file mode 100644
index 0000000..9d295c5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_3d3fd1() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_3d3fd1();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_3d3fd1() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_3d3fd1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_3d3fd1() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+void compute_main() {
+ textureLoad_3d3fd1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.msl
new file mode 100644
index 0000000..63fddeb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_3d3fd1(texture2d_array<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(uint2(0u)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_3d3fd1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_3d3fd1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_3d3fd1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.spvasm
new file mode 100644
index 0000000..73e3401
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_3d3fd1 "textureLoad_3d3fd1"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %24 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %28 = OpConstantNull %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_3d3fd1 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %28
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %24 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_3d3fd1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_3d3fd1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_3d3fd1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.wgsl
new file mode 100644
index 0000000..a053554
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3d3fd1.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_3d3fd1() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3d3fd1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3d3fd1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3d3fd1();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl
new file mode 100644
index 0000000..81954b0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureLoad(texture: texture_1d<f32>, coords: i32, level: u32) -> vec4<f32>
+fn textureLoad_3da3ed() {
+ var res: vec4<f32> = textureLoad(arg_0, 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3da3ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3da3ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3da3ed();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ae51c8e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3da3ed() {
+ float4 res = arg_0.Load(int2(1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3da3ed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3da3ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3da3ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ae51c8e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3da3ed() {
+ float4 res = arg_0.Load(int2(1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3da3ed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3da3ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3da3ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.glsl
new file mode 100644
index 0000000..7d7008a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_3da3ed() {
+ vec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_3da3ed();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_3da3ed() {
+ vec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+void fragment_main() {
+ textureLoad_3da3ed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'sampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_3da3ed() {
+ vec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+void compute_main() {
+ textureLoad_3da3ed();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.msl
new file mode 100644
index 0000000..84e357d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_3da3ed(texture1d<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint(1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureLoad_3da3ed(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_3da3ed(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_3da3ed(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.spvasm
new file mode 100644
index 0000000..45bef6a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_3da3ed "textureLoad_3da3ed"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_3da3ed = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %int_1 Lod %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureLoad_3da3ed
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureLoad_3da3ed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_3da3ed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.wgsl
new file mode 100644
index 0000000..e832060
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/3da3ed.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureLoad_3da3ed() {
+ var res : vec4<f32> = textureLoad(arg_0, 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3da3ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3da3ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3da3ed();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl
new file mode 100644
index 0000000..d677077
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureLoad(texture: texture_2d<f32>, coords: vec2<u32>, level: i32) -> vec4<f32>
+fn textureLoad_439e2a() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_439e2a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_439e2a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_439e2a();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..04be847
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_439e2a() {
+ float4 res = arg_0.Load(uint3(0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_439e2a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_439e2a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_439e2a();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..04be847
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_439e2a() {
+ float4 res = arg_0.Load(uint3(0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_439e2a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_439e2a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_439e2a();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.glsl
new file mode 100644
index 0000000..3e1a9c9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_439e2a() {
+ vec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_439e2a();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_439e2a() {
+ vec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_439e2a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_439e2a() {
+ vec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_439e2a();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.msl
new file mode 100644
index 0000000..9a44d70
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_439e2a(texture2d<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureLoad_439e2a(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_439e2a(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_439e2a(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm
new file mode 100644
index 0000000..bd14760
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_439e2a "textureLoad_439e2a"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %20 = OpConstantNull %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_439e2a = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %20 Lod %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureLoad_439e2a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_439e2a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_439e2a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.wgsl
new file mode 100644
index 0000000..0cc7d74
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureLoad_439e2a() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_439e2a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_439e2a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_439e2a();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl
new file mode 100644
index 0000000..eb46b20
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<u32>, array_index: i32, level: u32) -> vec4<f32>
+fn textureLoad_46a93f() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_46a93f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_46a93f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_46a93f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..efe3b08
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_46a93f() {
+ float4 res = arg_0.Load(uint4(0u, 0u, uint(1), 1u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_46a93f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_46a93f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_46a93f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..efe3b08
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_46a93f() {
+ float4 res = arg_0.Load(uint4(0u, 0u, uint(1), 1u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_46a93f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_46a93f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_46a93f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.glsl
new file mode 100644
index 0000000..ba12442
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_46a93f() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_46a93f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_46a93f() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_46a93f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_46a93f() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+void compute_main() {
+ textureLoad_46a93f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.msl
new file mode 100644
index 0000000..06c32ea
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_46a93f(texture2d_array<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_46a93f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_46a93f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_46a93f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.spvasm
new file mode 100644
index 0000000..a294467
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_46a93f "textureLoad_46a93f"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_46a93f = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ %16 = OpImageFetch %v4float %17 %24 Lod %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_46a93f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_46a93f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_46a93f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.wgsl
new file mode 100644
index 0000000..f5a4417
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/46a93f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_46a93f() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_46a93f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_46a93f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_46a93f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl
new file mode 100644
index 0000000..82d2b57
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<i32>, array_index: u32, level: i32) -> vec4<f32>
+fn textureLoad_4acb64() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4acb64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4acb64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4acb64();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..21f231b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_4acb64() {
+ float4 res = arg_0.Load(int4(0, 0, int(1u), 1));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4acb64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4acb64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4acb64();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..21f231b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_4acb64() {
+ float4 res = arg_0.Load(int4(0, 0, int(1u), 1));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4acb64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4acb64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4acb64();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.glsl
new file mode 100644
index 0000000..0490887
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_4acb64() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_4acb64();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_4acb64() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_4acb64();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_4acb64() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+void compute_main() {
+ textureLoad_4acb64();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.msl
new file mode 100644
index 0000000..247c9fc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_4acb64(texture2d_array<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(int2(0)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_4acb64(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_4acb64(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_4acb64(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.spvasm
new file mode 100644
index 0000000..1fcd8ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_4acb64 "textureLoad_4acb64"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_4acb64 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ %16 = OpImageFetch %v4float %17 %24 Lod %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_4acb64
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_4acb64
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_4acb64
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.wgsl
new file mode 100644
index 0000000..f55bd6b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4acb64.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_4acb64() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4acb64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4acb64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4acb64();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl
new file mode 100644
index 0000000..fad9797
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureLoad(texture: texture_1d<i32>, coords: u32, level: i32) -> vec4<i32>
+fn textureLoad_4c423f() {
+ var res: vec4<i32> = textureLoad(arg_0, 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4c423f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4c423f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4c423f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8e65740
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_4c423f() {
+ int4 res = arg_0.Load(uint2(1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4c423f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4c423f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4c423f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8e65740
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_4c423f() {
+ int4 res = arg_0.Load(uint2(1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4c423f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4c423f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4c423f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.glsl
new file mode 100644
index 0000000..a030cac
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_4c423f() {
+ ivec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_4c423f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_4c423f() {
+ ivec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+void fragment_main() {
+ textureLoad_4c423f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'isampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_4c423f() {
+ ivec4 res = texelFetch(arg_0_1, int(1u), 1);
+}
+
+void compute_main() {
+ textureLoad_4c423f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.msl
new file mode 100644
index 0000000..d02ad77
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_4c423f(texture1d<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint(1u), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureLoad_4c423f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_4c423f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_4c423f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.spvasm
new file mode 100644
index 0000000..b119edc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_4c423f "textureLoad_4c423f"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %25 = OpConstantNull %v4int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_4c423f = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %25
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %uint_1 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_4c423f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_4c423f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_4c423f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.wgsl
new file mode 100644
index 0000000..08cd408
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/4c423f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureLoad_4c423f() {
+ var res : vec4<i32> = textureLoad(arg_0, 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4c423f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4c423f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4c423f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl
new file mode 100644
index 0000000..86eb297
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<u32>, array_index: i32, level: i32) -> vec4<u32>
+fn textureLoad_53e142() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_53e142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_53e142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_53e142();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7485817
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_53e142() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_53e142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_53e142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_53e142();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7485817
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_53e142() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_53e142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_53e142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_53e142();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.glsl
new file mode 100644
index 0000000..60635a4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_53e142() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_53e142();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_53e142() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+void fragment_main() {
+ textureLoad_53e142();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_53e142() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+void compute_main() {
+ textureLoad_53e142();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.msl
new file mode 100644
index 0000000..b7c7b22
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_53e142(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_53e142(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_53e142(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_53e142(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.spvasm
new file mode 100644
index 0000000..47244e5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_53e142 "textureLoad_53e142"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %28 = OpConstantNull %v4uint
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_53e142 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %28
+ %19 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %25 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ %17 = OpImageFetch %v4uint %19 %25 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_53e142
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_53e142
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_53e142
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.wgsl
new file mode 100644
index 0000000..741a7f0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/53e142.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_53e142() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_53e142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_53e142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_53e142();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl
new file mode 100644
index 0000000..0cd6406
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<u32>, array_index: i32, level: i32) -> vec4<f32>
+fn textureLoad_54a59b() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_54a59b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_54a59b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_54a59b();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..37fc597
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_54a59b() {
+ float4 res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_54a59b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_54a59b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_54a59b();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..37fc597
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_54a59b() {
+ float4 res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_54a59b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_54a59b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_54a59b();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.glsl
new file mode 100644
index 0000000..1cbdc29
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_54a59b() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_54a59b();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_54a59b() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+void fragment_main() {
+ textureLoad_54a59b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_54a59b() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1);
+}
+
+void compute_main() {
+ textureLoad_54a59b();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.msl
new file mode 100644
index 0000000..05527a5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_54a59b(texture2d_array<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_54a59b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_54a59b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_54a59b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.spvasm
new file mode 100644
index 0000000..14f2601
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_54a59b "textureLoad_54a59b"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_54a59b = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ %16 = OpImageFetch %v4float %17 %24 Lod %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_54a59b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_54a59b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_54a59b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.wgsl
new file mode 100644
index 0000000..bf69b5d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/54a59b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_54a59b() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_54a59b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_54a59b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_54a59b();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl
new file mode 100644
index 0000000..b23027c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureLoad(texture: texture_1d<i32>, coords: i32, level: u32) -> vec4<i32>
+fn textureLoad_62d1de() {
+ var res: vec4<i32> = textureLoad(arg_0, 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_62d1de();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_62d1de();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_62d1de();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..51ff9e6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_62d1de() {
+ int4 res = arg_0.Load(int2(1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_62d1de();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_62d1de();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_62d1de();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..51ff9e6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_62d1de() {
+ int4 res = arg_0.Load(int2(1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_62d1de();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_62d1de();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_62d1de();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.glsl
new file mode 100644
index 0000000..55bcb8d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_62d1de() {
+ ivec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_62d1de();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_62d1de() {
+ ivec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+void fragment_main() {
+ textureLoad_62d1de();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'isampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_62d1de() {
+ ivec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+void compute_main() {
+ textureLoad_62d1de();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.msl
new file mode 100644
index 0000000..1f95d13
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_62d1de(texture1d<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint(1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureLoad_62d1de(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_62d1de(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_62d1de(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.spvasm
new file mode 100644
index 0000000..0e3b453
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_62d1de "textureLoad_62d1de"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %25 = OpConstantNull %v4int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_62d1de = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %25
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %int_1 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_62d1de
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_62d1de
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_62d1de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.wgsl
new file mode 100644
index 0000000..d456895
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/62d1de.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureLoad_62d1de() {
+ var res : vec4<i32> = textureLoad(arg_0, 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_62d1de();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_62d1de();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_62d1de();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl
new file mode 100644
index 0000000..11c7cb5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<i32>, array_index: i32, level: u32) -> vec4<u32>
+fn textureLoad_656d76() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_656d76();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_656d76();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_656d76();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bf91da0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_656d76() {
+ uint4 res = arg_0.Load(int4(0, 0, 1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_656d76();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_656d76();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_656d76();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bf91da0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_656d76() {
+ uint4 res = arg_0.Load(int4(0, 0, 1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_656d76();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_656d76();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_656d76();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.glsl
new file mode 100644
index 0000000..3aad010
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_656d76() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_656d76();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_656d76() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_656d76();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_656d76() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+void compute_main() {
+ textureLoad_656d76();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.msl
new file mode 100644
index 0000000..a992774
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_656d76(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(int2(0)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_656d76(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_656d76(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_656d76(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.spvasm
new file mode 100644
index 0000000..0b2bd2b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_656d76 "textureLoad_656d76"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %24 = OpConstantComposite %v3int %int_0 %int_0 %int_1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %28 = OpConstantNull %v4uint
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_656d76 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %28
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %24 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_656d76
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_656d76
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_656d76
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7a3ebd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/656d76.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_656d76() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_656d76();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_656d76();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_656d76();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl
new file mode 100644
index 0000000..7014871
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: u32, level: u32) -> f32
+fn textureLoad_66be47() {
+ var res: f32 = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_66be47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_66be47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_66be47();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..73885a2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_66be47() {
+ float res = arg_0.Load(int4(0, 0, int(1u), int(1u))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_66be47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_66be47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_66be47();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..73885a2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_66be47() {
+ float res = arg_0.Load(int4(0, 0, int(1u), int(1u))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_66be47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_66be47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_66be47();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.glsl
new file mode 100644
index 0000000..f8185c1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_66be47() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_66be47();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_66be47() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u)).x;
+}
+
+void fragment_main() {
+ textureLoad_66be47();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_66be47() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u)).x;
+}
+
+void compute_main() {
+ textureLoad_66be47();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.msl
new file mode 100644
index 0000000..17fef2f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_66be47(depth2d_array<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(int2(0)), 1u, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_66be47(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_66be47(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_66be47(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.spvasm
new file mode 100644
index 0000000..990ebb0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_66be47 "textureLoad_66be47"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_66be47 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %25 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ %17 = OpImageFetch %v4float %18 %25 Lod %uint_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_66be47
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_66be47
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_66be47
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.wgsl
new file mode 100644
index 0000000..1832e29
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/66be47.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_66be47() {
+ var res : f32 = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_66be47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_66be47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_66be47();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl
new file mode 100644
index 0000000..2b8177e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d;
+
+// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<i32>, sample_index: u32) -> f32
+fn textureLoad_6925bc() {
+ var res: f32 = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6925bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6925bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6925bc();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ccd6a22
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_6925bc() {
+ float res = arg_0.Load(int3(0, 0, 0), 1u).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6925bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6925bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6925bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ccd6a22
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_6925bc() {
+ float res = arg_0.Load(int3(0, 0, 0), 1u).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6925bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6925bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6925bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.glsl
new file mode 100644
index 0000000..76b2acd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6925bc() {
+ float res = texelFetch(arg_0_1, ivec2(0), int(1u)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_6925bc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6925bc() {
+ float res = texelFetch(arg_0_1, ivec2(0), int(1u)).x;
+}
+
+void fragment_main() {
+ textureLoad_6925bc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6925bc() {
+ float res = texelFetch(arg_0_1, ivec2(0), int(1u)).x;
+}
+
+void compute_main() {
+ textureLoad_6925bc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.msl
new file mode 100644
index 0000000..97acbd3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6925bc(depth2d_ms<float, access::read> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_6925bc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_6925bc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6925bc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.spvasm
new file mode 100644
index 0000000..cda1ac2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_6925bc "textureLoad_6925bc"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %21 = OpConstantNull %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6925bc = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4float %18 %21 Sample %uint_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_6925bc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_6925bc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_6925bc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.wgsl
new file mode 100644
index 0000000..14dd184
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6925bc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureLoad_6925bc() {
+ var res : f32 = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6925bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6925bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6925bc();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl
new file mode 100644
index 0000000..26bd09c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureLoad(texture: texture_1d<u32>, coords: i32, level: u32) -> vec4<u32>
+fn textureLoad_6b77d4() {
+ var res: vec4<u32> = textureLoad(arg_0, 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6b77d4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6b77d4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6b77d4();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..6ca9686
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6b77d4() {
+ uint4 res = arg_0.Load(int2(1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6b77d4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6b77d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6b77d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..6ca9686
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6b77d4() {
+ uint4 res = arg_0.Load(int2(1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6b77d4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6b77d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6b77d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.glsl
new file mode 100644
index 0000000..4fbc6f4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_6b77d4() {
+ uvec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_6b77d4();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_6b77d4() {
+ uvec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+void fragment_main() {
+ textureLoad_6b77d4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'usampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_6b77d4() {
+ uvec4 res = texelFetch(arg_0_1, 1, int(1u));
+}
+
+void compute_main() {
+ textureLoad_6b77d4();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.msl
new file mode 100644
index 0000000..7669ab8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6b77d4(texture1d<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint(1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureLoad_6b77d4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_6b77d4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6b77d4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.spvasm
new file mode 100644
index 0000000..1f1b990
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_6b77d4 "textureLoad_6b77d4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %25 = OpConstantNull %v4uint
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6b77d4 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %25
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %int_1 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_6b77d4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_6b77d4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_6b77d4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.wgsl
new file mode 100644
index 0000000..11e4711
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6b77d4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureLoad_6b77d4() {
+ var res : vec4<u32> = textureLoad(arg_0, 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6b77d4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6b77d4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6b77d4();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl
new file mode 100644
index 0000000..3ef2937
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureLoad(texture: texture_3d<u32>, coords: vec3<i32>, level: u32) -> vec4<u32>
+fn textureLoad_6bf4b7() {
+ var res: vec4<u32> = textureLoad(arg_0, vec3<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6bf4b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6bf4b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6bf4b7();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8012b52
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6bf4b7() {
+ uint4 res = arg_0.Load(int4(0, 0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6bf4b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6bf4b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6bf4b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8012b52
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6bf4b7() {
+ uint4 res = arg_0.Load(int4(0, 0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6bf4b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6bf4b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6bf4b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.glsl
new file mode 100644
index 0000000..87a337c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_6bf4b7() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_6bf4b7();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_6bf4b7() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_6bf4b7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_6bf4b7() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_6bf4b7();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.msl
new file mode 100644
index 0000000..0fa3b97
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6bf4b7(texture3d<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint3(int3(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureLoad_6bf4b7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_6bf4b7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6bf4b7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.spvasm
new file mode 100644
index 0000000..74c96d6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_6bf4b7 "textureLoad_6bf4b7"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %22 = OpConstantNull %v3int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6bf4b7 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %22 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_6bf4b7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_6bf4b7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_6bf4b7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.wgsl
new file mode 100644
index 0000000..87ee760
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/6bf4b7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureLoad_6bf4b7() {
+ var res : vec4<u32> = textureLoad(arg_0, vec3<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6bf4b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6bf4b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6bf4b7();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl
new file mode 100644
index 0000000..dcfb039
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<i32>, array_index: i32, level: u32) -> vec4<f32>
+fn textureLoad_789045() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_789045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_789045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_789045();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7c7ed8d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_789045() {
+ float4 res = arg_0.Load(int4(0, 0, 1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_789045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_789045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_789045();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7c7ed8d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_789045() {
+ float4 res = arg_0.Load(int4(0, 0, 1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_789045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_789045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_789045();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.glsl
new file mode 100644
index 0000000..9e596c1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_789045() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_789045();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_789045() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_789045();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_789045() {
+ vec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+void compute_main() {
+ textureLoad_789045();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.msl
new file mode 100644
index 0000000..903adf9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_789045(texture2d_array<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(int2(0)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_789045(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_789045(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_789045(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.spvasm
new file mode 100644
index 0000000..7398fc6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_789045 "textureLoad_789045"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %22 = OpConstantComposite %v3int %int_0 %int_0 %int_1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_789045 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %22 Lod %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_789045
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_789045
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_789045
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.wgsl
new file mode 100644
index 0000000..10a00a2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/789045.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_789045() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_789045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_789045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_789045();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl
new file mode 100644
index 0000000..efd577e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<i32>, array_index: u32, level: i32) -> vec4<u32>
+fn textureLoad_7ab4df() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7ab4df();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7ab4df();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7ab4df();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b6d28d8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_7ab4df() {
+ uint4 res = arg_0.Load(int4(0, 0, int(1u), 1));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7ab4df();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7ab4df();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7ab4df();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b6d28d8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_7ab4df() {
+ uint4 res = arg_0.Load(int4(0, 0, int(1u), 1));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7ab4df();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7ab4df();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7ab4df();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.glsl
new file mode 100644
index 0000000..ec80f3b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7ab4df() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_7ab4df();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7ab4df() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_7ab4df();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7ab4df() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+void compute_main() {
+ textureLoad_7ab4df();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.msl
new file mode 100644
index 0000000..b4ea0ff
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7ab4df(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(int2(0)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_7ab4df(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_7ab4df(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7ab4df(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.spvasm
new file mode 100644
index 0000000..14ec9cc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_7ab4df "textureLoad_7ab4df"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %29 = OpConstantNull %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7ab4df = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %29
+ %19 = OpLoad %11 %arg_0
+ %23 = OpBitcast %int %uint_1
+ %25 = OpCompositeConstruct %v3int %int_0 %int_0 %23
+ %17 = OpImageFetch %v4uint %19 %25 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_7ab4df
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_7ab4df
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_7ab4df
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.wgsl
new file mode 100644
index 0000000..1641a45
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7ab4df.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_7ab4df() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7ab4df();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7ab4df();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7ab4df();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl
new file mode 100644
index 0000000..9f17dfd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<i32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<i32>, coords: vec2<u32>, sample_index: i32) -> vec4<i32>
+fn textureLoad_7bee94() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7bee94();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7bee94();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7bee94();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..637fedd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_7bee94() {
+ int4 res = arg_0.Load((0u).xx, 1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7bee94();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7bee94();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7bee94();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..637fedd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_7bee94() {
+ int4 res = arg_0.Load((0u).xx, 1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7bee94();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7bee94();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7bee94();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.glsl
new file mode 100644
index 0000000..0b65e8b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_7bee94() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_7bee94();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_7bee94() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_7bee94();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_7bee94() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_7bee94();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.msl
new file mode 100644
index 0000000..3b6dd3b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7bee94(texture2d_ms<int, access::read> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<int, access::read> tint_symbol_2) {
+ textureLoad_7bee94(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<int, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<int, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_7bee94(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7bee94(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.spvasm
new file mode 100644
index 0000000..6cebf88
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_7bee94 "textureLoad_7bee94"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %22 = OpConstantNull %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7bee94 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %22 Sample %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_7bee94
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_7bee94
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_7bee94
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.wgsl
new file mode 100644
index 0000000..a0dce1f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7bee94.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureLoad_7bee94() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7bee94();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7bee94();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7bee94();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl
new file mode 100644
index 0000000..114529e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureLoad(texture: texture_depth_2d, coords: vec2<u32>, level: i32) -> f32
+fn textureLoad_7fd822() {
+ var res: f32 = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7fd822();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7fd822();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7fd822();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c7fda0b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_7fd822() {
+ float res = arg_0.Load(uint3(0u, 0u, uint(1))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7fd822();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7fd822();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7fd822();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c7fda0b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_7fd822() {
+ float res = arg_0.Load(uint3(0u, 0u, uint(1))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7fd822();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7fd822();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7fd822();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.glsl
new file mode 100644
index 0000000..190b3ba
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_7fd822() {
+ float res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_7fd822();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_7fd822() {
+ float res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1).x;
+}
+
+void fragment_main() {
+ textureLoad_7fd822();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_7fd822() {
+ float res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1).x;
+}
+
+void compute_main() {
+ textureLoad_7fd822();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.msl
new file mode 100644
index 0000000..ae2db23
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7fd822(depth2d<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureLoad_7fd822(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_7fd822(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7fd822(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.spvasm
new file mode 100644
index 0000000..afc51da
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_7fd822 "textureLoad_7fd822"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %21 = OpConstantNull %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7fd822 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4float %18 %21 Lod %int_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_7fd822
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_7fd822
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_7fd822
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.wgsl
new file mode 100644
index 0000000..27d783f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/7fd822.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureLoad_7fd822() {
+ var res : f32 = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7fd822();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7fd822();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7fd822();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl
new file mode 100644
index 0000000..b5d0434
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureLoad(texture: texture_depth_2d, coords: vec2<i32>, level: u32) -> f32
+fn textureLoad_8ccbe3() {
+ var res: f32 = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_8ccbe3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_8ccbe3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_8ccbe3();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..6f96b70
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_8ccbe3() {
+ float res = arg_0.Load(int3(0, 0, int(1u))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_8ccbe3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_8ccbe3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_8ccbe3();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..6f96b70
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_8ccbe3() {
+ float res = arg_0.Load(int3(0, 0, int(1u))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_8ccbe3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_8ccbe3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_8ccbe3();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.glsl
new file mode 100644
index 0000000..ece7afb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_8ccbe3() {
+ float res = texelFetch(arg_0_1, ivec2(0), int(1u)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_8ccbe3();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_8ccbe3() {
+ float res = texelFetch(arg_0_1, ivec2(0), int(1u)).x;
+}
+
+void fragment_main() {
+ textureLoad_8ccbe3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_8ccbe3() {
+ float res = texelFetch(arg_0_1, ivec2(0), int(1u)).x;
+}
+
+void compute_main() {
+ textureLoad_8ccbe3();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.msl
new file mode 100644
index 0000000..ac493ed
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_8ccbe3(depth2d<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureLoad_8ccbe3(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_8ccbe3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_8ccbe3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.spvasm
new file mode 100644
index 0000000..74a1be6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_8ccbe3 "textureLoad_8ccbe3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %21 = OpConstantNull %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_8ccbe3 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4float %18 %21 Lod %uint_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_8ccbe3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_8ccbe3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_8ccbe3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.wgsl
new file mode 100644
index 0000000..ed51a5e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/8ccbe3.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureLoad_8ccbe3() {
+ var res : f32 = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_8ccbe3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_8ccbe3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_8ccbe3();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl
new file mode 100644
index 0000000..caf7225
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureLoad(texture: texture_3d<u32>, coords: vec3<u32>, level: i32) -> vec4<u32>
+fn textureLoad_92eb1f() {
+ var res: vec4<u32> = textureLoad(arg_0, vec3<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_92eb1f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_92eb1f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_92eb1f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f6223be
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_92eb1f() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_92eb1f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_92eb1f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_92eb1f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f6223be
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_92eb1f() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_92eb1f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_92eb1f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_92eb1f();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.glsl
new file mode 100644
index 0000000..17377b3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_92eb1f() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_92eb1f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_92eb1f() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_92eb1f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_92eb1f() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_92eb1f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.msl
new file mode 100644
index 0000000..1ccb382
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_92eb1f(texture3d<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint3(uint3(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureLoad_92eb1f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_92eb1f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_92eb1f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.spvasm
new file mode 100644
index 0000000..0660252
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_92eb1f "textureLoad_92eb1f"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+ %21 = OpConstantNull %v3uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_92eb1f = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %21 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_92eb1f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_92eb1f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_92eb1f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.wgsl
new file mode 100644
index 0000000..e6000a2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/92eb1f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureLoad_92eb1f() {
+ var res : vec4<u32> = textureLoad(arg_0, vec3<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_92eb1f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_92eb1f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_92eb1f();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl
new file mode 100644
index 0000000..35fef29
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureLoad(texture: texture_2d<i32>, coords: vec2<u32>, level: i32) -> vec4<i32>
+fn textureLoad_9aa733() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9aa733();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9aa733();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9aa733();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..79162bd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9aa733() {
+ int4 res = arg_0.Load(uint3(0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9aa733();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9aa733();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9aa733();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..79162bd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9aa733() {
+ int4 res = arg_0.Load(uint3(0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9aa733();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9aa733();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9aa733();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.glsl
new file mode 100644
index 0000000..217cfa1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_9aa733() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_9aa733();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_9aa733() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_9aa733();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_9aa733() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_9aa733();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.msl
new file mode 100644
index 0000000..961e4e3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9aa733(texture2d<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureLoad_9aa733(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_9aa733(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9aa733(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.spvasm
new file mode 100644
index 0000000..6e614d2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_9aa733 "textureLoad_9aa733"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %22 = OpConstantNull %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9aa733 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %22 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_9aa733
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_9aa733
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_9aa733
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.wgsl
new file mode 100644
index 0000000..10a785e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9aa733.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureLoad_9aa733() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9aa733();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9aa733();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9aa733();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl
new file mode 100644
index 0000000..e666bb0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<i32>, array_index: i32, level: u32) -> vec4<i32>
+fn textureLoad_9d70e9() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9d70e9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9d70e9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9d70e9();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0e3ab66
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9d70e9() {
+ int4 res = arg_0.Load(int4(0, 0, 1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9d70e9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9d70e9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9d70e9();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0e3ab66
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9d70e9() {
+ int4 res = arg_0.Load(int4(0, 0, 1, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9d70e9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9d70e9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9d70e9();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.glsl
new file mode 100644
index 0000000..3d13c69
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9d70e9() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_9d70e9();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9d70e9() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_9d70e9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9d70e9() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u));
+}
+
+void compute_main() {
+ textureLoad_9d70e9();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.msl
new file mode 100644
index 0000000..da97933
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9d70e9(texture2d_array<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(int2(0)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_9d70e9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_9d70e9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9d70e9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.spvasm
new file mode 100644
index 0000000..ef88f71
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_9d70e9 "textureLoad_9d70e9"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %23 = OpConstantComposite %v3int %int_0 %int_0 %int_1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %28 = OpConstantNull %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9d70e9 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %28
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %23 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_9d70e9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_9d70e9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_9d70e9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.wgsl
new file mode 100644
index 0000000..d1bbb29
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9d70e9.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_9d70e9() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9d70e9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9d70e9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9d70e9();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl
new file mode 100644
index 0000000..1cd4b77
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<i32>, array_index: u32, level: u32) -> vec4<i32>
+fn textureLoad_9fbfd9() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9fbfd9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9fbfd9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9fbfd9();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cc0b741
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9fbfd9() {
+ int4 res = arg_0.Load(int4(0, 0, int(1u), int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9fbfd9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9fbfd9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9fbfd9();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cc0b741
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9fbfd9() {
+ int4 res = arg_0.Load(int4(0, 0, int(1u), int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9fbfd9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9fbfd9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9fbfd9();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.glsl
new file mode 100644
index 0000000..8cdbcc7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9fbfd9() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_9fbfd9();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9fbfd9() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_9fbfd9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9fbfd9() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), int(1u));
+}
+
+void compute_main() {
+ textureLoad_9fbfd9();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.msl
new file mode 100644
index 0000000..4c392b8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9fbfd9(texture2d_array<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(int2(0)), 1u, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_9fbfd9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_9fbfd9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9fbfd9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.spvasm
new file mode 100644
index 0000000..b76f91a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_9fbfd9 "textureLoad_9fbfd9"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %28 = OpConstantNull %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9fbfd9 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %28
+ %19 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %25 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ %17 = OpImageFetch %v4int %19 %25 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_9fbfd9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_9fbfd9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_9fbfd9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.wgsl
new file mode 100644
index 0000000..6de6866
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/9fbfd9.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_9fbfd9() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9fbfd9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9fbfd9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9fbfd9();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl
new file mode 100644
index 0000000..6b197d8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<u32>, array_index: i32, level: u32) -> vec4<u32>
+fn textureLoad_a24be1() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a24be1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_a24be1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a24be1();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1570879
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_a24be1() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, uint(1), 1u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_a24be1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_a24be1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_a24be1();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1570879
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_a24be1() {
+ uint4 res = arg_0.Load(uint4(0u, 0u, uint(1), 1u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_a24be1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_a24be1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_a24be1();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.glsl
new file mode 100644
index 0000000..1e9bb6c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_a24be1() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_a24be1();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_a24be1() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_a24be1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_a24be1() {
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), int(1u));
+}
+
+void compute_main() {
+ textureLoad_a24be1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.msl
new file mode 100644
index 0000000..c025426
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_a24be1(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_a24be1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_a24be1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_a24be1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.spvasm
new file mode 100644
index 0000000..4182dea
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_a24be1 "textureLoad_a24be1"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %29 = OpConstantNull %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_a24be1 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %29
+ %19 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %25 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ %17 = OpImageFetch %v4uint %19 %25 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_a24be1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_a24be1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_a24be1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.wgsl
new file mode 100644
index 0000000..e938574
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/a24be1.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_a24be1() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a24be1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_a24be1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a24be1();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl
new file mode 100644
index 0000000..0430762
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<i32>, array_index: u32, level: i32) -> vec4<i32>
+fn textureLoad_b29f71() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b29f71();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b29f71();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b29f71();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..6e13a63
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_b29f71() {
+ int4 res = arg_0.Load(int4(0, 0, int(1u), 1));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b29f71();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b29f71();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b29f71();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..6e13a63
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_b29f71() {
+ int4 res = arg_0.Load(int4(0, 0, int(1u), 1));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b29f71();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b29f71();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b29f71();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.glsl
new file mode 100644
index 0000000..68402f9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_b29f71() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_b29f71();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_b29f71() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_b29f71();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_b29f71() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1);
+}
+
+void compute_main() {
+ textureLoad_b29f71();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.msl
new file mode 100644
index 0000000..2ee5823
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b29f71(texture2d_array<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(int2(0)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_b29f71(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b29f71(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b29f71(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.spvasm
new file mode 100644
index 0000000..dc7ad1c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b29f71 "textureLoad_b29f71"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpConstantNull %v4int
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b29f71 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %29
+ %19 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %25 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ %17 = OpImageFetch %v4int %19 %25 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_b29f71
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_b29f71
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_b29f71
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.wgsl
new file mode 100644
index 0000000..ff9172d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b29f71.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_b29f71() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b29f71();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b29f71();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b29f71();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl
new file mode 100644
index 0000000..3839395
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<u32>, array_index: i32, level: i32) -> f32
+fn textureLoad_b6ba5d() {
+ var res: f32 = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b6ba5d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b6ba5d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b6ba5d();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e01eb1d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_b6ba5d() {
+ float res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b6ba5d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b6ba5d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b6ba5d();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e01eb1d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_b6ba5d() {
+ float res = arg_0.Load(uint4(0u, 0u, uint(1), uint(1))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b6ba5d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b6ba5d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b6ba5d();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.glsl
new file mode 100644
index 0000000..aa48aab
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_b6ba5d() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_b6ba5d();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_b6ba5d() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1).x;
+}
+
+void fragment_main() {
+ textureLoad_b6ba5d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_b6ba5d() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, uint(1))), 1).x;
+}
+
+void compute_main() {
+ textureLoad_b6ba5d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.msl
new file mode 100644
index 0000000..e2c7340
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b6ba5d(depth2d_array<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(uint2(0u)), 1, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_b6ba5d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b6ba5d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b6ba5d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0063b9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b6ba5d "textureLoad_b6ba5d"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b6ba5d = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %25 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ %17 = OpImageFetch %v4float %18 %25 Lod %int_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_b6ba5d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_b6ba5d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_b6ba5d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.wgsl
new file mode 100644
index 0000000..03eb225
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b6ba5d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_b6ba5d() {
+ var res : f32 = textureLoad(arg_0, vec2<u32>(), 1i, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b6ba5d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b6ba5d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b6ba5d();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl
new file mode 100644
index 0000000..23f48da
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureLoad(texture: texture_2d<u32>, coords: vec2<u32>, level: i32) -> vec4<u32>
+fn textureLoad_b73f6b() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b73f6b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b73f6b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b73f6b();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..9d694aa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_b73f6b() {
+ uint4 res = arg_0.Load(uint3(0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b73f6b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b73f6b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b73f6b();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..9d694aa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_b73f6b() {
+ uint4 res = arg_0.Load(uint3(0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b73f6b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b73f6b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b73f6b();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.glsl
new file mode 100644
index 0000000..b9f8285
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_b73f6b() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_b73f6b();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_b73f6b() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_b73f6b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_b73f6b() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_b73f6b();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.msl
new file mode 100644
index 0000000..2515e7f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b73f6b(texture2d<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureLoad_b73f6b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b73f6b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b73f6b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.spvasm
new file mode 100644
index 0000000..991603f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b73f6b "textureLoad_b73f6b"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %v2uint = OpTypeVector %uint 2
+ %21 = OpConstantNull %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b73f6b = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %21 Lod %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_b73f6b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_b73f6b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_b73f6b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.wgsl
new file mode 100644
index 0000000..074690f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b73f6b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureLoad_b73f6b() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b73f6b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b73f6b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b73f6b();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl
new file mode 100644
index 0000000..6a6a232
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<f32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<f32>, coords: vec2<i32>, sample_index: u32) -> vec4<f32>
+fn textureLoad_b75d4a() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b75d4a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b75d4a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b75d4a();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1b77601
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_b75d4a() {
+ float4 res = arg_0.Load((0).xx, 1u);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b75d4a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b75d4a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b75d4a();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1b77601
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_b75d4a() {
+ float4 res = arg_0.Load((0).xx, 1u);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b75d4a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b75d4a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b75d4a();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.glsl
new file mode 100644
index 0000000..29de15d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_b75d4a() {
+ vec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_b75d4a();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_b75d4a() {
+ vec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_b75d4a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_b75d4a() {
+ vec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_b75d4a();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.msl
new file mode 100644
index 0000000..cb1c017
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b75d4a(texture2d_ms<float, access::read> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_b75d4a(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b75d4a(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b75d4a(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.spvasm
new file mode 100644
index 0000000..56442d6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b75d4a "textureLoad_b75d4a"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %20 = OpConstantNull %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b75d4a = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %20 Sample %uint_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureLoad_b75d4a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_b75d4a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_b75d4a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.wgsl
new file mode 100644
index 0000000..9a592a6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/b75d4a.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureLoad_b75d4a() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b75d4a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b75d4a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b75d4a();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl
new file mode 100644
index 0000000..ae600b1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureLoad(texture: texture_3d<f32>, coords: vec3<u32>, level: i32) -> vec4<f32>
+fn textureLoad_bcbb3c() {
+ var res: vec4<f32> = textureLoad(arg_0, vec3<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_bcbb3c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_bcbb3c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_bcbb3c();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8a88e0f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_bcbb3c() {
+ float4 res = arg_0.Load(uint4(0u, 0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_bcbb3c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_bcbb3c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_bcbb3c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8a88e0f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_bcbb3c() {
+ float4 res = arg_0.Load(uint4(0u, 0u, 0u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_bcbb3c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_bcbb3c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_bcbb3c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.glsl
new file mode 100644
index 0000000..008c403
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_bcbb3c() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_bcbb3c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_bcbb3c() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_bcbb3c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_bcbb3c() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_bcbb3c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.msl
new file mode 100644
index 0000000..c22a9b9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_bcbb3c(texture3d<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint3(uint3(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureLoad_bcbb3c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_bcbb3c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_bcbb3c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.spvasm
new file mode 100644
index 0000000..637018c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_bcbb3c "textureLoad_bcbb3c"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %20 = OpConstantNull %v3uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_bcbb3c = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %20 Lod %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureLoad_bcbb3c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_bcbb3c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_bcbb3c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.wgsl
new file mode 100644
index 0000000..a968218
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/bcbb3c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureLoad_bcbb3c() {
+ var res : vec4<f32> = textureLoad(arg_0, vec3<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_bcbb3c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_bcbb3c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_bcbb3c();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl
new file mode 100644
index 0000000..75e8289
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: u32, level: i32) -> f32
+fn textureLoad_c16e00() {
+ var res: f32 = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c16e00();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_c16e00();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c16e00();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..322a9ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_c16e00() {
+ float res = arg_0.Load(int4(0, 0, int(1u), 1)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_c16e00();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_c16e00();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_c16e00();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..322a9ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_c16e00() {
+ float res = arg_0.Load(int4(0, 0, int(1u), 1)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_c16e00();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_c16e00();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_c16e00();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.glsl
new file mode 100644
index 0000000..62fbdb9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_c16e00() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_c16e00();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_c16e00() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1).x;
+}
+
+void fragment_main() {
+ textureLoad_c16e00();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_c16e00() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, int(1u)), 1).x;
+}
+
+void compute_main() {
+ textureLoad_c16e00();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.msl
new file mode 100644
index 0000000..8159c0f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_c16e00(depth2d_array<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(int2(0)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_c16e00(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_c16e00(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_c16e00(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.spvasm
new file mode 100644
index 0000000..64906d9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_c16e00 "textureLoad_c16e00"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_c16e00 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %25 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ %17 = OpImageFetch %v4float %18 %25 Lod %int_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureLoad_c16e00
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_c16e00
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_c16e00
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.wgsl
new file mode 100644
index 0000000..6a7cf77
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/c16e00.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_c16e00() {
+ var res : f32 = textureLoad(arg_0, vec2<i32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c16e00();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_c16e00();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c16e00();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl
new file mode 100644
index 0000000..25ac317
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<u32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<u32>, coords: vec2<i32>, sample_index: u32) -> vec4<u32>
+fn textureLoad_cad5f2() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cad5f2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cad5f2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cad5f2();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0f93cc8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_cad5f2() {
+ uint4 res = arg_0.Load((0).xx, 1u);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cad5f2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cad5f2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cad5f2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0f93cc8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_cad5f2() {
+ uint4 res = arg_0.Load((0).xx, 1u);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cad5f2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cad5f2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cad5f2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.glsl
new file mode 100644
index 0000000..9e82ddf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_cad5f2() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_cad5f2();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_cad5f2() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_cad5f2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_cad5f2() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_cad5f2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.msl
new file mode 100644
index 0000000..8cc1c1b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_cad5f2(texture2d_ms<uint, access::read> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<uint, access::read> tint_symbol_2) {
+ textureLoad_cad5f2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<uint, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<uint, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_cad5f2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_cad5f2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.spvasm
new file mode 100644
index 0000000..7097846
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_cad5f2 "textureLoad_cad5f2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantNull %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_cad5f2 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %22 Sample %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_cad5f2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_cad5f2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_cad5f2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.wgsl
new file mode 100644
index 0000000..1420f61
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cad5f2.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureLoad_cad5f2() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cad5f2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cad5f2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cad5f2();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl
new file mode 100644
index 0000000..89a146b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<u32>, array_index: u32, level: i32) -> f32
+fn textureLoad_cb57c2() {
+ var res: f32 = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cb57c2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cb57c2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cb57c2();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..79442d0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_cb57c2() {
+ float res = arg_0.Load(uint4(0u, 0u, 1u, uint(1))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cb57c2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cb57c2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cb57c2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..79442d0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_cb57c2() {
+ float res = arg_0.Load(uint4(0u, 0u, 1u, uint(1))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cb57c2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cb57c2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cb57c2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.glsl
new file mode 100644
index 0000000..f71215d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_cb57c2() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_cb57c2();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_cb57c2() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1).x;
+}
+
+void fragment_main() {
+ textureLoad_cb57c2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_cb57c2() {
+ float res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1).x;
+}
+
+void compute_main() {
+ textureLoad_cb57c2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.msl
new file mode 100644
index 0000000..893d800
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_cb57c2(depth2d_array<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(uint2(0u)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_cb57c2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_cb57c2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_cb57c2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.spvasm
new file mode 100644
index 0000000..68a2176
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_cb57c2 "textureLoad_cb57c2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %23 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_cb57c2 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4float %18 %23 Lod %int_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_cb57c2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_cb57c2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_cb57c2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.wgsl
new file mode 100644
index 0000000..3cd1cd3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/cb57c2.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_cb57c2() {
+ var res : f32 = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cb57c2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cb57c2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cb57c2();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl
new file mode 100644
index 0000000..68abe1f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureLoad(texture: texture_3d<i32>, coords: vec3<i32>, level: u32) -> vec4<i32>
+fn textureLoad_e35f72() {
+ var res: vec4<i32> = textureLoad(arg_0, vec3<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_e35f72();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_e35f72();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_e35f72();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..de8d7fe
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_e35f72() {
+ int4 res = arg_0.Load(int4(0, 0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_e35f72();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_e35f72();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_e35f72();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..de8d7fe
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_e35f72() {
+ int4 res = arg_0.Load(int4(0, 0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_e35f72();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_e35f72();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_e35f72();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.glsl
new file mode 100644
index 0000000..0117c1a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_e35f72() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_e35f72();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_e35f72() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_e35f72();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_e35f72() {
+ ivec4 res = texelFetch(arg_0_1, ivec3(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_e35f72();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.msl
new file mode 100644
index 0000000..d26d358
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_e35f72(texture3d<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint3(int3(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureLoad_e35f72(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_e35f72(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_e35f72(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.spvasm
new file mode 100644
index 0000000..69920c5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_e35f72 "textureLoad_e35f72"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+ %21 = OpConstantNull %v3int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_e35f72 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %21 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_e35f72
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_e35f72
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_e35f72
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.wgsl
new file mode 100644
index 0000000..2e8197d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/e35f72.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureLoad_e35f72() {
+ var res : vec4<i32> = textureLoad(arg_0, vec3<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_e35f72();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_e35f72();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_e35f72();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl
new file mode 100644
index 0000000..4ee85a0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureLoad(texture: texture_2d<u32>, coords: vec2<i32>, level: u32) -> vec4<u32>
+fn textureLoad_ebfb92() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ebfb92();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ebfb92();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ebfb92();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ef22fda
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_ebfb92() {
+ uint4 res = arg_0.Load(int3(0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ebfb92();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ebfb92();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ebfb92();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ef22fda
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_ebfb92() {
+ uint4 res = arg_0.Load(int3(0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ebfb92();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ebfb92();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ebfb92();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.glsl
new file mode 100644
index 0000000..6176e8d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_ebfb92() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_ebfb92();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_ebfb92() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_ebfb92();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_ebfb92() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_ebfb92();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.msl
new file mode 100644
index 0000000..1310118
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_ebfb92(texture2d<uint, access::sample> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureLoad_ebfb92(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_ebfb92(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_ebfb92(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.spvasm
new file mode 100644
index 0000000..4e03907
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_ebfb92 "textureLoad_ebfb92"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %22 = OpConstantNull %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_ebfb92 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %22 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_ebfb92
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_ebfb92
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_ebfb92
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.wgsl
new file mode 100644
index 0000000..c2dd172
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ebfb92.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureLoad_ebfb92() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ebfb92();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ebfb92();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ebfb92();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl
new file mode 100644
index 0000000..96f2bca
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<f32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<f32>, coords: vec2<u32>, sample_index: i32) -> vec4<f32>
+fn textureLoad_f0abad() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f0abad();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f0abad();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f0abad();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0612336
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f0abad() {
+ float4 res = arg_0.Load((0u).xx, 1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f0abad();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f0abad();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f0abad();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0612336
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f0abad() {
+ float4 res = arg_0.Load((0u).xx, 1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f0abad();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f0abad();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f0abad();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.glsl
new file mode 100644
index 0000000..d5d441c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_f0abad() {
+ vec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_f0abad();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_f0abad() {
+ vec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_f0abad();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_f0abad() {
+ vec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_f0abad();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.msl
new file mode 100644
index 0000000..75cdfbf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_f0abad(texture2d_ms<float, access::read> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_f0abad(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_f0abad(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_f0abad(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.spvasm
new file mode 100644
index 0000000..e60070d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_f0abad "textureLoad_f0abad"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %20 = OpConstantNull %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_f0abad = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %20 Sample %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureLoad_f0abad
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_f0abad
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_f0abad
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.wgsl
new file mode 100644
index 0000000..f422c02
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f0abad.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureLoad_f0abad() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f0abad();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f0abad();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f0abad();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl
new file mode 100644
index 0000000..105dab7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<u32>, array_index: u32, level: i32) -> vec4<f32>
+fn textureLoad_f348d9() {
+ var res: vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f348d9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f348d9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f348d9();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cc20744
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f348d9() {
+ float4 res = arg_0.Load(uint4(0u, 0u, 1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f348d9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f348d9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f348d9();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cc20744
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f348d9() {
+ float4 res = arg_0.Load(uint4(0u, 0u, 1u, uint(1)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f348d9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f348d9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f348d9();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.glsl
new file mode 100644
index 0000000..9302278
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_f348d9() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_f348d9();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_f348d9() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_f348d9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_f348d9() {
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(0u, 0u, 1u)), 1);
+}
+
+void compute_main() {
+ textureLoad_f348d9();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.msl
new file mode 100644
index 0000000..65f4407
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_f348d9(texture2d_array<float, access::sample> tint_symbol_1) {
+ float4 res = tint_symbol_1.read(uint2(uint2(0u)), 1u, 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_f348d9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_f348d9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_f348d9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.spvasm
new file mode 100644
index 0000000..0c617c7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_f348d9 "textureLoad_f348d9"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %uint_1 = OpConstant %uint 1
+ %22 = OpConstantComposite %v3uint %uint_0 %uint_0 %uint_1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_f348d9 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ %17 = OpLoad %11 %arg_0
+ %16 = OpImageFetch %v4float %17 %22 Lod %int_1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_f348d9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_f348d9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_f348d9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.wgsl
new file mode 100644
index 0000000..7b599f1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f348d9.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_f348d9() {
+ var res : vec4<f32> = textureLoad(arg_0, vec2<u32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f348d9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f348d9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f348d9();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl
new file mode 100644
index 0000000..fcd1f60
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureLoad(texture: texture_2d<i32>, coords: vec2<i32>, level: u32) -> vec4<i32>
+fn textureLoad_f85291() {
+ var res: vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f85291();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f85291();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f85291();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..2f163b0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_f85291() {
+ int4 res = arg_0.Load(int3(0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f85291();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f85291();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f85291();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..2f163b0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_f85291() {
+ int4 res = arg_0.Load(int3(0, 0, int(1u)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f85291();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f85291();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f85291();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.glsl
new file mode 100644
index 0000000..8051539
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_f85291() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureLoad_f85291();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_f85291() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureLoad_f85291();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_f85291() {
+ ivec4 res = texelFetch(arg_0_1, ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureLoad_f85291();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.msl
new file mode 100644
index 0000000..5c0fefd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_f85291(texture2d<int, access::sample> tint_symbol_1) {
+ int4 res = tint_symbol_1.read(uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureLoad_f85291(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_f85291(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_f85291(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.spvasm
new file mode 100644
index 0000000..00b2ab5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_f85291 "textureLoad_f85291"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4int = OpTypeVector %int 4
+ %v2int = OpTypeVector %int 2
+ %21 = OpConstantNull %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_f85291 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4int Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4int %19 %21 Lod %uint_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_f85291
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_f85291
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_f85291
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.wgsl
new file mode 100644
index 0000000..56f3c1b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/f85291.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureLoad_f85291() {
+ var res : vec4<i32> = textureLoad(arg_0, vec2<i32>(), 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f85291();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f85291();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f85291();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl
new file mode 100644
index 0000000..b8e63aa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d;
+
+// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<u32>, sample_index: i32) -> f32
+fn textureLoad_fcd23d() {
+ var res: f32 = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fcd23d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fcd23d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fcd23d();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8ca9a66
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_fcd23d() {
+ float res = arg_0.Load(uint3(0u, 0u, uint(0)), 1).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fcd23d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fcd23d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fcd23d();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8ca9a66
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_fcd23d() {
+ float res = arg_0.Load(uint3(0u, 0u, uint(0)), 1).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fcd23d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fcd23d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fcd23d();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.glsl
new file mode 100644
index 0000000..87e28c88
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_fcd23d() {
+ float res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_fcd23d();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_fcd23d() {
+ float res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1).x;
+}
+
+void fragment_main() {
+ textureLoad_fcd23d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_fcd23d() {
+ float res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1).x;
+}
+
+void compute_main() {
+ textureLoad_fcd23d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.msl
new file mode 100644
index 0000000..159dd8d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_fcd23d(depth2d_ms<float, access::read> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_fcd23d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_fcd23d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_fcd23d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.spvasm
new file mode 100644
index 0000000..c504a4e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_fcd23d "textureLoad_fcd23d"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %21 = OpConstantNull %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_fcd23d = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4float %18 %21 Sample %int_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureLoad_fcd23d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_fcd23d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureLoad_fcd23d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.wgsl
new file mode 100644
index 0000000..8c90ff7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fcd23d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureLoad_fcd23d() {
+ var res : f32 = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fcd23d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fcd23d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fcd23d();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl
new file mode 100644
index 0000000..a85f8c2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<u32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<u32>, coords: vec2<u32>, sample_index: i32) -> vec4<u32>
+fn textureLoad_fe0565() {
+ var res: vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fe0565();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fe0565();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fe0565();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d4b0633
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_fe0565() {
+ uint4 res = arg_0.Load((0u).xx, 1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fe0565();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fe0565();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fe0565();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d4b0633
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_fe0565() {
+ uint4 res = arg_0.Load((0u).xx, 1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fe0565();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fe0565();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fe0565();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.glsl
new file mode 100644
index 0000000..5447511
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_fe0565() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+vec4 vertex_main() {
+ textureLoad_fe0565();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_fe0565() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void fragment_main() {
+ textureLoad_fe0565();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_fe0565() {
+ uvec4 res = texelFetch(arg_0_1, ivec2(uvec2(0u)), 1);
+}
+
+void compute_main() {
+ textureLoad_fe0565();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.msl
new file mode 100644
index 0000000..7e87a5c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_fe0565(texture2d_ms<uint, access::read> tint_symbol_1) {
+ uint4 res = tint_symbol_1.read(uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<uint, access::read> tint_symbol_2) {
+ textureLoad_fe0565(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<uint, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<uint, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_fe0565(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_fe0565(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.spvasm
new file mode 100644
index 0000000..9a345fb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_fe0565 "textureLoad_fe0565"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v4uint = OpTypeVector %uint 4
+ %v2uint = OpTypeVector %uint 2
+ %21 = OpConstantNull %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_fe0565 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v4uint Function %26
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4uint %19 %21 Sample %int_1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureLoad_fe0565
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_fe0565
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_fe0565
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.wgsl
new file mode 100644
index 0000000..6aba3a6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/fe0565.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureLoad_fe0565() {
+ var res : vec4<u32> = textureLoad(arg_0, vec2<u32>(), 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fe0565();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fe0565();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fe0565();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl
new file mode 100644
index 0000000..4c5826b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: i32, level: u32) -> f32
+fn textureLoad_ff1119() {
+ var res: f32 = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ff1119();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ff1119();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ff1119();
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4b0e14e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_ff1119() {
+ float res = arg_0.Load(int4(0, 0, 1, int(1u))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ff1119();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ff1119();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ff1119();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4b0e14e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_ff1119() {
+ float res = arg_0.Load(int4(0, 0, 1, int(1u))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ff1119();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ff1119();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ff1119();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.glsl
new file mode 100644
index 0000000..3a05870
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_ff1119() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_ff1119();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_ff1119() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u)).x;
+}
+
+void fragment_main() {
+ textureLoad_ff1119();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_ff1119() {
+ float res = texelFetch(arg_0_1, ivec3(0, 0, 1), int(1u)).x;
+}
+
+void compute_main() {
+ textureLoad_ff1119();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.msl
new file mode 100644
index 0000000..f136a44
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_ff1119(depth2d_array<float, access::sample> tint_symbol_1) {
+ float res = tint_symbol_1.read(uint2(int2(0)), 1, 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_ff1119(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_ff1119(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_ff1119(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.spvasm
new file mode 100644
index 0000000..faa0652
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_ff1119 "textureLoad_ff1119"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %int_1 = OpConstant %int 1
+ %23 = OpConstantComposite %v3int %int_0 %int_0 %int_1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_ff1119 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageFetch %v4float %18 %23 Lod %uint_1
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_ff1119
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureLoad_ff1119
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_ff1119
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.wgsl
new file mode 100644
index 0000000..de0e81a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureLoad/ff1119.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_ff1119() {
+ var res : f32 = textureLoad(arg_0, vec2<i32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ff1119();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ff1119();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ff1119();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl
new file mode 100644
index 0000000..3343ac7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: u32) -> f32
+fn textureSampleLevel_2974eb() {
+ var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_2974eb();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_2974eb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_2974eb();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d761407
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_2974eb() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1u).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_2974eb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d761407
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_2974eb() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1u).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_2974eb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.glsl
new file mode 100644
index 0000000..d2d5df8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_2974eb() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(1u));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_2974eb();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLod' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_2974eb() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(1u));
+}
+
+void fragment_main() {
+ textureSampleLevel_2974eb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:7: 'textureLod' : no matching overloaded function found
+ERROR: 0:7: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_2974eb() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(1u));
+}
+
+void compute_main() {
+ textureSampleLevel_2974eb();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLod' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.msl
new file mode 100644
index 0000000..35c8142
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_2974eb(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(1u));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_2974eb(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_2974eb(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_2974eb(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.spvasm
new file mode 100644
index 0000000..902d1d2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_2974eb "textureSampleLevel_2974eb"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %23 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_2974eb = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %21 = OpLoad %14 %arg_1
+ %22 = OpLoad %11 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %27 = OpConvertSToF %float %int_1
+ %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27
+ %31 = OpConvertSToF %float %uint_1
+ %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod %31
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureSampleLevel_2974eb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureSampleLevel_2974eb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleLevel_2974eb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.wgsl
new file mode 100644
index 0000000..a01f59b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/2974eb.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_2974eb() {
+ var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_2974eb();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_2974eb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_2974eb();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl
new file mode 100644
index 0000000..a9d9e0f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: u32, @const offset: vec2<i32>) -> f32
+fn textureSampleLevel_36f0d3() {
+ var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1i, 1u, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_36f0d3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_36f0d3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_36f0d3();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b36c713
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_36f0d3() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1u, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_36f0d3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b36c713
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_36f0d3() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1u, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_36f0d3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.glsl
new file mode 100644
index 0000000..6c1e027
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36f0d3() {
+ float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(1u), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_36f0d3();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36f0d3() {
+ float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(1u), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_36f0d3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:7: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:7: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36f0d3() {
+ float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1), 0.0f), float(1u), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_36f0d3();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.msl
new file mode 100644
index 0000000..a952104
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_36f0d3(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1, level(1u), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_36f0d3(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_36f0d3(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_36f0d3(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.spvasm
new file mode 100644
index 0000000..aaa56db
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_36f0d3 "textureSampleLevel_36f0d3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %23 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %35 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_36f0d3 = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %21 = OpLoad %14 %arg_1
+ %22 = OpLoad %11 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %27 = OpConvertSToF %float %int_1
+ %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27
+ %31 = OpConvertSToF %float %uint_1
+ %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %35
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleLevel_36f0d3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleLevel_36f0d3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleLevel_36f0d3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.wgsl
new file mode 100644
index 0000000..79a45ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/36f0d3.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_36f0d3() {
+ var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1i, 1u, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_36f0d3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_36f0d3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_36f0d3();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl
new file mode 100644
index 0000000..3d2edc9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: u32, level: i32) -> f32
+fn textureSampleLevel_3c3442() {
+ var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_3c3442();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_3c3442();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_3c3442();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..39cd161
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_3c3442() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1u)), 1).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_3c3442();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..39cd161
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_3c3442() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1u)), 1).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_3c3442();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.glsl
new file mode 100644
index 0000000..ecf8622
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_3c3442() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1u), 0.0f), float(1));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_3c3442();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLod' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_3c3442() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1u), 0.0f), float(1));
+}
+
+void fragment_main() {
+ textureSampleLevel_3c3442();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:7: 'textureLod' : no matching overloaded function found
+ERROR: 0:7: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_3c3442() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, float(1u), 0.0f), float(1));
+}
+
+void compute_main() {
+ textureSampleLevel_3c3442();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLod' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.msl
new file mode 100644
index 0000000..ce8ebea
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_3c3442(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1u, level(1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_3c3442(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_3c3442(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_3c3442(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.spvasm
new file mode 100644
index 0000000..2300632
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_3c3442 "textureSampleLevel_3c3442"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %23 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_3c3442 = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %21 = OpLoad %14 %arg_1
+ %22 = OpLoad %11 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %27 = OpConvertUToF %float %uint_1
+ %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27
+ %31 = OpConvertSToF %float %int_1
+ %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod %31
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureSampleLevel_3c3442
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureSampleLevel_3c3442
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleLevel_3c3442
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.wgsl
new file mode 100644
index 0000000..62d0573ec
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/3c3442.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_3c3442() {
+ var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_3c3442();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_3c3442();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_3c3442();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl
new file mode 100644
index 0000000..d02337a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32, level: u32) -> f32
+fn textureSampleLevel_a12142() {
+ var res: f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_a12142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_a12142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_a12142();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..881bbdb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_a12142() {
+ float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1u).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_a12142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_a12142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_a12142();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..881bbdb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_a12142() {
+ float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1u).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_a12142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_a12142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_a12142();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.glsl
new file mode 100644
index 0000000..278f53a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_a12142() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(1u));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_a12142();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_a12142() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(1u));
+}
+
+void fragment_main() {
+ textureSampleLevel_a12142();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_a12142() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1)), float(1u));
+}
+
+void compute_main() {
+ textureSampleLevel_a12142();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.msl
new file mode 100644
index 0000000..e2e6c7d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_a12142(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), 1, level(1u));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_a12142(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_a12142(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_a12142(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.spvasm
new file mode 100644
index 0000000..e3114b3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_a12142 "textureSampleLevel_a12142"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %23 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_a12142 = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %21 = OpLoad %14 %arg_1
+ %22 = OpLoad %11 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %26 = OpConvertSToF %float %int_1
+ %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %26
+ %30 = OpConvertSToF %float %uint_1
+ %20 = OpImageSampleExplicitLod %v4float %24 %29 Lod %30
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleLevel_a12142
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureSampleLevel_a12142
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleLevel_a12142
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.wgsl
new file mode 100644
index 0000000..6644810
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/a12142.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_a12142() {
+ var res : f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1i, 1u);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_a12142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_a12142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_a12142();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl
new file mode 100644
index 0000000..7894b70
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: u32, level: i32, @const offset: vec2<i32>) -> f32
+fn textureSampleLevel_e6ce9e() {
+ var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1u, 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_e6ce9e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_e6ce9e();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..62c3ca3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_e6ce9e() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1u)), 1, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_e6ce9e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..62c3ca3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_e6ce9e() {
+ float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1u)), 1, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_e6ce9e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.glsl
new file mode 100644
index 0000000..203b99a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_e6ce9e() {
+ float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1u), 0.0f), float(1), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_e6ce9e();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_e6ce9e() {
+ float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1u), 0.0f), float(1), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:7: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:7: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_e6ce9e() {
+ float res = textureLodOffset(arg_0_arg_1, vec4(0.0f, 0.0f, float(1u), 0.0f), float(1), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:6: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.msl
new file mode 100644
index 0000000..cdf6cd4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_e6ce9e(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float res = tint_symbol_1.sample(tint_symbol_2, float2(0.0f), 1u, level(1), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_e6ce9e(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_e6ce9e(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_e6ce9e(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.spvasm
new file mode 100644
index 0000000..387a582
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_e6ce9e "textureSampleLevel_e6ce9e"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %23 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %35 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_e6ce9e = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %21 = OpLoad %14 %arg_1
+ %22 = OpLoad %11 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %27 = OpConvertUToF %float %uint_1
+ %30 = OpCompositeConstruct %v3float %float_0 %float_0 %27
+ %31 = OpConvertSToF %float %int_1
+ %20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %35
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleLevel_e6ce9e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleLevel_e6ce9e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleLevel_e6ce9e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.wgsl
new file mode 100644
index 0000000..765f731
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/e6ce9e.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_e6ce9e() {
+ var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1u, 1i, vec2<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_e6ce9e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_e6ce9e();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl
new file mode 100644
index 0000000..6407b2c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: u32, level: i32) -> f32
+fn textureSampleLevel_ff11bc() {
+ var res: f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_ff11bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_ff11bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_ff11bc();
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..aaffccf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_ff11bc() {
+ float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1u)), 1).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_ff11bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..aaffccf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,33 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_ff11bc() {
+ float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1u)), 1).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_ff11bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.glsl
new file mode 100644
index 0000000..dd5a844
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ff11bc() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1u)), float(1));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_ff11bc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ff11bc() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1u)), float(1));
+}
+
+void fragment_main() {
+ textureSampleLevel_ff11bc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ff11bc() {
+ float res = textureLod(arg_0_arg_1, vec4(0.0f, 0.0f, 0.0f, float(1u)), float(1));
+}
+
+void compute_main() {
+ textureSampleLevel_ff11bc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.msl
new file mode 100644
index 0000000..2791c64
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_ff11bc(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float res = tint_symbol_1.sample(tint_symbol_2, float3(0.0f), 1u, level(1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_ff11bc(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_ff11bc(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_ff11bc(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.spvasm
new file mode 100644
index 0000000..9fb572a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_ff11bc "textureSampleLevel_ff11bc"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %23 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_ff11bc = OpFunction %void None %15
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ %21 = OpLoad %14 %arg_1
+ %22 = OpLoad %11 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %26 = OpConvertUToF %float %uint_1
+ %29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %26
+ %30 = OpConvertSToF %float %int_1
+ %20 = OpImageSampleExplicitLod %v4float %24 %29 Lod %30
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleLevel_ff11bc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureSampleLevel_ff11bc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleLevel_ff11bc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.wgsl
new file mode 100644
index 0000000..43278dd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureSampleLevel/ff11bc.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_ff11bc() {
+ var res : f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1u, 1i);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_ff11bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_ff11bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_ff11bc();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl
new file mode 100644
index 0000000..127f5d6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_00ca64() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_00ca64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_00ca64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_00ca64();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4c43d09
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_00ca64() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_00ca64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_00ca64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_00ca64();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4c43d09
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_00ca64() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_00ca64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_00ca64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_00ca64();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.glsl
new file mode 100644
index 0000000..1227661
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_00ca64() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_00ca64();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_00ca64() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_00ca64();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_00ca64() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_00ca64();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.msl
new file mode 100644
index 0000000..61e534f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_00ca64(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_00ca64(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_00ca64(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_00ca64(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.spvasm
new file mode 100644
index 0000000..ec49a65
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_00ca64 "textureStore_00ca64"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_00ca64 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_00ca64
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_00ca64
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_00ca64
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.wgsl
new file mode 100644
index 0000000..6bc9e2c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/00ca64.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureStore_00ca64() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_00ca64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_00ca64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_00ca64();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl
new file mode 100644
index 0000000..10d0c4e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_0148bd() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0148bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0148bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0148bd();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..49a4ea9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0148bd() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0148bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0148bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0148bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..49a4ea9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0148bd() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0148bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0148bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0148bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.glsl
new file mode 100644
index 0000000..5b2168a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0148bd() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_0148bd();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0148bd() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_0148bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0148bd() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_0148bd();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.msl
new file mode 100644
index 0000000..508c653
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0148bd(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_0148bd(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0148bd(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0148bd(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..464aac9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_0148bd "textureStore_0148bd"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0148bd = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_0148bd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_0148bd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_0148bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..b9cae8b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0148bd.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureStore_0148bd() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0148bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0148bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0148bd();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl
new file mode 100644
index 0000000..1c43f8d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_06e49c() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_06e49c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_06e49c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_06e49c();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7ccdde8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_06e49c() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_06e49c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_06e49c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_06e49c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7ccdde8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_06e49c() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_06e49c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_06e49c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_06e49c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.glsl
new file mode 100644
index 0000000..1c9a1cc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_06e49c() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_06e49c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_06e49c() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_06e49c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_06e49c() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_06e49c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.msl
new file mode 100644
index 0000000..feafa4d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_06e49c(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_06e49c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_06e49c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_06e49c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.spvasm
new file mode 100644
index 0000000..be0e588
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_06e49c "textureStore_06e49c"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_06e49c = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_06e49c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_06e49c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_06e49c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.wgsl
new file mode 100644
index 0000000..b9ddf2e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/06e49c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureStore_06e49c() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_06e49c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_06e49c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_06e49c();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl
new file mode 100644
index 0000000..3899f39
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_0a1a79() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0a1a79();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0a1a79();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0a1a79();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..872f431
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_0a1a79() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0a1a79();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0a1a79();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0a1a79();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..872f431
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_0a1a79() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0a1a79();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0a1a79();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0a1a79();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.glsl
new file mode 100644
index 0000000..7aacbb9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_0a1a79() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_0a1a79();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_0a1a79() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_0a1a79();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_0a1a79() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_0a1a79();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.msl
new file mode 100644
index 0000000..05cd137
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0a1a79(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_0a1a79(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0a1a79(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0a1a79(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.spvasm
new file mode 100644
index 0000000..2a4e581
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_0a1a79 "textureStore_0a1a79"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0a1a79 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_0a1a79
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_0a1a79
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_0a1a79
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.wgsl
new file mode 100644
index 0000000..0c98262
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0a1a79.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureStore_0a1a79() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0a1a79();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0a1a79();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0a1a79();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl
new file mode 100644
index 0000000..65e450c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_0cc825() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0cc825();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0cc825();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0cc825();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bf58d44
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0cc825() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0cc825();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0cc825();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0cc825();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bf58d44
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0cc825() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0cc825();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0cc825();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0cc825();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.glsl
new file mode 100644
index 0000000..e22d8d7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0cc825() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_0cc825();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0cc825() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_0cc825();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0cc825() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_0cc825();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.msl
new file mode 100644
index 0000000..5f737ac
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0cc825(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_0cc825(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0cc825(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0cc825(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.spvasm
new file mode 100644
index 0000000..1eeb64f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_0cc825 "textureStore_0cc825"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0cc825 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_0cc825
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_0cc825
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_0cc825
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.wgsl
new file mode 100644
index 0000000..9a44567
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/0cc825.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureStore_0cc825() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0cc825();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0cc825();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0cc825();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl
new file mode 100644
index 0000000..5a8267a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_1f1ef8() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1f1ef8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_1f1ef8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_1f1ef8();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c38dfe8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_1f1ef8() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_1f1ef8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_1f1ef8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_1f1ef8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c38dfe8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_1f1ef8() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_1f1ef8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_1f1ef8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_1f1ef8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.glsl
new file mode 100644
index 0000000..72a9bec5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1f1ef8() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_1f1ef8();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1f1ef8() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_1f1ef8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1f1ef8() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_1f1ef8();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.msl
new file mode 100644
index 0000000..b85f5e5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_1f1ef8(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_1f1ef8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_1f1ef8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_1f1ef8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.spvasm
new file mode 100644
index 0000000..6aff314
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_1f1ef8 "textureStore_1f1ef8"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_1f1ef8 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_1f1ef8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_1f1ef8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_1f1ef8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.wgsl
new file mode 100644
index 0000000..1651670
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/1f1ef8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureStore_1f1ef8() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1f1ef8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_1f1ef8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_1f1ef8();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl
new file mode 100644
index 0000000..415716e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8snorm, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_22f045() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_22f045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_22f045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_22f045();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ae1649c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_22f045() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_22f045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_22f045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_22f045();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ae1649c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_22f045() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_22f045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_22f045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_22f045();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.glsl
new file mode 100644
index 0000000..204ab9d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_22f045() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_22f045();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_22f045() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_22f045();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_22f045() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_22f045();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.msl
new file mode 100644
index 0000000..f07f39f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_22f045(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_22f045(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_22f045(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_22f045(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.spvasm
new file mode 100644
index 0000000..69ce3d4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_22f045 "textureStore_22f045"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_22f045 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_22f045
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_22f045
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_22f045
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.wgsl
new file mode 100644
index 0000000..688f6a4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/22f045.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureStore_22f045() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_22f045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_22f045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_22f045();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl
new file mode 100644
index 0000000..09b48b1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_2383fc() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2383fc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_2383fc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_2383fc();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..3e78178
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_2383fc() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2383fc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_2383fc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2383fc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..3e78178
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_2383fc() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2383fc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_2383fc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2383fc();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.glsl
new file mode 100644
index 0000000..6691080
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_2383fc() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_2383fc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_2383fc() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_2383fc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_2383fc() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_2383fc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.msl
new file mode 100644
index 0000000..b56a39a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_2383fc(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_2383fc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_2383fc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_2383fc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b7a731
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_2383fc "textureStore_2383fc"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_2383fc = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_2383fc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_2383fc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_2383fc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.wgsl
new file mode 100644
index 0000000..58bfd01
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/2383fc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureStore_2383fc() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2383fc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_2383fc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_2383fc();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl
new file mode 100644
index 0000000..a0c5fcb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8unorm, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_258ab0() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_258ab0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_258ab0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_258ab0();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..60afdb8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_258ab0() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_258ab0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_258ab0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_258ab0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..60afdb8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_258ab0() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_258ab0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_258ab0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_258ab0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.glsl
new file mode 100644
index 0000000..8590cc9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_258ab0() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_258ab0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_258ab0() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_258ab0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_258ab0() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_258ab0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.msl
new file mode 100644
index 0000000..0a3abff
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_258ab0(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_258ab0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_258ab0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_258ab0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.spvasm
new file mode 100644
index 0000000..3333cbe
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_258ab0 "textureStore_258ab0"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_258ab0 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_258ab0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_258ab0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_258ab0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.wgsl
new file mode 100644
index 0000000..40d4997
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/258ab0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureStore_258ab0() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_258ab0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_258ab0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_258ab0();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl
new file mode 100644
index 0000000..1146908
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_28a7ec() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_28a7ec();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_28a7ec();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_28a7ec();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..828727c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_28a7ec() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_28a7ec();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_28a7ec();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_28a7ec();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..828727c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_28a7ec() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_28a7ec();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_28a7ec();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_28a7ec();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.glsl
new file mode 100644
index 0000000..53936c4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_28a7ec() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_28a7ec();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_28a7ec() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_28a7ec();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_28a7ec() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_28a7ec();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.msl
new file mode 100644
index 0000000..65d7504
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_28a7ec(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_28a7ec(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_28a7ec(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_28a7ec(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.spvasm
new file mode 100644
index 0000000..51ce8d9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_28a7ec "textureStore_28a7ec"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 R32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_28a7ec = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_28a7ec
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_28a7ec
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_28a7ec
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.wgsl
new file mode 100644
index 0000000..01b44fa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/28a7ec.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureStore_28a7ec() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_28a7ec();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_28a7ec();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_28a7ec();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl
new file mode 100644
index 0000000..b4d61dc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_30b0b0() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_30b0b0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_30b0b0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_30b0b0();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..21e26cc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_30b0b0() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_30b0b0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_30b0b0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_30b0b0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..21e26cc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_30b0b0() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_30b0b0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_30b0b0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_30b0b0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.glsl
new file mode 100644
index 0000000..6e95a8b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_30b0b0() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_30b0b0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_30b0b0() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_30b0b0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_30b0b0() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_30b0b0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.msl
new file mode 100644
index 0000000..540c35a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_30b0b0(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_30b0b0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_30b0b0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_30b0b0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.spvasm
new file mode 100644
index 0000000..4eef3b4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_30b0b0 "textureStore_30b0b0"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_30b0b0 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_30b0b0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_30b0b0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_30b0b0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.wgsl
new file mode 100644
index 0000000..158559f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/30b0b0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureStore_30b0b0() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_30b0b0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_30b0b0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_30b0b0();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl
new file mode 100644
index 0000000..4119114
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_33cec0() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_33cec0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_33cec0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_33cec0();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..86c488b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_33cec0() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_33cec0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_33cec0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_33cec0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..86c488b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_33cec0() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_33cec0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_33cec0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_33cec0();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.glsl
new file mode 100644
index 0000000..26fe35d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_33cec0() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_33cec0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_33cec0() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_33cec0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_33cec0() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_33cec0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.msl
new file mode 100644
index 0000000..0f73a0c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_33cec0(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_33cec0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_33cec0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_33cec0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.spvasm
new file mode 100644
index 0000000..b62536b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_33cec0 "textureStore_33cec0"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_33cec0 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_33cec0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_33cec0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_33cec0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.wgsl
new file mode 100644
index 0000000..5ee34fe
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/33cec0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureStore_33cec0() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_33cec0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_33cec0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_33cec0();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl
new file mode 100644
index 0000000..f8299a6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_37ffd4() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_37ffd4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_37ffd4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_37ffd4();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7bafb82
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_37ffd4() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_37ffd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_37ffd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_37ffd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7bafb82
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_37ffd4() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_37ffd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_37ffd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_37ffd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.glsl
new file mode 100644
index 0000000..1c7cfb6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_37ffd4() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_37ffd4();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_37ffd4() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_37ffd4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_37ffd4() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_37ffd4();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.msl
new file mode 100644
index 0000000..85bb75c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_37ffd4(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_37ffd4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_37ffd4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_37ffd4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.spvasm
new file mode 100644
index 0000000..b865d9c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_37ffd4 "textureStore_37ffd4"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_37ffd4 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_37ffd4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_37ffd4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_37ffd4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.wgsl
new file mode 100644
index 0000000..1142990
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/37ffd4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureStore_37ffd4() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_37ffd4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_37ffd4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_37ffd4();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl
new file mode 100644
index 0000000..1cd12d9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_44daa7() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_44daa7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_44daa7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_44daa7();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..987f074
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_44daa7() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_44daa7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_44daa7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_44daa7();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..987f074
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_44daa7() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_44daa7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_44daa7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_44daa7();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.glsl
new file mode 100644
index 0000000..a45332f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_44daa7() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_44daa7();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_44daa7() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_44daa7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_44daa7() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_44daa7();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.msl
new file mode 100644
index 0000000..65604af
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_44daa7(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_44daa7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_44daa7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_44daa7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.spvasm
new file mode 100644
index 0000000..3a6ccca
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_44daa7 "textureStore_44daa7"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_44daa7 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_44daa7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_44daa7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_44daa7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.wgsl
new file mode 100644
index 0000000..1deb175
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/44daa7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureStore_44daa7() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_44daa7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_44daa7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_44daa7();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl
new file mode 100644
index 0000000..f239e4e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_4d359d() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_4d359d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_4d359d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_4d359d();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..39ad70a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_4d359d() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_4d359d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_4d359d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_4d359d();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..39ad70a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_4d359d() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_4d359d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_4d359d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_4d359d();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.glsl
new file mode 100644
index 0000000..b1e3929
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_4d359d() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_4d359d();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_4d359d() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_4d359d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_4d359d() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_4d359d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.msl
new file mode 100644
index 0000000..db817af
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_4d359d(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_4d359d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_4d359d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_4d359d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.spvasm
new file mode 100644
index 0000000..a218220
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_4d359d "textureStore_4d359d"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_4d359d = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_4d359d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_4d359d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_4d359d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.wgsl
new file mode 100644
index 0000000..aeeef6a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/4d359d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureStore_4d359d() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_4d359d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_4d359d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_4d359d();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl
new file mode 100644
index 0000000..482beb0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8snorm, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_59a0ab() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_59a0ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_59a0ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_59a0ab();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1a0d898
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_59a0ab() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_59a0ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_59a0ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_59a0ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1a0d898
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_59a0ab() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_59a0ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_59a0ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_59a0ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.glsl
new file mode 100644
index 0000000..d89b2c7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_59a0ab() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_59a0ab();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_59a0ab() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_59a0ab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_59a0ab() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_59a0ab();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.msl
new file mode 100644
index 0000000..b77b7dd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_59a0ab(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_59a0ab(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_59a0ab(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_59a0ab(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.spvasm
new file mode 100644
index 0000000..d2ecfac
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_59a0ab "textureStore_59a0ab"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_59a0ab = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_59a0ab
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_59a0ab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_59a0ab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.wgsl
new file mode 100644
index 0000000..2b2d44c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/59a0ab.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureStore_59a0ab() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_59a0ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_59a0ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_59a0ab();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl
new file mode 100644
index 0000000..9b84f6d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_5ddc61() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_5ddc61();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_5ddc61();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_5ddc61();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e916cf9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_5ddc61() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_5ddc61();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_5ddc61();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_5ddc61();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e916cf9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_5ddc61() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_5ddc61();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_5ddc61();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_5ddc61();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.glsl
new file mode 100644
index 0000000..a94cc1a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_5ddc61() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_5ddc61();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_5ddc61() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_5ddc61();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_5ddc61() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_5ddc61();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.msl
new file mode 100644
index 0000000..e8b62ee
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_5ddc61(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_5ddc61(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_5ddc61(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_5ddc61(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.spvasm
new file mode 100644
index 0000000..68f61b9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_5ddc61 "textureStore_5ddc61"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_5ddc61 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_5ddc61
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_5ddc61
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_5ddc61
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.wgsl
new file mode 100644
index 0000000..de8f621
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/5ddc61.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureStore_5ddc61() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_5ddc61();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_5ddc61();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_5ddc61();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl
new file mode 100644
index 0000000..92689e1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_658a74() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_658a74();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_658a74();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_658a74();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d3dcb5b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_658a74() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_658a74();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_658a74();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_658a74();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d3dcb5b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_658a74() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_658a74();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_658a74();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_658a74();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.glsl
new file mode 100644
index 0000000..0724c65
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_658a74() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_658a74();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_658a74() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_658a74();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_658a74() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_658a74();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.msl
new file mode 100644
index 0000000..0921ddc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_658a74(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_658a74(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_658a74(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_658a74(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.spvasm
new file mode 100644
index 0000000..5607331
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_658a74 "textureStore_658a74"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_658a74 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_658a74
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_658a74
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_658a74
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.wgsl
new file mode 100644
index 0000000..9c8cc3a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/658a74.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureStore_658a74() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_658a74();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_658a74();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_658a74();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl
new file mode 100644
index 0000000..b909a03
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_6f8642() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6f8642();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_6f8642();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_6f8642();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..61a68cf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_6f8642() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6f8642();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_6f8642();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6f8642();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..61a68cf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_6f8642() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6f8642();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_6f8642();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6f8642();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.glsl
new file mode 100644
index 0000000..9471f9b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6f8642() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_6f8642();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6f8642() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_6f8642();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6f8642() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_6f8642();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.msl
new file mode 100644
index 0000000..233e519
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_6f8642(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_6f8642(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_6f8642(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_6f8642(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.spvasm
new file mode 100644
index 0000000..2ce57c6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_6f8642 "textureStore_6f8642"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_6f8642 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_6f8642
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_6f8642
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_6f8642
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.wgsl
new file mode 100644
index 0000000..631e3c1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/6f8642.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureStore_6f8642() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6f8642();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_6f8642();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_6f8642();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl
new file mode 100644
index 0000000..93ebb93
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_72fa64() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_72fa64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_72fa64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_72fa64();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..86c2bf4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_72fa64() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_72fa64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_72fa64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_72fa64();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..86c2bf4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_72fa64() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_72fa64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_72fa64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_72fa64();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.glsl
new file mode 100644
index 0000000..9b394c8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_72fa64() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_72fa64();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_72fa64() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_72fa64();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_72fa64() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_72fa64();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.msl
new file mode 100644
index 0000000..a9d5d54
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_72fa64(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_72fa64(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_72fa64(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_72fa64(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b421e0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_72fa64 "textureStore_72fa64"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_72fa64 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_72fa64
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_72fa64
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_72fa64
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.wgsl
new file mode 100644
index 0000000..cb9be28
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/72fa64.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureStore_72fa64() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_72fa64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_72fa64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_72fa64();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl
new file mode 100644
index 0000000..dd6f0c7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_7bb211() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7bb211();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_7bb211();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_7bb211();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b1a3e77
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_7bb211() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_7bb211();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_7bb211();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_7bb211();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b1a3e77
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_7bb211() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_7bb211();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_7bb211();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_7bb211();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.glsl
new file mode 100644
index 0000000..12f9790
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7bb211() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_7bb211();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7bb211() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_7bb211();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7bb211() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_7bb211();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.msl
new file mode 100644
index 0000000..54eca42
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_7bb211(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_7bb211(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_7bb211(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_7bb211(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.spvasm
new file mode 100644
index 0000000..fde30d8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_7bb211 "textureStore_7bb211"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_7bb211 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_7bb211
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_7bb211
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_7bb211
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.wgsl
new file mode 100644
index 0000000..99a7440
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/7bb211.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureStore_7bb211() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7bb211();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_7bb211();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_7bb211();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl
new file mode 100644
index 0000000..eca69e7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_8ff674() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8ff674();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_8ff674();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_8ff674();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..478e857
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_8ff674() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_8ff674();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_8ff674();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_8ff674();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..478e857
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_8ff674() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_8ff674();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_8ff674();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_8ff674();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.glsl
new file mode 100644
index 0000000..dc5d86b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8ff674() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_8ff674();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8ff674() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_8ff674();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8ff674() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_8ff674();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.msl
new file mode 100644
index 0000000..ae3354e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_8ff674(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_8ff674(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_8ff674(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_8ff674(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.spvasm
new file mode 100644
index 0000000..d97d70a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_8ff674 "textureStore_8ff674"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_8ff674 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_8ff674
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_8ff674
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_8ff674
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.wgsl
new file mode 100644
index 0000000..b313be4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/8ff674.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureStore_8ff674() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8ff674();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_8ff674();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_8ff674();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl
new file mode 100644
index 0000000..6992b60
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_9938b7() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9938b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9938b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9938b7();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1a75432
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_9938b7() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9938b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9938b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9938b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1a75432
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_9938b7() {
+ arg_0[int3(0, 0, int(1u))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9938b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9938b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9938b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.glsl
new file mode 100644
index 0000000..e448b68
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_9938b7() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_9938b7();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_9938b7() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_9938b7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_9938b7() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_9938b7();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.msl
new file mode 100644
index 0000000..5e76a03
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9938b7(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_9938b7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9938b7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9938b7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.spvasm
new file mode 100644
index 0000000..265968a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_9938b7 "textureStore_9938b7"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 R32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9938b7 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_9938b7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_9938b7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_9938b7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.wgsl
new file mode 100644
index 0000000..ed0775f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9938b7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureStore_9938b7() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9938b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9938b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9938b7();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl
new file mode 100644
index 0000000..805fbf2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8unorm, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_9d8668() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9d8668();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9d8668();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9d8668();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..29f00cc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_9d8668() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9d8668();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9d8668();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9d8668();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..29f00cc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_9d8668() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9d8668();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9d8668();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9d8668();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.glsl
new file mode 100644
index 0000000..bb433ee
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d8668() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_9d8668();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d8668() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_9d8668();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d8668() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_9d8668();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.msl
new file mode 100644
index 0000000..83778bb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9d8668(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_9d8668(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9d8668(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9d8668(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.spvasm
new file mode 100644
index 0000000..7c36c49
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_9d8668 "textureStore_9d8668"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9d8668 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_9d8668
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_9d8668
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_9d8668
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.wgsl
new file mode 100644
index 0000000..8f30157
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9d8668.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureStore_9d8668() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9d8668();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9d8668();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9d8668();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl
new file mode 100644
index 0000000..a100c70
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_9f7cea() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9f7cea();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9f7cea();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9f7cea();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..dfb1462
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_9f7cea() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9f7cea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9f7cea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9f7cea();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..dfb1462
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_9f7cea() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9f7cea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9f7cea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9f7cea();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.glsl
new file mode 100644
index 0000000..4639026
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_9f7cea() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_9f7cea();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_9f7cea() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_9f7cea();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_9f7cea() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_9f7cea();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.msl
new file mode 100644
index 0000000..6ebb568
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9f7cea(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_9f7cea(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9f7cea(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9f7cea(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.spvasm
new file mode 100644
index 0000000..09b1bdd
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_9f7cea "textureStore_9f7cea"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9f7cea = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_9f7cea
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_9f7cea
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_9f7cea
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.wgsl
new file mode 100644
index 0000000..2cfc03b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/9f7cea.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureStore_9f7cea() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9f7cea();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9f7cea();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9f7cea();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl
new file mode 100644
index 0000000..8bbdda2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_a6a986() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_a6a986();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_a6a986();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_a6a986();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7129e59
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_a6a986() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_a6a986();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_a6a986();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_a6a986();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7129e59
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_a6a986() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_a6a986();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_a6a986();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_a6a986();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.glsl
new file mode 100644
index 0000000..0d9db4a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_a6a986() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_a6a986();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_a6a986() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_a6a986();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_a6a986() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_a6a986();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.msl
new file mode 100644
index 0000000..ecbe6c0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_a6a986(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_a6a986(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_a6a986(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_a6a986(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.spvasm
new file mode 100644
index 0000000..08a3859
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_a6a986 "textureStore_a6a986"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_a6a986 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_a6a986
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_a6a986
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_a6a986
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.wgsl
new file mode 100644
index 0000000..a07b3a2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/a6a986.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureStore_a6a986() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_a6a986();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_a6a986();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_a6a986();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl
new file mode 100644
index 0000000..ad57368
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_c32905() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c32905();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_c32905();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_c32905();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8bb2be1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_c32905() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_c32905();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_c32905();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_c32905();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8bb2be1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_c32905() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_c32905();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_c32905();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_c32905();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.glsl
new file mode 100644
index 0000000..1992aea
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_c32905() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+vec4 vertex_main() {
+ textureStore_c32905();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_c32905() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void fragment_main() {
+ textureStore_c32905();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_c32905() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), ivec4(0));
+}
+
+void compute_main() {
+ textureStore_c32905();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.msl
new file mode 100644
index 0000000..5365b9d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_c32905(texture2d_array<int, access::write> tint_symbol_1) {
+ tint_symbol_1.write(int4(0), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_c32905(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_c32905(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_c32905(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.spvasm
new file mode 100644
index 0000000..81e223f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_c32905 "textureStore_c32905"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int_1 = OpConstant %int 1
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_c32905 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_c32905
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_c32905
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_c32905
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.wgsl
new file mode 100644
index 0000000..1f62744
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/c32905.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureStore_c32905() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<i32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c32905();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_c32905();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_c32905();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl
new file mode 100644
index 0000000..4477682
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_d55e65() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_d55e65();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_d55e65();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_d55e65();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..2da0b0d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_d55e65() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_d55e65();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_d55e65();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_d55e65();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..2da0b0d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_d55e65() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_d55e65();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_d55e65();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_d55e65();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.glsl
new file mode 100644
index 0000000..a13f035
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_d55e65() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_d55e65();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_d55e65() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_d55e65();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_d55e65() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_d55e65();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.msl
new file mode 100644
index 0000000..2ba46c3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_d55e65(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_d55e65(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_d55e65(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_d55e65(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.spvasm
new file mode 100644
index 0000000..6a858f4
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_d55e65 "textureStore_d55e65"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_d55e65 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_d55e65
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_d55e65
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_d55e65
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.wgsl
new file mode 100644
index 0000000..75e91b5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/d55e65.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureStore_d55e65() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_d55e65();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_d55e65();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_d55e65();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl
new file mode 100644
index 0000000..437f7f2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_df2ca4() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_df2ca4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_df2ca4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_df2ca4();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..baf4f2f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_df2ca4() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_df2ca4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_df2ca4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_df2ca4();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..baf4f2f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_df2ca4() {
+ arg_0[int3(0, 0, int(1u))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_df2ca4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_df2ca4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_df2ca4();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.glsl
new file mode 100644
index 0000000..eea8131
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_df2ca4() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_df2ca4();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_df2ca4() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_df2ca4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_df2ca4() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_df2ca4();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.msl
new file mode 100644
index 0000000..00b2bb9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_df2ca4(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_df2ca4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_df2ca4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_df2ca4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.spvasm
new file mode 100644
index 0000000..401fcfb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_df2ca4 "textureStore_df2ca4"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_df2ca4 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_df2ca4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_df2ca4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_df2ca4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.wgsl
new file mode 100644
index 0000000..a70a6fa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/df2ca4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureStore_df2ca4() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_df2ca4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_df2ca4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_df2ca4();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl
new file mode 100644
index 0000000..5f998f9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_dfa9a1() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dfa9a1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dfa9a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dfa9a1();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..2e48f79
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_dfa9a1() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dfa9a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dfa9a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dfa9a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..2e48f79
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_dfa9a1() {
+ arg_0[uint3(0u, 0u, uint(1))] = (0.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dfa9a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dfa9a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dfa9a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.glsl
new file mode 100644
index 0000000..abd5457
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_dfa9a1() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+vec4 vertex_main() {
+ textureStore_dfa9a1();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_dfa9a1() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void fragment_main() {
+ textureStore_dfa9a1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_dfa9a1() {
+ imageStore(arg_0, ivec3(uvec3(0u, 0u, uint(1))), vec4(0.0f));
+}
+
+void compute_main() {
+ textureStore_dfa9a1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.msl
new file mode 100644
index 0000000..22747d5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_dfa9a1(texture2d_array<float, access::write> tint_symbol_1) {
+ tint_symbol_1.write(float4(0.0f), uint2(uint2(0u)), 1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_dfa9a1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_dfa9a1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_dfa9a1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..1ab8b71
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_dfa9a1 "textureStore_dfa9a1"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %uint_0 = OpConstant %uint 0
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_dfa9a1 = OpFunction %void None %12
+ %15 = OpLabel
+ %17 = OpLoad %11 %arg_0
+ %21 = OpBitcast %uint %int_1
+ %24 = OpCompositeConstruct %v3uint %uint_0 %uint_0 %21
+ OpImageWrite %17 %24 %5
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureStore_dfa9a1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureStore_dfa9a1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureStore_dfa9a1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..a930131
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dfa9a1.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureStore_dfa9a1() {
+ textureStore(arg_0, vec2<u32>(), 1i, vec4<f32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dfa9a1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dfa9a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dfa9a1();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl
new file mode 100644
index 0000000..9621682
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_dffb13() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dffb13();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dffb13();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dffb13();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..84db8e5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_dffb13() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dffb13();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dffb13();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dffb13();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..84db8e5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_dffb13() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dffb13();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dffb13();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dffb13();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.glsl
new file mode 100644
index 0000000..1f48bf2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dffb13() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_dffb13();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dffb13() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_dffb13();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dffb13() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_dffb13();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.msl
new file mode 100644
index 0000000..65218a9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_dffb13(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_dffb13(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_dffb13(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_dffb13(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.spvasm
new file mode 100644
index 0000000..8df8e48
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_dffb13 "textureStore_dffb13"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_dffb13 = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_dffb13
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_dffb13
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_dffb13
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.wgsl
new file mode 100644
index 0000000..b7fb947
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/dffb13.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureStore_dffb13() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dffb13();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dffb13();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dffb13();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl
new file mode 100644
index 0000000..abcaea1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_fd350c() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fd350c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_fd350c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_fd350c();
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..30f1481
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_fd350c() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_fd350c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_fd350c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_fd350c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..30f1481
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,32 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_fd350c() {
+ arg_0[int3(0, 0, int(1u))] = (0u).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_fd350c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_fd350c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_fd350c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.glsl
new file mode 100644
index 0000000..1996d04
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_fd350c() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+vec4 vertex_main() {
+ textureStore_fd350c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_fd350c() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void fragment_main() {
+ textureStore_fd350c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_fd350c() {
+ imageStore(arg_0, ivec3(0, 0, int(1u)), uvec4(0u));
+}
+
+void compute_main() {
+ textureStore_fd350c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.msl b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.msl
new file mode 100644
index 0000000..f77d524
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_fd350c(texture2d_array<uint, access::write> tint_symbol_1) {
+ tint_symbol_1.write(uint4(0u), uint2(int2(0)), 1u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_fd350c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_fd350c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_fd350c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.spvasm
new file mode 100644
index 0000000..9c156ab
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_fd350c "textureStore_fd350c"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+ %uint_1 = OpConstant %uint 1
+ %v4uint = OpTypeVector %uint 4
+ %26 = OpConstantNull %v4uint
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_fd350c = OpFunction %void None %13
+ %16 = OpLabel
+ %18 = OpLoad %11 %arg_0
+ %22 = OpBitcast %int %uint_1
+ %24 = OpCompositeConstruct %v3int %int_0 %int_0 %22
+ OpImageWrite %18 %24 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_fd350c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureStore_fd350c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_fd350c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.wgsl
new file mode 100644
index 0000000..a880810
--- /dev/null
+++ b/test/tint/builtins/gen/literal/textureStore/fd350c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureStore_fd350c() {
+ textureStore(arg_0, vec2<i32>(), 1u, vec4<u32>());
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fd350c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_fd350c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_fd350c();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/17baac.wgsl b/test/tint/builtins/gen/var/textureGather/17baac.wgsl
index 7888218..d717bcc 100644
--- a/test/tint/builtins/gen/var/textureGather/17baac.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/17baac.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: u32) -> vec4<f32>
fn textureGather_17baac() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.glsl
index d40ca8d..3b1b280 100644
--- a/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.glsl
@@ -5,7 +5,7 @@
void textureGather_17baac() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
vec4 vertex_main() {
@@ -29,7 +29,7 @@
void textureGather_17baac() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
void fragment_main() {
@@ -47,7 +47,7 @@
void textureGather_17baac() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.spvasm
index fa0a7ea..fe20145 100644
--- a/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 56
+; Bound: 58
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -53,8 +53,10 @@
%27 = OpConstantNull %uint
%31 = OpTypeSampledImage %11
%v3float = OpTypeVector %float 3
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %42 = OpTypeFunction %v4float
+ %44 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_17baac = OpFunction %void None %15
%18 = OpLabel
@@ -72,29 +74,29 @@
%38 = OpLoad %uint %arg_4
%37 = OpConvertUToF %float %38
%39 = OpCompositeConstruct %v3float %35 %36 %37
- %28 = OpImageGather %v4float %32 %39 %uint_1
+ %28 = OpImageGather %v4float %32 %39 %int_1
OpStore %res %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %42
- %44 = OpLabel
- %45 = OpFunctionCall %void %textureGather_17baac
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_17baac
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %15
- %47 = OpLabel
- %48 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %48
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
- %51 = OpLabel
- %52 = OpFunctionCall %void %textureGather_17baac
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureGather_17baac
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
- %54 = OpLabel
- %55 = OpFunctionCall %void %textureGather_17baac
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_17baac
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.wgsl
index 708b14f..349edb2 100644
--- a/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/17baac.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_17baac() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl
new file mode 100644
index 0000000..ec58dac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_24b0bd() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_24b0bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_24b0bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_24b0bd();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cd9fc73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_24b0bd() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_24b0bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_24b0bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_24b0bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cd9fc73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_24b0bd() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_24b0bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_24b0bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_24b0bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.glsl
new file mode 100644
index 0000000..9bb3522
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_24b0bd() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_24b0bd();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_24b0bd() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_24b0bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_24b0bd() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+void compute_main() {
+ textureGather_24b0bd();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.msl
new file mode 100644
index 0000000..399253a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_24b0bd(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int arg_4 = 1;
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_24b0bd(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_24b0bd(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_24b0bd(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..afb0711
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.spvasm
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_24b0bd "textureGather_24b0bd"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %20 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %31 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_24b0bd = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_4 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_3 %20
+ OpStore %arg_4 %int_1
+ %29 = OpLoad %14 %arg_2
+ %30 = OpLoad %11 %arg_1
+ %32 = OpSampledImage %31 %30 %29
+ %34 = OpLoad %v2float %arg_3
+ %35 = OpCompositeExtract %float %34 0
+ %36 = OpCompositeExtract %float %34 1
+ %38 = OpLoad %int %arg_4
+ %37 = OpConvertSToF %float %38
+ %39 = OpCompositeConstruct %v3float %35 %36 %37
+ %28 = OpImageGather %v4float %32 %39 %uint_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_24b0bd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureGather_24b0bd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_24b0bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..55a88fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/24b0bd.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_24b0bd() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_24b0bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_24b0bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_24b0bd();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl b/test/tint/builtins/gen/var/textureGather/445793.wgsl
new file mode 100644
index 0000000..e67711f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<i32>
+fn textureGather_445793() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ var res: vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_445793();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_445793();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_445793();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0d4c5a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_445793() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_445793();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_445793();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_445793();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0d4c5a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_445793() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_445793();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_445793();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_445793();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.glsl
new file mode 100644
index 0000000..0528a0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_445793() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_445793();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_445793() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_445793();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_445793() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+void compute_main() {
+ textureGather_445793();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.msl
new file mode 100644
index 0000000..c77189e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_445793(texture2d_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int arg_4 = 1;
+ int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_445793(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_445793(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_445793(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.spvasm
new file mode 100644
index 0000000..62dbbf4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.spvasm
@@ -0,0 +1,104 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_445793 "textureGather_445793"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %21 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %32 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %45 = OpConstantNull %v4int
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_445793 = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %arg_4 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4int Function %45
+ OpStore %arg_3 %21
+ OpStore %arg_4 %int_1
+ %30 = OpLoad %15 %arg_2
+ %31 = OpLoad %11 %arg_1
+ %33 = OpSampledImage %32 %31 %30
+ %35 = OpLoad %v2float %arg_3
+ %36 = OpCompositeExtract %float %35 0
+ %37 = OpCompositeExtract %float %35 1
+ %39 = OpLoad %int %arg_4
+ %38 = OpConvertSToF %float %39
+ %40 = OpCompositeConstruct %v3float %36 %37 %38
+ %28 = OpImageGather %v4int %33 %40 %uint_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_445793
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_445793
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_445793
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.wgsl
new file mode 100644
index 0000000..60c03e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/445793.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_445793() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ var res : vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_445793();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_445793();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_445793();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl
index 6ca2fff..76f0a70 100644
--- a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: u32) -> vec4<i32>
fn textureGather_4e8ac5() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
var res: vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.glsl
index 6e29086..20d7c66 100644
--- a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.glsl
@@ -5,7 +5,7 @@
void textureGather_4e8ac5() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
vec4 vertex_main() {
@@ -29,7 +29,7 @@
void textureGather_4e8ac5() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
void fragment_main() {
@@ -47,7 +47,7 @@
void textureGather_4e8ac5() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.spvasm
index 32feb91..fe9d0d4 100644
--- a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 59
+; Bound: 60
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -55,15 +55,16 @@
%v4int = OpTypeVector %int 4
%33 = OpTypeSampledImage %11
%v3float = OpTypeVector %float 3
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4int = OpTypePointer Function %v4int
- %44 = OpConstantNull %v4int
- %45 = OpTypeFunction %v4float
+ %45 = OpConstantNull %v4int
+ %46 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_4e8ac5 = OpFunction %void None %16
%19 = OpLabel
%arg_3 = OpVariable %_ptr_Function_v2float Function %21
%arg_4 = OpVariable %_ptr_Function_uint Function %28
- %res = OpVariable %_ptr_Function_v4int Function %44
+ %res = OpVariable %_ptr_Function_v4int Function %45
OpStore %arg_3 %21
OpStore %arg_4 %uint_1
%31 = OpLoad %15 %arg_2
@@ -75,29 +76,29 @@
%40 = OpLoad %uint %arg_4
%39 = OpConvertUToF %float %40
%41 = OpCompositeConstruct %v3float %37 %38 %39
- %29 = OpImageGather %v4int %34 %41 %uint_1
+ %29 = OpImageGather %v4int %34 %41 %int_1
OpStore %res %29
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %45
- %47 = OpLabel
- %48 = OpFunctionCall %void %textureGather_4e8ac5
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_4e8ac5
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %50 = OpLabel
- %51 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %51
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %54 = OpLabel
- %55 = OpFunctionCall %void %textureGather_4e8ac5
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_4e8ac5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %57 = OpLabel
- %58 = OpFunctionCall %void %textureGather_4e8ac5
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_4e8ac5
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.wgsl
index cb06b2a..e1ccdbf8 100644
--- a/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/4e8ac5.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_4e8ac5() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
var res : vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/59372a.wgsl b/test/tint/builtins/gen/var/textureGather/59372a.wgsl
index c3bb248..e490508 100644
--- a/test/tint/builtins/gen/var/textureGather/59372a.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/59372a.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: u32, @const offset: vec2<i32>) -> vec4<f32>
fn textureGather_59372a() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
const arg_5 = vec2<i32>();
diff --git a/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.glsl
index e93d50d..d0c0e51 100644
--- a/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.glsl
@@ -5,7 +5,7 @@
void textureGather_59372a() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
vec4 vertex_main() {
@@ -29,7 +29,7 @@
void textureGather_59372a() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
void fragment_main() {
@@ -47,7 +47,7 @@
void textureGather_59372a() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.spvasm
index b38cf1a..159651c 100644
--- a/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 59
+; Bound: 60
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -54,10 +54,11 @@
%31 = OpTypeSampledImage %11
%v3float = OpTypeVector %float 3
%int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%v2int = OpTypeVector %int 2
- %42 = OpConstantNull %v2int
+ %43 = OpConstantNull %v2int
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %45 = OpTypeFunction %v4float
+ %46 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_59372a = OpFunction %void None %15
%18 = OpLabel
@@ -75,29 +76,29 @@
%38 = OpLoad %uint %arg_4
%37 = OpConvertUToF %float %38
%39 = OpCompositeConstruct %v3float %35 %36 %37
- %28 = OpImageGather %v4float %32 %39 %uint_1 ConstOffset %42
+ %28 = OpImageGather %v4float %32 %39 %int_1 ConstOffset %43
OpStore %res %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %45
- %47 = OpLabel
- %48 = OpFunctionCall %void %textureGather_59372a
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_59372a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %15
- %50 = OpLabel
- %51 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %51
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
- %54 = OpLabel
- %55 = OpFunctionCall %void %textureGather_59372a
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_59372a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
- %57 = OpLabel
- %58 = OpFunctionCall %void %textureGather_59372a
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_59372a
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.wgsl
index 84e71d5..fec8fe9 100644
--- a/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/59372a.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_59372a() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
const arg_5 = vec2<i32>();
diff --git a/test/tint/builtins/gen/var/textureGather/788010.wgsl b/test/tint/builtins/gen/var/textureGather/788010.wgsl
index ac0b32b..b78bd39 100644
--- a/test/tint/builtins/gen/var/textureGather/788010.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/788010.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_cube_array<i32>, sampler: sampler, coords: vec3<f32>, array_index: u32) -> vec4<i32>
fn textureGather_788010() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec3<f32>();
var arg_4 = 1u;
var res: vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.glsl
index ab20a08..57e0d6c 100644
--- a/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.glsl
@@ -7,7 +7,7 @@
void textureGather_788010() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
vec4 vertex_main() {
@@ -38,7 +38,7 @@
void textureGather_788010() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
void fragment_main() {
@@ -63,7 +63,7 @@
void textureGather_788010() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.spvasm
index d1df655..7e9ec26 100644
--- a/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 59
+; Bound: 60
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -55,15 +55,16 @@
%28 = OpConstantNull %uint
%v4int = OpTypeVector %int 4
%33 = OpTypeSampledImage %11
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4int = OpTypePointer Function %v4int
- %44 = OpConstantNull %v4int
- %45 = OpTypeFunction %v4float
+ %45 = OpConstantNull %v4int
+ %46 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_788010 = OpFunction %void None %16
%19 = OpLabel
%arg_3 = OpVariable %_ptr_Function_v3float Function %21
%arg_4 = OpVariable %_ptr_Function_uint Function %28
- %res = OpVariable %_ptr_Function_v4int Function %44
+ %res = OpVariable %_ptr_Function_v4int Function %45
OpStore %arg_3 %21
OpStore %arg_4 %uint_1
%31 = OpLoad %15 %arg_2
@@ -76,29 +77,29 @@
%40 = OpLoad %uint %arg_4
%39 = OpConvertUToF %float %40
%41 = OpCompositeConstruct %v4float %36 %37 %38 %39
- %29 = OpImageGather %v4int %34 %41 %uint_1
+ %29 = OpImageGather %v4int %34 %41 %int_1
OpStore %res %29
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %45
- %47 = OpLabel
- %48 = OpFunctionCall %void %textureGather_788010
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_788010
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %50 = OpLabel
- %51 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %51
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %54 = OpLabel
- %55 = OpFunctionCall %void %textureGather_788010
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_788010
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %57 = OpLabel
- %58 = OpFunctionCall %void %textureGather_788010
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_788010
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.wgsl
index da05951..3f426c4 100644
--- a/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/788010.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_788010() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec3<f32>();
var arg_4 = 1u;
var res : vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/829357.wgsl b/test/tint/builtins/gen/var/textureGather/829357.wgsl
index fdb7381..1134019 100644
--- a/test/tint/builtins/gen/var/textureGather/829357.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/829357.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: u32) -> vec4<f32>
fn textureGather_829357() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec3<f32>();
var arg_4 = 1u;
var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.glsl
index ff8bc8a..1fa2dff 100644
--- a/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.glsl
@@ -7,7 +7,7 @@
void textureGather_829357() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
vec4 vertex_main() {
@@ -38,7 +38,7 @@
void textureGather_829357() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
void fragment_main() {
@@ -63,7 +63,7 @@
void textureGather_829357() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.spvasm
index 0e85359..1427357e 100644
--- a/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 56
+; Bound: 58
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -53,8 +53,10 @@
%_ptr_Function_uint = OpTypePointer Function %uint
%27 = OpConstantNull %uint
%31 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %42 = OpTypeFunction %v4float
+ %44 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_829357 = OpFunction %void None %15
%18 = OpLabel
@@ -73,29 +75,29 @@
%38 = OpLoad %uint %arg_4
%37 = OpConvertUToF %float %38
%39 = OpCompositeConstruct %v4float %34 %35 %36 %37
- %28 = OpImageGather %v4float %32 %39 %uint_1
+ %28 = OpImageGather %v4float %32 %39 %int_1
OpStore %res %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %42
- %44 = OpLabel
- %45 = OpFunctionCall %void %textureGather_829357
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_829357
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %15
- %47 = OpLabel
- %48 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %48
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
- %51 = OpLabel
- %52 = OpFunctionCall %void %textureGather_829357
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureGather_829357
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
- %54 = OpLabel
- %55 = OpFunctionCall %void %textureGather_829357
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_829357
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.wgsl
index cddda4f..78f4e36 100644
--- a/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/829357.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_829357() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec3<f32>();
var arg_4 = 1u;
var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl b/test/tint/builtins/gen/var/textureGather/831549.wgsl
new file mode 100644
index 0000000..1f3118d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGather_831549() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_831549();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_831549();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_831549();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..38bf7e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_831549() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_831549();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_831549();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_831549();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..38bf7e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_831549() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ float4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_831549();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_831549();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_831549();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.glsl
new file mode 100644
index 0000000..88bf13e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_831549() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_831549();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_831549() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureGather_831549();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_831549() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureGather_831549();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.msl
new file mode 100644
index 0000000..f6e10eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_831549(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int arg_4 = 1;
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_831549(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_831549(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_831549(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.spvasm
new file mode 100644
index 0000000..6ac5d59
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.spvasm
@@ -0,0 +1,104 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_831549 "textureGather_831549"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %20 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %31 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %43 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_831549 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_4 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_3 %20
+ OpStore %arg_4 %int_1
+ %29 = OpLoad %14 %arg_2
+ %30 = OpLoad %11 %arg_1
+ %32 = OpSampledImage %31 %30 %29
+ %34 = OpLoad %v2float %arg_3
+ %35 = OpCompositeExtract %float %34 0
+ %36 = OpCompositeExtract %float %34 1
+ %38 = OpLoad %int %arg_4
+ %37 = OpConvertSToF %float %38
+ %39 = OpCompositeConstruct %v3float %35 %36 %37
+ %28 = OpImageGather %v4float %32 %39 %uint_1 ConstOffset %43
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_831549
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_831549
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_831549
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.wgsl
new file mode 100644
index 0000000..fb01440
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/831549.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_831549() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_831549();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_831549();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_831549();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl
new file mode 100644
index 0000000..eea4da2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<u32>
+fn textureGather_92ea47() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ var res: vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_92ea47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_92ea47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_92ea47();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..caaf8b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_92ea47() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_92ea47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_92ea47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_92ea47();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..caaf8b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_92ea47() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_92ea47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_92ea47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_92ea47();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.glsl
new file mode 100644
index 0000000..6004232
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_92ea47() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_92ea47();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_92ea47() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_92ea47();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_92ea47() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+}
+
+void compute_main() {
+ textureGather_92ea47();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.msl
new file mode 100644
index 0000000..b733157
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_92ea47(texture2d_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int arg_4 = 1;
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_92ea47(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_92ea47(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_92ea47(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.spvasm
new file mode 100644
index 0000000..150621f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.spvasm
@@ -0,0 +1,104 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_92ea47 "textureGather_92ea47"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %21 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %28 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %33 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %45 = OpConstantNull %v4uint
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_92ea47 = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %arg_4 = OpVariable %_ptr_Function_int Function %28
+ %res = OpVariable %_ptr_Function_v4uint Function %45
+ OpStore %arg_3 %21
+ OpStore %arg_4 %int_1
+ %31 = OpLoad %15 %arg_2
+ %32 = OpLoad %11 %arg_1
+ %34 = OpSampledImage %33 %32 %31
+ %36 = OpLoad %v2float %arg_3
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %40 = OpLoad %int %arg_4
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v3float %37 %38 %39
+ %29 = OpImageGather %v4uint %34 %41 %uint_1
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_92ea47
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_92ea47
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_92ea47
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.wgsl
new file mode 100644
index 0000000..c528d46
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/92ea47.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_92ea47() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ var res : vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_92ea47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_92ea47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_92ea47();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl
new file mode 100644
index 0000000..ea1369d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<i32>
+fn textureGather_9ab41e() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res: vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_9ab41e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_9ab41e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_9ab41e();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..898324f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_9ab41e() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_9ab41e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_9ab41e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_9ab41e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..898324f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_9ab41e() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ int4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_9ab41e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_9ab41e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_9ab41e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.glsl
new file mode 100644
index 0000000..4dfab19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_9ab41e() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_9ab41e();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_9ab41e() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureGather_9ab41e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_9ab41e() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureGather_9ab41e();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.msl
new file mode 100644
index 0000000..70bf095
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_9ab41e(texture2d_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int arg_4 = 1;
+ int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_9ab41e(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_9ab41e(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_9ab41e(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.spvasm
new file mode 100644
index 0000000..b3b751b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.spvasm
@@ -0,0 +1,106 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_9ab41e "textureGather_9ab41e"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %21 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %32 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %44 = OpConstantNull %v2int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %47 = OpConstantNull %v4int
+ %48 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_9ab41e = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %arg_4 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4int Function %47
+ OpStore %arg_3 %21
+ OpStore %arg_4 %int_1
+ %30 = OpLoad %15 %arg_2
+ %31 = OpLoad %11 %arg_1
+ %33 = OpSampledImage %32 %31 %30
+ %35 = OpLoad %v2float %arg_3
+ %36 = OpCompositeExtract %float %35 0
+ %37 = OpCompositeExtract %float %35 1
+ %39 = OpLoad %int %arg_4
+ %38 = OpConvertSToF %float %39
+ %40 = OpCompositeConstruct %v3float %36 %37 %38
+ %28 = OpImageGather %v4int %33 %40 %uint_1 ConstOffset %44
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_9ab41e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_9ab41e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %textureGather_9ab41e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.wgsl
new file mode 100644
index 0000000..8a0dad6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9ab41e.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_9ab41e() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res : vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_9ab41e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_9ab41e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_9ab41e();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl
index 37a6cb3..d6aedba 100644
--- a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: u32) -> vec4<u32>
fn textureGather_a0372b() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
var res: vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.glsl
index 4df8d22..c901057 100644
--- a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.glsl
@@ -5,7 +5,7 @@
void textureGather_a0372b() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
vec4 vertex_main() {
@@ -29,7 +29,7 @@
void textureGather_a0372b() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
void fragment_main() {
@@ -47,7 +47,7 @@
void textureGather_a0372b() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.spvasm
index 79bf8c4..d884cab 100644
--- a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 58
+; Bound: 60
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -54,15 +54,17 @@
%v4uint = OpTypeVector %uint 4
%32 = OpTypeSampledImage %11
%v3float = OpTypeVector %float 3
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
- %43 = OpConstantNull %v4uint
- %44 = OpTypeFunction %v4float
+ %45 = OpConstantNull %v4uint
+ %46 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_a0372b = OpFunction %void None %16
%19 = OpLabel
%arg_3 = OpVariable %_ptr_Function_v2float Function %21
%arg_4 = OpVariable %_ptr_Function_uint Function %27
- %res = OpVariable %_ptr_Function_v4uint Function %43
+ %res = OpVariable %_ptr_Function_v4uint Function %45
OpStore %arg_3 %21
OpStore %arg_4 %uint_1
%30 = OpLoad %15 %arg_2
@@ -74,29 +76,29 @@
%39 = OpLoad %uint %arg_4
%38 = OpConvertUToF %float %39
%40 = OpCompositeConstruct %v3float %36 %37 %38
- %28 = OpImageGather %v4uint %33 %40 %uint_1
+ %28 = OpImageGather %v4uint %33 %40 %int_1
OpStore %res %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %44
- %46 = OpLabel
- %47 = OpFunctionCall %void %textureGather_a0372b
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_a0372b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %49 = OpLabel
- %50 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %50
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %53 = OpLabel
- %54 = OpFunctionCall %void %textureGather_a0372b
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_a0372b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %56 = OpLabel
- %57 = OpFunctionCall %void %textureGather_a0372b
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_a0372b
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.wgsl
index c3d9988..2daaad7 100644
--- a/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/a0372b.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_a0372b() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
var res : vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl
new file mode 100644
index 0000000..640fa29
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube_array<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_cube_array<i32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<i32>
+fn textureGather_aaf6bd() {
+ const arg_0 = 1u;
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1i;
+ var res: vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_aaf6bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_aaf6bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_aaf6bd();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ff59e82
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_aaf6bd() {
+ float3 arg_3 = (0.0f).xxx;
+ int arg_4 = 1;
+ int4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_aaf6bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_aaf6bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_aaf6bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ff59e82
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_aaf6bd() {
+ float3 arg_3 = (0.0f).xxx;
+ int arg_4 = 1;
+ int4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_aaf6bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_aaf6bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_aaf6bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.glsl
new file mode 100644
index 0000000..fed7580
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_aaf6bd() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_aaf6bd();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_aaf6bd() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_aaf6bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'isamplerCubeArray' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_aaf6bd() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+void compute_main() {
+ textureGather_aaf6bd();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.msl
new file mode 100644
index 0000000..51280df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_aaf6bd(texturecube_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_3 = float3(0.0f);
+ int arg_4 = 1;
+ int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_aaf6bd(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texturecube_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_aaf6bd(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_aaf6bd(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..b4296f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.spvasm
@@ -0,0 +1,105 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_aaf6bd "textureGather_aaf6bd"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %21 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %32 = OpTypeSampledImage %11
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %45 = OpConstantNull %v4int
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_aaf6bd = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %21
+ %arg_4 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4int Function %45
+ OpStore %arg_3 %21
+ OpStore %arg_4 %int_1
+ %30 = OpLoad %15 %arg_2
+ %31 = OpLoad %11 %arg_1
+ %33 = OpSampledImage %32 %31 %30
+ %34 = OpLoad %v3float %arg_3
+ %35 = OpCompositeExtract %float %34 0
+ %36 = OpCompositeExtract %float %34 1
+ %37 = OpCompositeExtract %float %34 2
+ %39 = OpLoad %int %arg_4
+ %38 = OpConvertSToF %float %39
+ %40 = OpCompositeConstruct %v4float %35 %36 %37 %38
+ %28 = OpImageGather %v4int %33 %40 %uint_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_aaf6bd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_aaf6bd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_aaf6bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..957219f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/aaf6bd.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_aaf6bd() {
+ const arg_0 = 1u;
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1i;
+ var res : vec4<i32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_aaf6bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_aaf6bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_aaf6bd();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl
index f957864..12963b5 100644
--- a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: u32, @const offset: vec2<i32>) -> vec4<i32>
fn textureGather_bd33b6() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
const arg_5 = vec2<i32>();
diff --git a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.glsl
index 1895dfa..7afb7c6 100644
--- a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.glsl
@@ -5,7 +5,7 @@
void textureGather_bd33b6() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
vec4 vertex_main() {
@@ -29,7 +29,7 @@
void textureGather_bd33b6() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
void fragment_main() {
@@ -47,7 +47,7 @@
void textureGather_bd33b6() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ ivec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.spvasm
index f222d1b..53a9d99 100644
--- a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 61
+; Bound: 62
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -55,17 +55,18 @@
%v4int = OpTypeVector %int 4
%33 = OpTypeSampledImage %11
%v3float = OpTypeVector %float 3
+ %int_1 = OpConstant %int 1
%v2int = OpTypeVector %int 2
- %43 = OpConstantNull %v2int
+ %44 = OpConstantNull %v2int
%_ptr_Function_v4int = OpTypePointer Function %v4int
- %46 = OpConstantNull %v4int
- %47 = OpTypeFunction %v4float
+ %47 = OpConstantNull %v4int
+ %48 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_bd33b6 = OpFunction %void None %16
%19 = OpLabel
%arg_3 = OpVariable %_ptr_Function_v2float Function %21
%arg_4 = OpVariable %_ptr_Function_uint Function %28
- %res = OpVariable %_ptr_Function_v4int Function %46
+ %res = OpVariable %_ptr_Function_v4int Function %47
OpStore %arg_3 %21
OpStore %arg_4 %uint_1
%31 = OpLoad %15 %arg_2
@@ -77,29 +78,29 @@
%40 = OpLoad %uint %arg_4
%39 = OpConvertUToF %float %40
%41 = OpCompositeConstruct %v3float %37 %38 %39
- %29 = OpImageGather %v4int %34 %41 %uint_1 ConstOffset %43
+ %29 = OpImageGather %v4int %34 %41 %int_1 ConstOffset %44
OpStore %res %29
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %47
- %49 = OpLabel
- %50 = OpFunctionCall %void %textureGather_bd33b6
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_bd33b6
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %52 = OpLabel
- %53 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %53
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %56 = OpLabel
- %57 = OpFunctionCall %void %textureGather_bd33b6
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_bd33b6
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %59 = OpLabel
- %60 = OpFunctionCall %void %textureGather_bd33b6
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %textureGather_bd33b6
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.wgsl
index af77362..e0a3f4d 100644
--- a/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/bd33b6.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_bd33b6() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
const arg_5 = vec2<i32>();
diff --git a/test/tint/builtins/gen/var/textureGather/be276f.wgsl b/test/tint/builtins/gen/var/textureGather/be276f.wgsl
index d975202..9823061 100644
--- a/test/tint/builtins/gen/var/textureGather/be276f.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/be276f.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_cube_array<u32>, sampler: sampler, coords: vec3<f32>, array_index: u32) -> vec4<u32>
fn textureGather_be276f() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec3<f32>();
var arg_4 = 1u;
var res: vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.glsl
index 1cd067d..2ef6086 100644
--- a/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.glsl
@@ -7,7 +7,7 @@
void textureGather_be276f() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
vec4 vertex_main() {
@@ -38,7 +38,7 @@
void textureGather_be276f() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
void fragment_main() {
@@ -63,7 +63,7 @@
void textureGather_be276f() {
vec3 arg_3 = vec3(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.spvasm
index c43168e..10fb0ee 100644
--- a/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 58
+; Bound: 60
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -54,15 +54,17 @@
%27 = OpConstantNull %uint
%v4uint = OpTypeVector %uint 4
%32 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
- %43 = OpConstantNull %v4uint
- %44 = OpTypeFunction %v4float
+ %45 = OpConstantNull %v4uint
+ %46 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_be276f = OpFunction %void None %16
%19 = OpLabel
%arg_3 = OpVariable %_ptr_Function_v3float Function %21
%arg_4 = OpVariable %_ptr_Function_uint Function %27
- %res = OpVariable %_ptr_Function_v4uint Function %43
+ %res = OpVariable %_ptr_Function_v4uint Function %45
OpStore %arg_3 %21
OpStore %arg_4 %uint_1
%30 = OpLoad %15 %arg_2
@@ -75,29 +77,29 @@
%39 = OpLoad %uint %arg_4
%38 = OpConvertUToF %float %39
%40 = OpCompositeConstruct %v4float %35 %36 %37 %38
- %28 = OpImageGather %v4uint %33 %40 %uint_1
+ %28 = OpImageGather %v4uint %33 %40 %int_1
OpStore %res %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %44
- %46 = OpLabel
- %47 = OpFunctionCall %void %textureGather_be276f
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_be276f
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %49 = OpLabel
- %50 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %50
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %53 = OpLabel
- %54 = OpFunctionCall %void %textureGather_be276f
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_be276f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %56 = OpLabel
- %57 = OpFunctionCall %void %textureGather_be276f
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_be276f
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.wgsl
index 6bcb853..ba4234a 100644
--- a/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/be276f.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_be276f() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec3<f32>();
var arg_4 = 1u;
var res : vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
diff --git a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl
index 284bfa6..156d1ec 100644
--- a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl
@@ -25,7 +25,7 @@
// fn textureGather(@const component: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: u32, @const offset: vec2<i32>) -> vec4<u32>
fn textureGather_ce5578() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
const arg_5 = vec2<i32>();
diff --git a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.glsl
index ec03098..a7825b7 100644
--- a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.glsl
@@ -5,7 +5,7 @@
void textureGather_ce5578() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
vec4 vertex_main() {
@@ -29,7 +29,7 @@
void textureGather_ce5578() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
void fragment_main() {
@@ -47,7 +47,7 @@
void textureGather_ce5578() {
vec2 arg_3 = vec2(0.0f);
uint arg_4 = 1u;
- uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), 1);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.spvasm
index 54bd0b8..aec41cc 100644
--- a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 61
+; Bound: 62
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -55,17 +55,18 @@
%32 = OpTypeSampledImage %11
%v3float = OpTypeVector %float 3
%int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
%v2int = OpTypeVector %int 2
- %43 = OpConstantNull %v2int
+ %44 = OpConstantNull %v2int
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
- %46 = OpConstantNull %v4uint
- %47 = OpTypeFunction %v4float
+ %47 = OpConstantNull %v4uint
+ %48 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureGather_ce5578 = OpFunction %void None %16
%19 = OpLabel
%arg_3 = OpVariable %_ptr_Function_v2float Function %21
%arg_4 = OpVariable %_ptr_Function_uint Function %27
- %res = OpVariable %_ptr_Function_v4uint Function %46
+ %res = OpVariable %_ptr_Function_v4uint Function %47
OpStore %arg_3 %21
OpStore %arg_4 %uint_1
%30 = OpLoad %15 %arg_2
@@ -77,29 +78,29 @@
%39 = OpLoad %uint %arg_4
%38 = OpConvertUToF %float %39
%40 = OpCompositeConstruct %v3float %36 %37 %38
- %28 = OpImageGather %v4uint %33 %40 %uint_1 ConstOffset %43
+ %28 = OpImageGather %v4uint %33 %40 %int_1 ConstOffset %44
OpStore %res %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %47
- %49 = OpLabel
- %50 = OpFunctionCall %void %textureGather_ce5578
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_ce5578
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %16
- %52 = OpLabel
- %53 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %53
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %16
- %56 = OpLabel
- %57 = OpFunctionCall %void %textureGather_ce5578
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_ce5578
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %16
- %59 = OpLabel
- %60 = OpFunctionCall %void %textureGather_ce5578
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %textureGather_ce5578
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.wgsl
index 1246a35..f936734 100644
--- a/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/textureGather/ce5578.wgsl.expected.wgsl
@@ -3,7 +3,7 @@
@group(1) @binding(2) var arg_2 : sampler;
fn textureGather_ce5578() {
- const arg_0 = 1;
+ const arg_0 = 1i;
var arg_3 = vec2<f32>();
var arg_4 = 1u;
const arg_5 = vec2<i32>();
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl
new file mode 100644
index 0000000..25afe4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube_array<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_cube_array<u32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<u32>
+fn textureGather_d4b5c6() {
+ const arg_0 = 1u;
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1i;
+ var res: vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d4b5c6();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d4b5c6();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d4b5c6();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..f8af258
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d4b5c6() {
+ float3 arg_3 = (0.0f).xxx;
+ int arg_4 = 1;
+ uint4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d4b5c6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d4b5c6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d4b5c6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..f8af258
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d4b5c6() {
+ float3 arg_3 = (0.0f).xxx;
+ int arg_4 = 1;
+ uint4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d4b5c6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d4b5c6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d4b5c6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.glsl
new file mode 100644
index 0000000..35551c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_d4b5c6() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_d4b5c6();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_d4b5c6() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_d4b5c6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'usamplerCubeArray' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_d4b5c6() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+void compute_main() {
+ textureGather_d4b5c6();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usamplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.msl
new file mode 100644
index 0000000..ad72e15
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_d4b5c6(texturecube_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_3 = float3(0.0f);
+ int arg_4 = 1;
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_d4b5c6(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texturecube_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_d4b5c6(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_d4b5c6(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.spvasm
new file mode 100644
index 0000000..33772f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.spvasm
@@ -0,0 +1,105 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 60
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_d4b5c6 "textureGather_d4b5c6"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %21 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %28 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %33 = OpTypeSampledImage %11
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %45 = OpConstantNull %v4uint
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_d4b5c6 = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %21
+ %arg_4 = OpVariable %_ptr_Function_int Function %28
+ %res = OpVariable %_ptr_Function_v4uint Function %45
+ OpStore %arg_3 %21
+ OpStore %arg_4 %int_1
+ %31 = OpLoad %15 %arg_2
+ %32 = OpLoad %11 %arg_1
+ %34 = OpSampledImage %33 %32 %31
+ %35 = OpLoad %v3float %arg_3
+ %36 = OpCompositeExtract %float %35 0
+ %37 = OpCompositeExtract %float %35 1
+ %38 = OpCompositeExtract %float %35 2
+ %40 = OpLoad %int %arg_4
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v4float %36 %37 %38 %39
+ %29 = OpImageGather %v4uint %34 %41 %uint_1
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_d4b5c6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %52
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_d4b5c6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_d4b5c6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.wgsl
new file mode 100644
index 0000000..9b394bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d4b5c6.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_d4b5c6() {
+ const arg_0 = 1u;
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1i;
+ var res : vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d4b5c6();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d4b5c6();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d4b5c6();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl
new file mode 100644
index 0000000..e4e7524
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube_array<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_d98d59() {
+ const arg_0 = 1u;
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1i;
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d98d59();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d98d59();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d98d59();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5636e11
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d98d59() {
+ float3 arg_3 = (0.0f).xxx;
+ int arg_4 = 1;
+ float4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d98d59();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d98d59();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d98d59();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5636e11
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d98d59() {
+ float3 arg_3 = (0.0f).xxx;
+ int arg_4 = 1;
+ float4 res = arg_1.GatherGreen(arg_2, float4(arg_3, float(arg_4)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d98d59();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_d98d59();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d98d59();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.glsl
new file mode 100644
index 0000000..62c83c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_d98d59() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_d98d59();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_d98d59() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+void fragment_main() {
+ textureGather_d98d59();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'samplerCubeArray' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_d98d59() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), int(1u));
+}
+
+void compute_main() {
+ textureGather_d98d59();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArray' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.msl
new file mode 100644
index 0000000..b764f21
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_d98d59(texturecube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_3 = float3(0.0f);
+ int arg_4 = 1;
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_d98d59(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texturecube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_d98d59(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_d98d59(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.spvasm
new file mode 100644
index 0000000..eb9a8ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.spvasm
@@ -0,0 +1,103 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_d98d59 "textureGather_d98d59"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %20 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %31 = OpTypeSampledImage %11
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_d98d59 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_4 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_3 %20
+ OpStore %arg_4 %int_1
+ %29 = OpLoad %14 %arg_2
+ %30 = OpLoad %11 %arg_1
+ %32 = OpSampledImage %31 %30 %29
+ %33 = OpLoad %v3float %arg_3
+ %34 = OpCompositeExtract %float %33 0
+ %35 = OpCompositeExtract %float %33 1
+ %36 = OpCompositeExtract %float %33 2
+ %38 = OpLoad %int %arg_4
+ %37 = OpConvertSToF %float %38
+ %39 = OpCompositeConstruct %v4float %34 %35 %36 %37
+ %28 = OpImageGather %v4float %32 %39 %uint_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_d98d59
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureGather_d98d59
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_d98d59
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc7f8c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d98d59.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_d98d59() {
+ const arg_0 = 1u;
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1i;
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d98d59();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_d98d59();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_d98d59();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl
new file mode 100644
index 0000000..a261325
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d_array<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: u32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<u32>
+fn textureGather_e3165f() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res: vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_e3165f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_e3165f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_e3165f();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..81a031d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_e3165f() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_e3165f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_e3165f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_e3165f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..81a031d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_e3165f() {
+ float2 arg_3 = (0.0f).xx;
+ int arg_4 = 1;
+ uint4 res = arg_1.GatherGreen(arg_2, float3(arg_3, float(arg_4)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_e3165f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGather_e3165f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_e3165f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.glsl
new file mode 100644
index 0000000..6239d68
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_e3165f() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+vec4 vertex_main() {
+ textureGather_e3165f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_e3165f() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+void fragment_main() {
+ textureGather_e3165f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_e3165f() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGatherOffset(arg_1_arg_2, vec3(arg_3, float(arg_4)), ivec2(0), int(1u));
+}
+
+void compute_main() {
+ textureGather_e3165f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.msl
new file mode 100644
index 0000000..89f5559
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_e3165f(texture2d_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int arg_4 = 1;
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, arg_4, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_e3165f(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_e3165f(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_e3165f(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.spvasm
new file mode 100644
index 0000000..b246f34
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.spvasm
@@ -0,0 +1,106 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 62
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_e3165f "textureGather_e3165f"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ OpDecorate %arg_2 DescriptorSet 1
+ OpDecorate %arg_2 Binding 2
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %15 = OpTypeSampler
+%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
+ %arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
+ %void = OpTypeVoid
+ %16 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %21 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %28 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %33 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %uint_1 = OpConstant %uint 1
+ %v2int = OpTypeVector %int 2
+ %44 = OpConstantNull %v2int
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %47 = OpConstantNull %v4uint
+ %48 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_e3165f = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %arg_4 = OpVariable %_ptr_Function_int Function %28
+ %res = OpVariable %_ptr_Function_v4uint Function %47
+ OpStore %arg_3 %21
+ OpStore %arg_4 %int_1
+ %31 = OpLoad %15 %arg_2
+ %32 = OpLoad %11 %arg_1
+ %34 = OpSampledImage %33 %32 %31
+ %36 = OpLoad %v2float %arg_3
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %40 = OpLoad %int %arg_4
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v3float %37 %38 %39
+ %29 = OpImageGather %v4uint %34 %41 %uint_1 ConstOffset %44
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_e3165f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_e3165f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %textureGather_e3165f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.wgsl
new file mode 100644
index 0000000..4f62566
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e3165f.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_e3165f() {
+ const arg_0 = 1u;
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res : vec4<u32> = textureGather(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_e3165f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureGather_e3165f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureGather_e3165f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl
new file mode 100644
index 0000000..ad2c4e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureLoad(texture: texture_3d<f32>, coords: vec3<i32>, level: u32) -> vec4<f32>
+fn textureLoad_019da0() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_019da0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_019da0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_019da0();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d7d9113
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_019da0() {
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(int4(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_019da0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_019da0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_019da0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d7d9113
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_019da0() {
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(int4(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_019da0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_019da0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_019da0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.glsl
new file mode 100644
index 0000000..f4f76c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_019da0() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_019da0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_019da0() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_019da0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_019da0() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_019da0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.msl
new file mode 100644
index 0000000..9355436
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_019da0(texture3d<float, access::sample> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint arg_2 = 1u;
+ float4 res = tint_symbol_1.read(uint3(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureLoad_019da0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_019da0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_019da0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.spvasm
new file mode 100644
index 0000000..b3dc43b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_019da0 "textureLoad_019da0"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_019da0 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Lod %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_019da0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_019da0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_019da0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.wgsl
new file mode 100644
index 0000000..90c7618
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/019da0.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureLoad_019da0() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_019da0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_019da0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_019da0();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl
new file mode 100644
index 0000000..8cca36c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<u32>, array_index: u32, level: i32) -> vec4<u32>
+fn textureLoad_026217() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_026217();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_026217();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_026217();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bd6e939
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_026217() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uint4 res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_026217();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_026217();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_026217();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bd6e939
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_026217() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uint4 res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_026217();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_026217();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_026217();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.glsl
new file mode 100644
index 0000000..182e968
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_026217() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_026217();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_026217() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_026217();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_026217() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureLoad_026217();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.msl
new file mode 100644
index 0000000..4e2fc4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_026217(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_026217(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_026217(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_026217(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.spvasm
new file mode 100644
index 0000000..fd8d9f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_026217 "textureLoad_026217"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %24 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %42 = OpConstantNull %v4uint
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_026217 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %24
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_v4uint Function %42
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2uint %arg_1
+ %35 = OpCompositeExtract %uint %34 0
+ %36 = OpCompositeExtract %uint %34 1
+ %37 = OpLoad %uint %arg_2
+ %38 = OpCompositeConstruct %v3uint %35 %36 %37
+ %39 = OpLoad %int %arg_3
+ %30 = OpImageFetch %v4uint %32 %38 Lod %39
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_026217
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_026217
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureLoad_026217
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.wgsl
new file mode 100644
index 0000000..1e2a15b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/026217.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_026217() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_026217();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_026217();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_026217();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl
new file mode 100644
index 0000000..6047511
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<u32>, array_index: i32, level: u32) -> f32
+fn textureLoad_04b911() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_04b911();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_04b911();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_04b911();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bce9f3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_04b911() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_04b911();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_04b911();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_04b911();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bce9f3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_04b911() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_04b911();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_04b911();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_04b911();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.glsl
new file mode 100644
index 0000000..2742b07
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_04b911() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_04b911();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_04b911() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3)).x;
+}
+
+void fragment_main() {
+ textureLoad_04b911();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_04b911() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3)).x;
+}
+
+void compute_main() {
+ textureLoad_04b911();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.msl
new file mode 100644
index 0000000..a8900e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_04b911(depth2d_array<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_04b911(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_04b911(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_04b911(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.spvasm
new file mode 100644
index 0000000..bcdf21d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_04b911 "textureLoad_04b911"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_04b911 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2uint %arg_1
+ %35 = OpCompositeExtract %uint %34 0
+ %36 = OpCompositeExtract %uint %34 1
+ %38 = OpLoad %int %arg_2
+ %37 = OpBitcast %uint %38
+ %39 = OpCompositeConstruct %v3uint %35 %36 %37
+ %40 = OpLoad %uint %arg_3
+ %31 = OpImageFetch %v4float %32 %39 Lod %40
+ %30 = OpCompositeExtract %float %31 0
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_04b911
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_04b911
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureLoad_04b911
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.wgsl
new file mode 100644
index 0000000..ee48583
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/04b911.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_04b911() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_04b911();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_04b911();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_04b911();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl
new file mode 100644
index 0000000..e1d7101
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureLoad(texture: texture_1d<f32>, coords: u32, level: i32) -> vec4<f32>
+fn textureLoad_1373dc() {
+ var arg_1 = 1u;
+ var arg_2 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1373dc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1373dc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1373dc();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cd11245
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_1373dc() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(uint2(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1373dc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1373dc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1373dc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cd11245
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_1373dc() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(uint2(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1373dc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1373dc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1373dc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.glsl
new file mode 100644
index 0000000..bbec6f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_1373dc() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_1373dc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_1373dc() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_1373dc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'sampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_1373dc() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_1373dc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.msl
new file mode 100644
index 0000000..f6ca82f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_1373dc(texture1d<float, access::sample> tint_symbol_1) {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ float4 res = tint_symbol_1.read(uint(arg_1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureLoad_1373dc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_1373dc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_1373dc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.spvasm
new file mode 100644
index 0000000..a51498f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_1373dc "textureLoad_1373dc"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %20 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_1373dc = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %20
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %int_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %uint %arg_1
+ %29 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Lod %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_1373dc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_1373dc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_1373dc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.wgsl
new file mode 100644
index 0000000..38958ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1373dc.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureLoad_1373dc() {
+ var arg_1 = 1u;
+ var arg_2 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1373dc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1373dc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1373dc();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl
new file mode 100644
index 0000000..2563e1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<u32>, array_index: i32, level: i32) -> vec4<i32>
+fn textureLoad_168dc8() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_168dc8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_168dc8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_168dc8();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..56cc8e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_168dc8() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ int4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_168dc8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_168dc8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_168dc8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..56cc8e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_168dc8() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ int4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_168dc8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_168dc8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_168dc8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.glsl
new file mode 100644
index 0000000..a0cc687
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_168dc8() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_168dc8();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_168dc8() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_168dc8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_168dc8() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureLoad_168dc8();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.msl
new file mode 100644
index 0000000..3ade60f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_168dc8(texture2d_array<int, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_168dc8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_168dc8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_168dc8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.spvasm
new file mode 100644
index 0000000..4febae6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_168dc8 "textureLoad_168dc8"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %40 = OpConstantNull %v4int
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_168dc8 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %40
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %int_1
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %int %arg_3
+ %27 = OpImageFetch %v4int %29 %36 Lod %37
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_168dc8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_168dc8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_168dc8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.wgsl
new file mode 100644
index 0000000..6642f02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/168dc8.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_168dc8() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_168dc8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_168dc8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_168dc8();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl
new file mode 100644
index 0000000..c493409
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<i32>, array_index: u32, level: u32) -> vec4<u32>
+fn textureLoad_1b051f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1b051f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1b051f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1b051f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d638828
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_1b051f() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1b051f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1b051f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1b051f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d638828
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_1b051f() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1b051f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_1b051f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1b051f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.glsl
new file mode 100644
index 0000000..8e6d181
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_1b051f() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_1b051f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_1b051f() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_1b051f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_1b051f() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_1b051f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.msl
new file mode 100644
index 0000000..ddf4a08
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_1b051f(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_1b051f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_1b051f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_1b051f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.spvasm
new file mode 100644
index 0000000..fd14d43
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_1b051f "textureLoad_1b051f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %40 = OpConstantNull %v4uint
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_1b051f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %40
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %uint %arg_3
+ %27 = OpImageFetch %v4uint %29 %36 Lod %37
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_1b051f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_1b051f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_1b051f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.wgsl
new file mode 100644
index 0000000..576677d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b051f.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_1b051f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1b051f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_1b051f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1b051f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
index 814c344..5e1e301 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.dxc.hlsl
@@ -33,9 +33,9 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, 0u)).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgb;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, 0u)).r, plane1.Load(uint3(coord, 0u)).rg, 1.0f));
+ color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f));
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
index 814c344..5e1e301 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.fxc.hlsl
@@ -33,9 +33,9 @@
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = plane0.Load(uint3(coord, 0u)).rgb;
+ color = plane0.Load(uint3(coord, uint(0))).rgb;
} else {
- color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, 0u)).r, plane1.Load(uint3(coord, 0u)).rg, 1.0f));
+ color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f));
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
index 57b88a2..adc2cf9 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.glsl
@@ -34,9 +34,9 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), int(0u)).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), int(0u)).r, texelFetch(plane1_1, ivec2(coord), int(0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
@@ -103,9 +103,9 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), int(0u)).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), int(0u)).r, texelFetch(plane1_1, ivec2(coord), int(0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
@@ -166,9 +166,9 @@
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) {
- color = texelFetch(plane0_1, ivec2(coord), int(0u)).rgb;
+ color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else {
- color = (vec4(texelFetch(plane0_1, ivec2(coord), int(0u)).r, texelFetch(plane1_1, ivec2(coord), int(0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl
index 7a9334b..f18ad2f 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.msl
@@ -45,9 +45,9 @@
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) {
float3 color = 0.0f;
if ((params.numPlanes == 1u)) {
- color = float4(plane0.read(uint2(coord), 0u)).rgb;
+ color = float4(plane0.read(uint2(coord), 0)).rgb;
} else {
- color = (float4(plane0.read(uint2(coord), 0u)[0], float4(plane1.read(uint2(coord), 0u)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
}
if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams);
diff --git a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm
index 872b502..c1606c9 100644
--- a/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureLoad/1bfdfb.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 139
+; Bound: 141
; Schema: 0
OpCapability Shader
%28 = OpExtInstImport "GLSL.std.450"
@@ -108,17 +108,19 @@
%v2uint = OpTypeVector %uint 2
%62 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams
%uint_1 = OpConstant %uint 1
- %78 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %79 = OpConstantNull %int
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
+ %93 = OpConstantNull %uint
%void = OpTypeVoid
- %109 = OpTypeFunction %void
- %113 = OpConstantNull %v2uint
+ %111 = OpTypeFunction %void
+ %115 = OpConstantNull %v2uint
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %126 = OpTypeFunction %v4float
+ %128 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %22
%v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams
@@ -167,82 +169,82 @@
OpSelectionMerge %74 None
OpBranchConditional %73 %75 %76
%75 = OpLabel
- %77 = OpImageFetch %v4float %plane0 %coord Lod %78
- %79 = OpVectorShuffle %v3float %77 %77 0 1 2
- OpStore %color %79
+ %77 = OpImageFetch %v4float %plane0 %coord Lod %79
+ %80 = OpVectorShuffle %v3float %77 %77 0 1 2
+ OpStore %color %80
OpBranch %74
%76 = OpLabel
- %80 = OpImageFetch %v4float %plane0 %coord Lod %78
- %81 = OpCompositeExtract %float %80 0
- %82 = OpImageFetch %v4float %plane1 %coord Lod %78
- %84 = OpVectorShuffle %v2float %82 %82 0 1
- %85 = OpCompositeExtract %float %84 0
- %86 = OpCompositeExtract %float %84 1
- %88 = OpCompositeConstruct %v4float %81 %85 %86 %float_1
- %89 = OpCompositeExtract %mat3v4float %params_0 2
- %90 = OpVectorTimesMatrix %v3float %88 %89
- OpStore %color %90
+ %81 = OpImageFetch %v4float %plane0 %coord Lod %79
+ %82 = OpCompositeExtract %float %81 0
+ %83 = OpImageFetch %v4float %plane1 %coord Lod %79
+ %85 = OpVectorShuffle %v2float %83 %83 0 1
+ %86 = OpCompositeExtract %float %85 0
+ %87 = OpCompositeExtract %float %85 1
+ %89 = OpCompositeConstruct %v4float %82 %86 %87 %float_1
+ %90 = OpCompositeExtract %mat3v4float %params_0 2
+ %91 = OpVectorTimesMatrix %v3float %89 %90
+ OpStore %color %91
OpBranch %74
%74 = OpLabel
- %91 = OpCompositeExtract %uint %params_0 1
- %92 = OpIEqual %bool %91 %78
- OpSelectionMerge %93 None
- OpBranchConditional %92 %94 %93
- %94 = OpLabel
- %96 = OpLoad %v3float %color
- %97 = OpCompositeExtract %GammaTransferParams %params_0 3
- %95 = OpFunctionCall %v3float %gammaCorrection %96 %97
- OpStore %color %95
- %98 = OpCompositeExtract %mat3v3float %params_0 5
- %99 = OpLoad %v3float %color
- %100 = OpMatrixTimesVector %v3float %98 %99
- OpStore %color %100
- %102 = OpLoad %v3float %color
- %103 = OpCompositeExtract %GammaTransferParams %params_0 4
- %101 = OpFunctionCall %v3float %gammaCorrection %102 %103
- OpStore %color %101
- OpBranch %93
- %93 = OpLabel
+ %92 = OpCompositeExtract %uint %params_0 1
+ %94 = OpIEqual %bool %92 %93
+ OpSelectionMerge %95 None
+ OpBranchConditional %94 %96 %95
+ %96 = OpLabel
+ %98 = OpLoad %v3float %color
+ %99 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %97 = OpFunctionCall %v3float %gammaCorrection %98 %99
+ OpStore %color %97
+ %100 = OpCompositeExtract %mat3v3float %params_0 5
+ %101 = OpLoad %v3float %color
+ %102 = OpMatrixTimesVector %v3float %100 %101
+ OpStore %color %102
%104 = OpLoad %v3float %color
- %105 = OpCompositeExtract %float %104 0
- %106 = OpCompositeExtract %float %104 1
- %107 = OpCompositeExtract %float %104 2
- %108 = OpCompositeConstruct %v4float %105 %106 %107 %float_1
- OpReturnValue %108
+ %105 = OpCompositeExtract %GammaTransferParams %params_0 4
+ %103 = OpFunctionCall %v3float %gammaCorrection %104 %105
+ OpStore %color %103
+ OpBranch %95
+ %95 = OpLabel
+ %106 = OpLoad %v3float %color
+ %107 = OpCompositeExtract %float %106 0
+ %108 = OpCompositeExtract %float %106 1
+ %109 = OpCompositeExtract %float %106 2
+ %110 = OpCompositeConstruct %v4float %107 %108 %109 %float_1
+ OpReturnValue %110
OpFunctionEnd
-%textureLoad_1bfdfb = OpFunction %void None %109
- %112 = OpLabel
- %arg_1 = OpVariable %_ptr_Function_v2uint Function %113
+%textureLoad_1bfdfb = OpFunction %void None %111
+ %114 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %115
%res = OpVariable %_ptr_Function_v4float Function %5
- OpStore %arg_1 %113
- %117 = OpLoad %11 %arg_0
- %118 = OpLoad %11 %ext_tex_plane_1
- %119 = OpLoad %v2uint %arg_1
- %122 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
- %123 = OpLoad %ExternalTextureParams %122
- %116 = OpFunctionCall %v4float %textureLoadExternal %117 %118 %119 %123
- OpStore %res %116
+ OpStore %arg_1 %115
+ %119 = OpLoad %11 %arg_0
+ %120 = OpLoad %11 %ext_tex_plane_1
+ %121 = OpLoad %v2uint %arg_1
+ %124 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
+ %125 = OpLoad %ExternalTextureParams %124
+ %118 = OpFunctionCall %v4float %textureLoadExternal %119 %120 %121 %125
+ OpStore %res %118
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %126
- %128 = OpLabel
- %129 = OpFunctionCall %void %textureLoad_1bfdfb
+%vertex_main_inner = OpFunction %v4float None %128
+ %130 = OpLabel
+ %131 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %109
- %131 = OpLabel
- %132 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %132
+%vertex_main = OpFunction %void None %111
+ %133 = OpLabel
+ %134 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %134
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %109
- %134 = OpLabel
- %135 = OpFunctionCall %void %textureLoad_1bfdfb
+%fragment_main = OpFunction %void None %111
+ %136 = OpLabel
+ %137 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %109
- %137 = OpLabel
- %138 = OpFunctionCall %void %textureLoad_1bfdfb
+%compute_main = OpFunction %void None %111
+ %139 = OpLabel
+ %140 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl
new file mode 100644
index 0000000..8009c57
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureLoad(texture: texture_1d<u32>, coords: u32, level: i32) -> vec4<u32>
+fn textureLoad_216c37() {
+ var arg_1 = 1u;
+ var arg_2 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_216c37();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_216c37();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_216c37();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..43c73cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_216c37() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(uint2(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_216c37();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_216c37();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_216c37();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..43c73cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_216c37() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(uint2(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_216c37();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_216c37();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_216c37();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.glsl
new file mode 100644
index 0000000..1555f2a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_216c37() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_216c37();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_216c37() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_216c37();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'usampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_216c37() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_216c37();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.msl
new file mode 100644
index 0000000..46e953b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_216c37(texture1d<uint, access::sample> tint_symbol_1) {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ uint4 res = tint_symbol_1.read(uint(arg_1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureLoad_216c37(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_216c37(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_216c37(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.spvasm
new file mode 100644
index 0000000..b77b304
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_216c37 "textureLoad_216c37"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %20 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_216c37 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %20
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_216c37
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_216c37
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_216c37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.wgsl
new file mode 100644
index 0000000..17c79d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/216c37.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureLoad_216c37() {
+ var arg_1 = 1u;
+ var arg_2 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_216c37();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_216c37();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_216c37();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl
new file mode 100644
index 0000000..732e25a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureLoad(texture: texture_3d<i32>, coords: vec3<u32>, level: i32) -> vec4<i32>
+fn textureLoad_223246() {
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_223246();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_223246();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_223246();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1589eae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_223246() {
+ uint3 arg_1 = (0u).xxx;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(uint4(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_223246();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_223246();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_223246();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1589eae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_223246() {
+ uint3 arg_1 = (0u).xxx;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(uint4(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_223246();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_223246();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_223246();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.glsl
new file mode 100644
index 0000000..127badd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_223246() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_223246();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_223246() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_223246();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_223246() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_223246();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.msl
new file mode 100644
index 0000000..324ebe6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_223246(texture3d<int, access::sample> tint_symbol_1) {
+ uint3 arg_1 = uint3(0u);
+ int arg_2 = 1;
+ int4 res = tint_symbol_1.read(uint3(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureLoad_223246(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_223246(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_223246(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.spvasm
new file mode 100644
index 0000000..a5ebb89
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_223246 "textureLoad_223246"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %19 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_223246 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v3uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_223246
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_223246
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_223246
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.wgsl
new file mode 100644
index 0000000..119a40b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/223246.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureLoad_223246() {
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_223246();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_223246();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_223246();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl
new file mode 100644
index 0000000..99b25df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<u32>, array_index: i32, level: u32) -> vec4<i32>
+fn textureLoad_2363be() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2363be();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2363be();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2363be();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b3099c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_2363be() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ int4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2363be();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2363be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2363be();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b3099c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_2363be() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ int4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2363be();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2363be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2363be();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.glsl
new file mode 100644
index 0000000..56f9130
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_2363be() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_2363be();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_2363be() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_2363be();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_2363be() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_2363be();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.msl
new file mode 100644
index 0000000..74c4e16
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_2363be(texture2d_array<int, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_2363be(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_2363be(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_2363be(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.spvasm
new file mode 100644
index 0000000..7995b70
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_2363be "textureLoad_2363be"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %43 = OpConstantNull %v4int
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_2363be = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_v4int Function %43
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2uint %arg_1
+ %35 = OpCompositeExtract %uint %34 0
+ %36 = OpCompositeExtract %uint %34 1
+ %38 = OpLoad %int %arg_2
+ %37 = OpBitcast %uint %38
+ %39 = OpCompositeConstruct %v3uint %35 %36 %37
+ %40 = OpLoad %uint %arg_3
+ %30 = OpImageFetch %v4int %32 %39 Lod %40
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_2363be
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_2363be
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureLoad_2363be
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.wgsl
new file mode 100644
index 0000000..35157c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2363be.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_2363be() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2363be();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2363be();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2363be();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl
new file mode 100644
index 0000000..69b005c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureLoad(texture: texture_2d<f32>, coords: vec2<i32>, level: u32) -> vec4<f32>
+fn textureLoad_2d479c() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2d479c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2d479c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2d479c();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..364f342
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_2d479c() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(int3(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2d479c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2d479c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2d479c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..364f342
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_2d479c() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(int3(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_2d479c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_2d479c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_2d479c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.glsl
new file mode 100644
index 0000000..87a8fd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_2d479c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_2d479c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_2d479c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_2d479c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_2d479c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_2d479c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.msl
new file mode 100644
index 0000000..fa0fc90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_2d479c(texture2d<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureLoad_2d479c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_2d479c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_2d479c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.spvasm
new file mode 100644
index 0000000..59d6c52
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_2d479c "textureLoad_2d479c"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_2d479c = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Lod %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_2d479c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_2d479c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_2d479c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.wgsl
new file mode 100644
index 0000000..1740e11
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/2d479c.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureLoad_2d479c() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_2d479c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_2d479c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_2d479c();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl
new file mode 100644
index 0000000..dc74980
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<i32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<i32>, coords: vec2<i32>, sample_index: u32) -> vec4<i32>
+fn textureLoad_38f8ab() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_38f8ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_38f8ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_38f8ab();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..775c51a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_38f8ab() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_38f8ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_38f8ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_38f8ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..775c51a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_38f8ab() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_38f8ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_38f8ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_38f8ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.glsl
new file mode 100644
index 0000000..be03c72
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_38f8ab() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_38f8ab();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_38f8ab() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_38f8ab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_38f8ab() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_38f8ab();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.msl
new file mode 100644
index 0000000..fb04229
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_38f8ab(texture2d_ms<int, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<int, access::read> tint_symbol_2) {
+ textureLoad_38f8ab(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<int, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<int, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_38f8ab(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_38f8ab(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.spvasm
new file mode 100644
index 0000000..426ee5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_38f8ab "textureLoad_38f8ab"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_38f8ab = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Sample %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_38f8ab
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_38f8ab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_38f8ab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.wgsl
new file mode 100644
index 0000000..c09340e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/38f8ab.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureLoad_38f8ab() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_38f8ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_38f8ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_38f8ab();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl
new file mode 100644
index 0000000..9a60cf5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<i32>, array_index: u32, level: u32) -> vec4<f32>
+fn textureLoad_3c96e8() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3c96e8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3c96e8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3c96e8();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4a6573b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3c96e8() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3c96e8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3c96e8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3c96e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4a6573b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3c96e8() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3c96e8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3c96e8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3c96e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.glsl
new file mode 100644
index 0000000..4c840ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_3c96e8() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_3c96e8();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_3c96e8() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_3c96e8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_3c96e8() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_3c96e8();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.msl
new file mode 100644
index 0000000..f9c58d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_3c96e8(texture2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_3c96e8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_3c96e8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_3c96e8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.spvasm
new file mode 100644
index 0000000..fe674a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_3c96e8 "textureLoad_3c96e8"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_3c96e8 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %34 = OpLoad %uint %arg_2
+ %33 = OpBitcast %int %34
+ %35 = OpCompositeConstruct %v3int %31 %32 %33
+ %36 = OpLoad %uint %arg_3
+ %27 = OpImageFetch %v4float %28 %35 Lod %36
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_3c96e8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureLoad_3c96e8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_3c96e8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.wgsl
new file mode 100644
index 0000000..7ef60df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3c96e8.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_3c96e8() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3c96e8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3c96e8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3c96e8();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl
new file mode 100644
index 0000000..6db9486
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<u32>, array_index: u32, level: i32) -> vec4<i32>
+fn textureLoad_3d3fd1() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3d3fd1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3d3fd1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3d3fd1();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e2bc144
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_3d3fd1() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ int4 res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3d3fd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3d3fd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3d3fd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e2bc144
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_3d3fd1() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ int4 res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3d3fd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3d3fd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3d3fd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.glsl
new file mode 100644
index 0000000..7b27d90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_3d3fd1() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_3d3fd1();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_3d3fd1() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_3d3fd1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_3d3fd1() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureLoad_3d3fd1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.msl
new file mode 100644
index 0000000..96fb2e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_3d3fd1(texture2d_array<int, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_3d3fd1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_3d3fd1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_3d3fd1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.spvasm
new file mode 100644
index 0000000..75c9dbb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_3d3fd1 "textureLoad_3d3fd1"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %42 = OpConstantNull %v4int
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_3d3fd1 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_v4int Function %42
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2uint %arg_1
+ %35 = OpCompositeExtract %uint %34 0
+ %36 = OpCompositeExtract %uint %34 1
+ %37 = OpLoad %uint %arg_2
+ %38 = OpCompositeConstruct %v3uint %35 %36 %37
+ %39 = OpLoad %int %arg_3
+ %30 = OpImageFetch %v4int %32 %38 Lod %39
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_3d3fd1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_3d3fd1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureLoad_3d3fd1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.wgsl
new file mode 100644
index 0000000..600e3fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3d3fd1.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_3d3fd1() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3d3fd1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3d3fd1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3d3fd1();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl
new file mode 100644
index 0000000..dbc3d53
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureLoad(texture: texture_1d<f32>, coords: i32, level: u32) -> vec4<f32>
+fn textureLoad_3da3ed() {
+ var arg_1 = 1i;
+ var arg_2 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3da3ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3da3ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3da3ed();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..97aa71c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3da3ed() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(int2(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3da3ed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3da3ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3da3ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..97aa71c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_3da3ed() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(int2(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_3da3ed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_3da3ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_3da3ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.glsl
new file mode 100644
index 0000000..1fbe075
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_3da3ed() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_3da3ed();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_3da3ed() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_3da3ed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'sampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_3da3ed() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_3da3ed();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'sampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.msl
new file mode 100644
index 0000000..9cb46bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_3da3ed(texture1d<float, access::sample> tint_symbol_1) {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ float4 res = tint_symbol_1.read(uint(arg_1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureLoad_3da3ed(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_3da3ed(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_3da3ed(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.spvasm
new file mode 100644
index 0000000..ff35dbc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_3da3ed "textureLoad_3da3ed"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_3da3ed = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %uint_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %int %arg_1
+ %29 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Lod %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_3da3ed
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_3da3ed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_3da3ed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.wgsl
new file mode 100644
index 0000000..909a768
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/3da3ed.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureLoad_3da3ed() {
+ var arg_1 = 1i;
+ var arg_2 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_3da3ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_3da3ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_3da3ed();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl
new file mode 100644
index 0000000..e14788e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureLoad(texture: texture_2d<f32>, coords: vec2<u32>, level: i32) -> vec4<f32>
+fn textureLoad_439e2a() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_439e2a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_439e2a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_439e2a();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a1ae75e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_439e2a() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(uint3(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_439e2a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_439e2a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_439e2a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a1ae75e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_439e2a() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(uint3(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_439e2a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_439e2a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_439e2a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.glsl
new file mode 100644
index 0000000..a22fd5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_439e2a() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_439e2a();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_439e2a() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_439e2a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_439e2a() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_439e2a();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.msl
new file mode 100644
index 0000000..5a3246d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_439e2a(texture2d<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureLoad_439e2a(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_439e2a(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_439e2a(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.spvasm
new file mode 100644
index 0000000..f7cc6a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_439e2a "textureLoad_439e2a"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_439e2a = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2uint %arg_1
+ %29 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Lod %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_439e2a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_439e2a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_439e2a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.wgsl
new file mode 100644
index 0000000..a46785f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/439e2a.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureLoad_439e2a() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_439e2a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_439e2a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_439e2a();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl
new file mode 100644
index 0000000..466e57b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<u32>, array_index: i32, level: u32) -> vec4<f32>
+fn textureLoad_46a93f() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_46a93f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_46a93f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_46a93f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..765ad54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_46a93f() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_46a93f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_46a93f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_46a93f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..765ad54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_46a93f() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_46a93f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_46a93f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_46a93f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.glsl
new file mode 100644
index 0000000..c048820
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_46a93f() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_46a93f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_46a93f() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_46a93f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_46a93f() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_46a93f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.msl
new file mode 100644
index 0000000..2116606
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_46a93f(texture2d_array<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_46a93f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_46a93f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_46a93f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.spvasm
new file mode 100644
index 0000000..009e43c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.spvasm
@@ -0,0 +1,99 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_46a93f "textureLoad_46a93f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_46a93f = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %uint %arg_3
+ %30 = OpImageFetch %v4float %31 %38 Lod %39
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_46a93f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_46a93f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureLoad_46a93f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.wgsl
new file mode 100644
index 0000000..54c6d9eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/46a93f.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_46a93f() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_46a93f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_46a93f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_46a93f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl
new file mode 100644
index 0000000..845846a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<i32>, array_index: u32, level: i32) -> vec4<f32>
+fn textureLoad_4acb64() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4acb64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4acb64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4acb64();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..20e8d8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_4acb64() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4acb64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4acb64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4acb64();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..20e8d8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_4acb64() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4acb64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4acb64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4acb64();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.glsl
new file mode 100644
index 0000000..beae394
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_4acb64() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_4acb64();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_4acb64() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_4acb64();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_4acb64() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureLoad_4acb64();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.msl
new file mode 100644
index 0000000..51b9fe8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_4acb64(texture2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_4acb64(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_4acb64(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_4acb64(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.spvasm
new file mode 100644
index 0000000..b9042cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.spvasm
@@ -0,0 +1,99 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_4acb64 "textureLoad_4acb64"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_4acb64 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %int %arg_3
+ %30 = OpImageFetch %v4float %31 %38 Lod %39
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_4acb64
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_4acb64
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureLoad_4acb64
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.wgsl
new file mode 100644
index 0000000..95aa108
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4acb64.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_4acb64() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4acb64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4acb64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4acb64();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl
new file mode 100644
index 0000000..80fa3b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureLoad(texture: texture_1d<i32>, coords: u32, level: i32) -> vec4<i32>
+fn textureLoad_4c423f() {
+ var arg_1 = 1u;
+ var arg_2 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4c423f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4c423f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4c423f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b5c150a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_4c423f() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(uint2(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4c423f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4c423f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4c423f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b5c150a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_4c423f() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(uint2(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4c423f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_4c423f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4c423f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.glsl
new file mode 100644
index 0000000..57f0a4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_4c423f() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_4c423f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_4c423f() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_4c423f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'isampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_4c423f() {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, int(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_4c423f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.msl
new file mode 100644
index 0000000..8368fd1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_4c423f(texture1d<int, access::sample> tint_symbol_1) {
+ uint arg_1 = 1u;
+ int arg_2 = 1;
+ int4 res = tint_symbol_1.read(uint(arg_1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureLoad_4c423f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_4c423f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_4c423f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.spvasm
new file mode 100644
index 0000000..4de5b1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_4c423f "textureLoad_4c423f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_4c423f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %21
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_4c423f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_4c423f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_4c423f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.wgsl
new file mode 100644
index 0000000..cea4de3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4c423f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureLoad_4c423f() {
+ var arg_1 = 1u;
+ var arg_2 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4c423f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_4c423f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4c423f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl
new file mode 100644
index 0000000..bdf813a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<u32>, array_index: i32, level: i32) -> vec4<u32>
+fn textureLoad_53e142() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_53e142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_53e142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_53e142();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a93753d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_53e142() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ uint4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_53e142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_53e142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_53e142();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a93753d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_53e142() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ uint4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_53e142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_53e142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_53e142();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.glsl
new file mode 100644
index 0000000..c0bcb18
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_53e142() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_53e142();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_53e142() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_53e142();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_53e142() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureLoad_53e142();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.msl
new file mode 100644
index 0000000..5bf13f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_53e142(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_53e142(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_53e142(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_53e142(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.spvasm
new file mode 100644
index 0000000..5d5ccfa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_53e142 "textureLoad_53e142"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %40 = OpConstantNull %v4uint
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_53e142 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %40
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %int_1
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %int %arg_3
+ %27 = OpImageFetch %v4uint %29 %36 Lod %37
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_53e142
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_53e142
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_53e142
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.wgsl
new file mode 100644
index 0000000..e6a62b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/53e142.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_53e142() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_53e142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_53e142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_53e142();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl
new file mode 100644
index 0000000..36e38cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<u32>, array_index: i32, level: i32) -> vec4<f32>
+fn textureLoad_54a59b() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_54a59b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_54a59b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_54a59b();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..95f5246
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_54a59b() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_54a59b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_54a59b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_54a59b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..95f5246
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_54a59b() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_54a59b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_54a59b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_54a59b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.glsl
new file mode 100644
index 0000000..30ec30f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_54a59b() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_54a59b();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_54a59b() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_54a59b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_54a59b() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureLoad_54a59b();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.msl
new file mode 100644
index 0000000..54409a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_54a59b(texture2d_array<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_54a59b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_54a59b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_54a59b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.spvasm
new file mode 100644
index 0000000..326d53c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_54a59b "textureLoad_54a59b"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_54a59b = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %int_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2uint %arg_1
+ %31 = OpCompositeExtract %uint %30 0
+ %32 = OpCompositeExtract %uint %30 1
+ %34 = OpLoad %int %arg_2
+ %33 = OpBitcast %uint %34
+ %35 = OpCompositeConstruct %v3uint %31 %32 %33
+ %36 = OpLoad %int %arg_3
+ %27 = OpImageFetch %v4float %28 %35 Lod %36
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_54a59b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureLoad_54a59b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_54a59b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.wgsl
new file mode 100644
index 0000000..08cd7ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/54a59b.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_54a59b() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_54a59b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_54a59b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_54a59b();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl
new file mode 100644
index 0000000..7d26000
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureLoad(texture: texture_1d<i32>, coords: i32, level: u32) -> vec4<i32>
+fn textureLoad_62d1de() {
+ var arg_1 = 1i;
+ var arg_2 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_62d1de();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_62d1de();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_62d1de();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..3e2fc86
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_62d1de() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(int2(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_62d1de();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_62d1de();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_62d1de();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..3e2fc86
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_62d1de() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(int2(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_62d1de();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_62d1de();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_62d1de();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.glsl
new file mode 100644
index 0000000..8a29cdc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_62d1de() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_62d1de();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_62d1de() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_62d1de();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'isampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_62d1de() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_62d1de();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'isampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.msl
new file mode 100644
index 0000000..f9ba804
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_62d1de(texture1d<int, access::sample> tint_symbol_1) {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ int4 res = tint_symbol_1.read(uint(arg_1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureLoad_62d1de(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_62d1de(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_62d1de(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.spvasm
new file mode 100644
index 0000000..0621eea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_62d1de "textureLoad_62d1de"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_62d1de = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_62d1de
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_62d1de
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_62d1de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.wgsl
new file mode 100644
index 0000000..743651f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/62d1de.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureLoad_62d1de() {
+ var arg_1 = 1i;
+ var arg_2 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_62d1de();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_62d1de();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_62d1de();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl
new file mode 100644
index 0000000..49a1afb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<i32>, array_index: i32, level: u32) -> vec4<u32>
+fn textureLoad_656d76() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_656d76();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_656d76();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_656d76();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..81de6fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_656d76() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uint4 res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_656d76();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_656d76();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_656d76();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..81de6fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_656d76() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uint4 res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_656d76();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_656d76();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_656d76();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.glsl
new file mode 100644
index 0000000..2eb385b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_656d76() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_656d76();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_656d76() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_656d76();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_656d76() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_656d76();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.msl
new file mode 100644
index 0000000..11b7b65
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_656d76(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_656d76(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_656d76(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_656d76(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.spvasm
new file mode 100644
index 0000000..2fd38ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_656d76 "textureLoad_656d76"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %42 = OpConstantNull %v4uint
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_656d76 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_v4uint Function %42
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2int %arg_1
+ %35 = OpCompositeExtract %int %34 0
+ %36 = OpCompositeExtract %int %34 1
+ %37 = OpLoad %int %arg_2
+ %38 = OpCompositeConstruct %v3int %35 %36 %37
+ %39 = OpLoad %uint %arg_3
+ %30 = OpImageFetch %v4uint %32 %38 Lod %39
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_656d76
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_656d76
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureLoad_656d76
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.wgsl
new file mode 100644
index 0000000..3957ee6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/656d76.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_656d76() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_656d76();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_656d76();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_656d76();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl
new file mode 100644
index 0000000..cf9675b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: u32, level: u32) -> f32
+fn textureLoad_66be47() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_66be47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_66be47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_66be47();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e21edcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_66be47() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_66be47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_66be47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_66be47();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e21edcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_66be47() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_66be47();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_66be47();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_66be47();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.glsl
new file mode 100644
index 0000000..4aa7bd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_66be47() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_66be47();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_66be47() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3)).x;
+}
+
+void fragment_main() {
+ textureLoad_66be47();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_66be47() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3)).x;
+}
+
+void compute_main() {
+ textureLoad_66be47();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.msl
new file mode 100644
index 0000000..e64f0f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_66be47(depth2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_66be47(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_66be47(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_66be47(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.spvasm
new file mode 100644
index 0000000..b97083d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.spvasm
@@ -0,0 +1,97 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_66be47 "textureLoad_66be47"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_66be47 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %uint %arg_3
+ %28 = OpImageFetch %v4float %29 %36 Lod %37
+ %27 = OpCompositeExtract %float %28 0
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_66be47
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureLoad_66be47
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_66be47
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.wgsl
new file mode 100644
index 0000000..24d1011
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/66be47.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_66be47() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_66be47();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_66be47();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_66be47();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl
new file mode 100644
index 0000000..975fbb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d;
+
+// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<i32>, sample_index: u32) -> f32
+fn textureLoad_6925bc() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6925bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6925bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6925bc();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4ce3b6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_6925bc() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float res = arg_0.Load(int3(arg_1, 0), arg_2).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6925bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6925bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6925bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4ce3b6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_6925bc() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float res = arg_0.Load(int3(arg_1, 0), arg_2).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6925bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6925bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6925bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.glsl
new file mode 100644
index 0000000..6a5b9c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6925bc() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ float res = texelFetch(arg_0_1, arg_1, int(arg_2)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_6925bc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6925bc() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ float res = texelFetch(arg_0_1, arg_1, int(arg_2)).x;
+}
+
+void fragment_main() {
+ textureLoad_6925bc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6925bc() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ float res = texelFetch(arg_0_1, arg_1, int(arg_2)).x;
+}
+
+void compute_main() {
+ textureLoad_6925bc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.msl
new file mode 100644
index 0000000..5512c42
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6925bc(depth2d_ms<float, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_6925bc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_6925bc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6925bc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.spvasm
new file mode 100644
index 0000000..ce6b52e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_6925bc "textureLoad_6925bc"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_float = OpTypePointer Function %float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6925bc = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %27 = OpImageFetch %v4float %28 %29 Sample %30
+ %26 = OpCompositeExtract %float %27 0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_6925bc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_6925bc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_6925bc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.wgsl
new file mode 100644
index 0000000..f673c8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6925bc.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureLoad_6925bc() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6925bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6925bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6925bc();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl
new file mode 100644
index 0000000..6e99e75
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureLoad(texture: texture_1d<u32>, coords: i32, level: u32) -> vec4<u32>
+fn textureLoad_6b77d4() {
+ var arg_1 = 1i;
+ var arg_2 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6b77d4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6b77d4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6b77d4();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..65a6988
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6b77d4() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(int2(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6b77d4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6b77d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6b77d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..65a6988
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6b77d4() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(int2(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6b77d4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6b77d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6b77d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.glsl
new file mode 100644
index 0000000..c3be096
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_6b77d4() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_6b77d4();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_6b77d4() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_6b77d4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'usampler1D' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_6b77d4() {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_6b77d4();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'usampler1D' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.msl
new file mode 100644
index 0000000..115258a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6b77d4(texture1d<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint4 res = tint_symbol_1.read(uint(arg_1), 0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureLoad_6b77d4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture1d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_6b77d4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6b77d4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.spvasm
new file mode 100644
index 0000000..44efbaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.spvasm
@@ -0,0 +1,90 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_6b77d4 "textureLoad_6b77d4"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6b77d4 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_6b77d4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_6b77d4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_6b77d4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.wgsl
new file mode 100644
index 0000000..a038f632a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6b77d4.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureLoad_6b77d4() {
+ var arg_1 = 1i;
+ var arg_2 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6b77d4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6b77d4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6b77d4();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl
new file mode 100644
index 0000000..899de73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureLoad(texture: texture_3d<u32>, coords: vec3<i32>, level: u32) -> vec4<u32>
+fn textureLoad_6bf4b7() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6bf4b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6bf4b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6bf4b7();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a18bddf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6bf4b7() {
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(int4(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6bf4b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6bf4b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6bf4b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a18bddf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6bf4b7() {
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(int4(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6bf4b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_6bf4b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6bf4b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.glsl
new file mode 100644
index 0000000..710efc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_6bf4b7() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_6bf4b7();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_6bf4b7() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_6bf4b7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_6bf4b7() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_6bf4b7();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.msl
new file mode 100644
index 0000000..4696cef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6bf4b7(texture3d<uint, access::sample> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint arg_2 = 1u;
+ uint4 res = tint_symbol_1.read(uint3(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureLoad_6bf4b7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_6bf4b7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6bf4b7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.spvasm
new file mode 100644
index 0000000..78fe0c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_6bf4b7 "textureLoad_6bf4b7"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6bf4b7 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v3int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_6bf4b7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_6bf4b7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_6bf4b7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.wgsl
new file mode 100644
index 0000000..e9564fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6bf4b7.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureLoad_6bf4b7() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6bf4b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_6bf4b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6bf4b7();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl
new file mode 100644
index 0000000..fafee55
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<i32>, array_index: i32, level: u32) -> vec4<f32>
+fn textureLoad_789045() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_789045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_789045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_789045();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ba39885
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_789045() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float4 res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_789045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_789045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_789045();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ba39885
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_789045() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float4 res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_789045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_789045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_789045();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.glsl
new file mode 100644
index 0000000..93e95e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_789045() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_789045();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_789045() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_789045();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_789045() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_789045();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.msl
new file mode 100644
index 0000000..267981b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_789045(texture2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_789045(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_789045(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_789045(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.spvasm
new file mode 100644
index 0000000..6e4a503
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_789045 "textureLoad_789045"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_789045 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %24
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %36 = OpLoad %int %arg_2
+ %37 = OpCompositeConstruct %v3int %34 %35 %36
+ %38 = OpLoad %uint %arg_3
+ %30 = OpImageFetch %v4float %31 %37 Lod %38
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_789045
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_789045
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_789045
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.wgsl
new file mode 100644
index 0000000..b1a15dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/789045.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_789045() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_789045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_789045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_789045();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl
new file mode 100644
index 0000000..5fe7c16
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<i32>, array_index: u32, level: i32) -> vec4<u32>
+fn textureLoad_7ab4df() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7ab4df();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7ab4df();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7ab4df();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ec196f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_7ab4df() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uint4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7ab4df();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7ab4df();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7ab4df();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ec196f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_7ab4df() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uint4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7ab4df();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7ab4df();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7ab4df();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.glsl
new file mode 100644
index 0000000..d1ac243
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7ab4df() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_7ab4df();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7ab4df() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_7ab4df();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7ab4df() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureLoad_7ab4df();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.msl
new file mode 100644
index 0000000..1cacb69
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7ab4df(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_7ab4df(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_7ab4df(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7ab4df(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.spvasm
new file mode 100644
index 0000000..e118067
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_7ab4df "textureLoad_7ab4df"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %43 = OpConstantNull %v4uint
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7ab4df = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_v4uint Function %43
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2int %arg_1
+ %35 = OpCompositeExtract %int %34 0
+ %36 = OpCompositeExtract %int %34 1
+ %38 = OpLoad %uint %arg_2
+ %37 = OpBitcast %int %38
+ %39 = OpCompositeConstruct %v3int %35 %36 %37
+ %40 = OpLoad %int %arg_3
+ %30 = OpImageFetch %v4uint %32 %39 Lod %40
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_7ab4df
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_7ab4df
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureLoad_7ab4df
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.wgsl
new file mode 100644
index 0000000..f4aa72e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7ab4df.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_7ab4df() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7ab4df();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7ab4df();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7ab4df();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl
new file mode 100644
index 0000000..d6db0ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<i32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<i32>, coords: vec2<u32>, sample_index: i32) -> vec4<i32>
+fn textureLoad_7bee94() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7bee94();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7bee94();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7bee94();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d9e0566
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_7bee94() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7bee94();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7bee94();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7bee94();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d9e0566
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_7bee94() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7bee94();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7bee94();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7bee94();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.glsl
new file mode 100644
index 0000000..e876cbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_7bee94() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_7bee94();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_7bee94() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_7bee94();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_7bee94() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_7bee94();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.msl
new file mode 100644
index 0000000..19eca23
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7bee94(texture2d_ms<int, access::read> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<int, access::read> tint_symbol_2) {
+ textureLoad_7bee94(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<int, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<int, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_7bee94(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7bee94(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.spvasm
new file mode 100644
index 0000000..e191d64
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_7bee94 "textureLoad_7bee94"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7bee94 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Sample %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_7bee94
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_7bee94
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_7bee94
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.wgsl
new file mode 100644
index 0000000..7cc012f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7bee94.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureLoad_7bee94() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7bee94();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7bee94();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7bee94();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl
new file mode 100644
index 0000000..40c0104
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureLoad(texture: texture_depth_2d, coords: vec2<u32>, level: i32) -> f32
+fn textureLoad_7fd822() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7fd822();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7fd822();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7fd822();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..56cd912
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_7fd822() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float res = arg_0.Load(uint3(arg_1, uint(arg_2))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7fd822();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7fd822();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7fd822();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..56cd912
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_7fd822() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float res = arg_0.Load(uint3(arg_1, uint(arg_2))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7fd822();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_7fd822();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7fd822();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.glsl
new file mode 100644
index 0000000..5525b53
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_7fd822() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, ivec2(arg_1), arg_2).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_7fd822();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_7fd822() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, ivec2(arg_1), arg_2).x;
+}
+
+void fragment_main() {
+ textureLoad_7fd822();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_7fd822() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, ivec2(arg_1), arg_2).x;
+}
+
+void compute_main() {
+ textureLoad_7fd822();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.msl
new file mode 100644
index 0000000..fbc1807c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7fd822(depth2d<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureLoad_7fd822(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_7fd822(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7fd822(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.spvasm
new file mode 100644
index 0000000..dcd33ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_7fd822 "textureLoad_7fd822"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_float = OpTypePointer Function %float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7fd822 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %27 = OpImageFetch %v4float %28 %29 Lod %30
+ %26 = OpCompositeExtract %float %27 0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_7fd822
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_7fd822
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_7fd822
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.wgsl
new file mode 100644
index 0000000..90a4a66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7fd822.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureLoad_7fd822() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7fd822();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_7fd822();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7fd822();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl
new file mode 100644
index 0000000..63dcd78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureLoad(texture: texture_depth_2d, coords: vec2<i32>, level: u32) -> f32
+fn textureLoad_8ccbe3() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_8ccbe3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_8ccbe3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_8ccbe3();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5eb8359
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_8ccbe3() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float res = arg_0.Load(int3(arg_1, int(arg_2))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_8ccbe3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_8ccbe3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_8ccbe3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5eb8359
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_8ccbe3() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float res = arg_0.Load(int3(arg_1, int(arg_2))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_8ccbe3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_8ccbe3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_8ccbe3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.glsl
new file mode 100644
index 0000000..b4a68c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_8ccbe3() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ float res = texelFetch(arg_0_1, arg_1, int(arg_2)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_8ccbe3();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_8ccbe3() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ float res = texelFetch(arg_0_1, arg_1, int(arg_2)).x;
+}
+
+void fragment_main() {
+ textureLoad_8ccbe3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_8ccbe3() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ float res = texelFetch(arg_0_1, arg_1, int(arg_2)).x;
+}
+
+void compute_main() {
+ textureLoad_8ccbe3();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.msl
new file mode 100644
index 0000000..0dcde10
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_8ccbe3(depth2d<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureLoad_8ccbe3(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_8ccbe3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_8ccbe3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.spvasm
new file mode 100644
index 0000000..fdd0962
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_8ccbe3 "textureLoad_8ccbe3"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_float = OpTypePointer Function %float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_8ccbe3 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %27 = OpImageFetch %v4float %28 %29 Lod %30
+ %26 = OpCompositeExtract %float %27 0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_8ccbe3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_8ccbe3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_8ccbe3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.wgsl
new file mode 100644
index 0000000..570441e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8ccbe3.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureLoad_8ccbe3() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_8ccbe3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_8ccbe3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_8ccbe3();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl
new file mode 100644
index 0000000..3b82476
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureLoad(texture: texture_3d<u32>, coords: vec3<u32>, level: i32) -> vec4<u32>
+fn textureLoad_92eb1f() {
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_92eb1f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_92eb1f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_92eb1f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a369376
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_92eb1f() {
+ uint3 arg_1 = (0u).xxx;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(uint4(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_92eb1f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_92eb1f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_92eb1f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a369376
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_92eb1f() {
+ uint3 arg_1 = (0u).xxx;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(uint4(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_92eb1f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_92eb1f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_92eb1f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.glsl
new file mode 100644
index 0000000..6784cfe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_92eb1f() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_92eb1f();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_92eb1f() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_92eb1f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_92eb1f() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_92eb1f();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.msl
new file mode 100644
index 0000000..b31aa86
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_92eb1f(texture3d<uint, access::sample> tint_symbol_1) {
+ uint3 arg_1 = uint3(0u);
+ int arg_2 = 1;
+ uint4 res = tint_symbol_1.read(uint3(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureLoad_92eb1f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_92eb1f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_92eb1f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.spvasm
new file mode 100644
index 0000000..279e593
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_92eb1f "textureLoad_92eb1f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3uint = OpTypeVector %uint 3
+ %18 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_92eb1f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v3uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_92eb1f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_92eb1f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_92eb1f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.wgsl
new file mode 100644
index 0000000..4a8be7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/92eb1f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureLoad_92eb1f() {
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_92eb1f();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_92eb1f();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_92eb1f();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl
new file mode 100644
index 0000000..8e27058
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureLoad(texture: texture_2d<i32>, coords: vec2<u32>, level: i32) -> vec4<i32>
+fn textureLoad_9aa733() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9aa733();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9aa733();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9aa733();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..34e1a1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9aa733() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(uint3(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9aa733();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9aa733();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9aa733();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..34e1a1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9aa733() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 res = arg_0.Load(uint3(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9aa733();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9aa733();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9aa733();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.glsl
new file mode 100644
index 0000000..cec5f4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_9aa733() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_9aa733();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_9aa733() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_9aa733();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_9aa733() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_9aa733();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.msl
new file mode 100644
index 0000000..31eb5f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9aa733(texture2d<int, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureLoad_9aa733(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_9aa733(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9aa733(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.spvasm
new file mode 100644
index 0000000..1c67aef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_9aa733 "textureLoad_9aa733"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9aa733 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_9aa733
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_9aa733
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_9aa733
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.wgsl
new file mode 100644
index 0000000..2b8e1a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9aa733.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureLoad_9aa733() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9aa733();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9aa733();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9aa733();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl
new file mode 100644
index 0000000..530c1e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<i32>, array_index: i32, level: u32) -> vec4<i32>
+fn textureLoad_9d70e9() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9d70e9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9d70e9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9d70e9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..3a3134e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9d70e9() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ int4 res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9d70e9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9d70e9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9d70e9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..3a3134e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9d70e9() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ int4 res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9d70e9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9d70e9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9d70e9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.glsl
new file mode 100644
index 0000000..65a8f74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9d70e9() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_9d70e9();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9d70e9() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_9d70e9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9d70e9() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_9d70e9();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.msl
new file mode 100644
index 0000000..0bbe65d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9d70e9(texture2d_array<int, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_9d70e9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_9d70e9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9d70e9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0c1157
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_9d70e9 "textureLoad_9d70e9"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %42 = OpConstantNull %v4int
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9d70e9 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %24
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_v4int Function %42
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2int %arg_1
+ %35 = OpCompositeExtract %int %34 0
+ %36 = OpCompositeExtract %int %34 1
+ %37 = OpLoad %int %arg_2
+ %38 = OpCompositeConstruct %v3int %35 %36 %37
+ %39 = OpLoad %uint %arg_3
+ %30 = OpImageFetch %v4int %32 %38 Lod %39
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_9d70e9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_9d70e9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureLoad_9d70e9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.wgsl
new file mode 100644
index 0000000..6732768
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9d70e9.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_9d70e9() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9d70e9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9d70e9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9d70e9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl
new file mode 100644
index 0000000..02530d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<i32>, array_index: u32, level: u32) -> vec4<i32>
+fn textureLoad_9fbfd9() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9fbfd9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9fbfd9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9fbfd9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..6878a77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9fbfd9() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9fbfd9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9fbfd9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9fbfd9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..6878a77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_9fbfd9() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), int(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9fbfd9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_9fbfd9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9fbfd9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.glsl
new file mode 100644
index 0000000..805dfe5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9fbfd9() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_9fbfd9();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9fbfd9() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_9fbfd9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_9fbfd9() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_9fbfd9();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.msl
new file mode 100644
index 0000000..89526cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9fbfd9(texture2d_array<int, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_9fbfd9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_9fbfd9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9fbfd9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.spvasm
new file mode 100644
index 0000000..f5b5c54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_9fbfd9 "textureLoad_9fbfd9"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %40 = OpConstantNull %v4int
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9fbfd9 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %40
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %uint %arg_3
+ %27 = OpImageFetch %v4int %29 %36 Lod %37
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_9fbfd9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_9fbfd9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_9fbfd9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.wgsl
new file mode 100644
index 0000000..17e197a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9fbfd9.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_9fbfd9() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9fbfd9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_9fbfd9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9fbfd9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl
new file mode 100644
index 0000000..db3610e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureLoad(texture: texture_2d_array<u32>, coords: vec2<u32>, array_index: i32, level: u32) -> vec4<u32>
+fn textureLoad_a24be1() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a24be1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_a24be1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a24be1();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e5c26fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_a24be1() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uint4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_a24be1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_a24be1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_a24be1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e5c26fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_a24be1() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uint4 res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_a24be1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_a24be1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_a24be1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.glsl
new file mode 100644
index 0000000..6f0bc3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_a24be1() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+vec4 vertex_main() {
+ textureLoad_a24be1();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_a24be1() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+void fragment_main() {
+ textureLoad_a24be1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_a24be1() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uvec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), int(arg_3));
+}
+
+void compute_main() {
+ textureLoad_a24be1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.msl
new file mode 100644
index 0000000..062190a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_a24be1(texture2d_array<uint, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureLoad_a24be1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_a24be1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_a24be1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.spvasm
new file mode 100644
index 0000000..71d425b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_a24be1 "textureLoad_a24be1"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %43 = OpConstantNull %v4uint
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_a24be1 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_v4uint Function %43
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2uint %arg_1
+ %35 = OpCompositeExtract %uint %34 0
+ %36 = OpCompositeExtract %uint %34 1
+ %38 = OpLoad %int %arg_2
+ %37 = OpBitcast %uint %38
+ %39 = OpCompositeConstruct %v3uint %35 %36 %37
+ %40 = OpLoad %uint %arg_3
+ %30 = OpImageFetch %v4uint %32 %39 Lod %40
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_a24be1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_a24be1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureLoad_a24be1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.wgsl
new file mode 100644
index 0000000..024ec51
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a24be1.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_a24be1() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a24be1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_a24be1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a24be1();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl
new file mode 100644
index 0000000..0160d1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureLoad(texture: texture_2d_array<i32>, coords: vec2<i32>, array_index: u32, level: i32) -> vec4<i32>
+fn textureLoad_b29f71() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b29f71();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b29f71();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b29f71();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..5f94bd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_b29f71() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ int4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b29f71();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b29f71();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b29f71();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..5f94bd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_b29f71() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ int4 res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b29f71();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b29f71();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b29f71();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.glsl
new file mode 100644
index 0000000..5ee7aa6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_b29f71() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_b29f71();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_b29f71() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_b29f71();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_b29f71() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureLoad_b29f71();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.msl
new file mode 100644
index 0000000..223e7ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b29f71(texture2d_array<int, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureLoad_b29f71(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b29f71(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b29f71(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.spvasm
new file mode 100644
index 0000000..b410a5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b29f71 "textureLoad_b29f71"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %43 = OpConstantNull %v4int
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b29f71 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_v4int Function %43
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2int %arg_1
+ %35 = OpCompositeExtract %int %34 0
+ %36 = OpCompositeExtract %int %34 1
+ %38 = OpLoad %uint %arg_2
+ %37 = OpBitcast %int %38
+ %39 = OpCompositeConstruct %v3int %35 %36 %37
+ %40 = OpLoad %int %arg_3
+ %30 = OpImageFetch %v4int %32 %39 Lod %40
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_b29f71
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_b29f71
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureLoad_b29f71
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.wgsl
new file mode 100644
index 0000000..4e61327
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b29f71.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_b29f71() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b29f71();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b29f71();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b29f71();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl
new file mode 100644
index 0000000..aa852d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<u32>, array_index: i32, level: i32) -> f32
+fn textureLoad_b6ba5d() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b6ba5d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b6ba5d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b6ba5d();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..3be54d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_b6ba5d() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b6ba5d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b6ba5d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b6ba5d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..3be54d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_b6ba5d() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float res = arg_0.Load(uint4(uint3(arg_1, uint(arg_2)), uint(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b6ba5d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b6ba5d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b6ba5d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.glsl
new file mode 100644
index 0000000..47755bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_b6ba5d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_b6ba5d();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_b6ba5d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3).x;
+}
+
+void fragment_main() {
+ textureLoad_b6ba5d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_b6ba5d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, uint(arg_2))), arg_3).x;
+}
+
+void compute_main() {
+ textureLoad_b6ba5d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.msl
new file mode 100644
index 0000000..fa0087d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b6ba5d(depth2d_array<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int arg_3 = 1;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_b6ba5d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b6ba5d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b6ba5d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.spvasm
new file mode 100644
index 0000000..836e869
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.spvasm
@@ -0,0 +1,97 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b6ba5d "textureLoad_b6ba5d"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b6ba5d = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %int_1
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %int %arg_3
+ %28 = OpImageFetch %v4float %29 %36 Lod %37
+ %27 = OpCompositeExtract %float %28 0
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_b6ba5d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureLoad_b6ba5d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_b6ba5d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.wgsl
new file mode 100644
index 0000000..a22310a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b6ba5d.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_b6ba5d() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = 1i;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b6ba5d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b6ba5d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b6ba5d();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl
new file mode 100644
index 0000000..af3e125
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureLoad(texture: texture_2d<u32>, coords: vec2<u32>, level: i32) -> vec4<u32>
+fn textureLoad_b73f6b() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b73f6b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b73f6b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b73f6b();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b67edf5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_b73f6b() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(uint3(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b73f6b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b73f6b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b73f6b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b67edf5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_b73f6b() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(uint3(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b73f6b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b73f6b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b73f6b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.glsl
new file mode 100644
index 0000000..cf211c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_b73f6b() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_b73f6b();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_b73f6b() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_b73f6b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_b73f6b() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_b73f6b();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.msl
new file mode 100644
index 0000000..a906716
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b73f6b(texture2d<uint, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureLoad_b73f6b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b73f6b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b73f6b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.spvasm
new file mode 100644
index 0000000..f2fe743
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b73f6b "textureLoad_b73f6b"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b73f6b = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_b73f6b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_b73f6b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_b73f6b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.wgsl
new file mode 100644
index 0000000..30acfd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b73f6b.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureLoad_b73f6b() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b73f6b();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b73f6b();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b73f6b();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl
new file mode 100644
index 0000000..c456a66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<f32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<f32>, coords: vec2<i32>, sample_index: u32) -> vec4<f32>
+fn textureLoad_b75d4a() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b75d4a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b75d4a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b75d4a();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..eb82033
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_b75d4a() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b75d4a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b75d4a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b75d4a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..eb82033
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_b75d4a() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_b75d4a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_b75d4a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_b75d4a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.glsl
new file mode 100644
index 0000000..5cd617e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_b75d4a() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_b75d4a();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_b75d4a() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_b75d4a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_b75d4a() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_b75d4a();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.msl
new file mode 100644
index 0000000..455295b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_b75d4a(texture2d_ms<float, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_b75d4a(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_b75d4a(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_b75d4a(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.spvasm
new file mode 100644
index 0000000..fab352d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_b75d4a "textureLoad_b75d4a"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_b75d4a = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Sample %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_b75d4a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_b75d4a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_b75d4a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.wgsl
new file mode 100644
index 0000000..ac0a4a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/b75d4a.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureLoad_b75d4a() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_b75d4a();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_b75d4a();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_b75d4a();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl
new file mode 100644
index 0000000..06c515e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureLoad(texture: texture_3d<f32>, coords: vec3<u32>, level: i32) -> vec4<f32>
+fn textureLoad_bcbb3c() {
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_bcbb3c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_bcbb3c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_bcbb3c();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4f12d01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_bcbb3c() {
+ uint3 arg_1 = (0u).xxx;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(uint4(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_bcbb3c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_bcbb3c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_bcbb3c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4f12d01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_bcbb3c() {
+ uint3 arg_1 = (0u).xxx;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(uint4(arg_1, uint(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_bcbb3c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_bcbb3c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_bcbb3c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.glsl
new file mode 100644
index 0000000..d0bf75e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_bcbb3c() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_bcbb3c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_bcbb3c() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_bcbb3c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_bcbb3c() {
+ uvec3 arg_1 = uvec3(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_bcbb3c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.msl
new file mode 100644
index 0000000..1a13015
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_bcbb3c(texture3d<float, access::sample> tint_symbol_1) {
+ uint3 arg_1 = uint3(0u);
+ int arg_2 = 1;
+ float4 res = tint_symbol_1.read(uint3(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureLoad_bcbb3c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_bcbb3c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_bcbb3c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.spvasm
new file mode 100644
index 0000000..85bba68
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_bcbb3c "textureLoad_bcbb3c"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %18 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_bcbb3c = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3uint %arg_1
+ %29 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Lod %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_bcbb3c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_bcbb3c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_bcbb3c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.wgsl
new file mode 100644
index 0000000..572a57c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/bcbb3c.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureLoad_bcbb3c() {
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_bcbb3c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_bcbb3c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_bcbb3c();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl
new file mode 100644
index 0000000..8f83aff
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: u32, level: i32) -> f32
+fn textureLoad_c16e00() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c16e00();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_c16e00();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c16e00();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4d0f985
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_c16e00() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_c16e00();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_c16e00();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_c16e00();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4d0f985
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_c16e00() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = arg_0.Load(int4(int3(arg_1, int(arg_2)), arg_3)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_c16e00();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_c16e00();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_c16e00();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.glsl
new file mode 100644
index 0000000..31617d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_c16e00() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_c16e00();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_c16e00() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3).x;
+}
+
+void fragment_main() {
+ textureLoad_c16e00();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_c16e00() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, int(arg_2)), arg_3).x;
+}
+
+void compute_main() {
+ textureLoad_c16e00();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.msl
new file mode 100644
index 0000000..bd6dd7b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_c16e00(depth2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_c16e00(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_c16e00(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_c16e00(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.spvasm
new file mode 100644
index 0000000..d564db6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_c16e00 "textureLoad_c16e00"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_c16e00 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2int %arg_1
+ %35 = OpCompositeExtract %int %34 0
+ %36 = OpCompositeExtract %int %34 1
+ %38 = OpLoad %uint %arg_2
+ %37 = OpBitcast %int %38
+ %39 = OpCompositeConstruct %v3int %35 %36 %37
+ %40 = OpLoad %int %arg_3
+ %31 = OpImageFetch %v4float %32 %39 Lod %40
+ %30 = OpCompositeExtract %float %31 0
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_c16e00
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_c16e00
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureLoad_c16e00
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.wgsl
new file mode 100644
index 0000000..766c6ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c16e00.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_c16e00() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c16e00();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_c16e00();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c16e00();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl
new file mode 100644
index 0000000..16f8e3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<u32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<u32>, coords: vec2<i32>, sample_index: u32) -> vec4<u32>
+fn textureLoad_cad5f2() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cad5f2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cad5f2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cad5f2();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b6f32e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_cad5f2() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cad5f2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cad5f2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cad5f2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b6f32e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_cad5f2() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cad5f2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cad5f2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cad5f2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.glsl
new file mode 100644
index 0000000..97b57af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_cad5f2() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_cad5f2();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_cad5f2() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_cad5f2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_cad5f2() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_cad5f2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.msl
new file mode 100644
index 0000000..c06c0c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_cad5f2(texture2d_ms<uint, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<uint, access::read> tint_symbol_2) {
+ textureLoad_cad5f2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<uint, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<uint, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_cad5f2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_cad5f2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.spvasm
new file mode 100644
index 0000000..d95ecf3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_cad5f2 "textureLoad_cad5f2"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_cad5f2 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Sample %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_cad5f2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_cad5f2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_cad5f2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.wgsl
new file mode 100644
index 0000000..5d3a522
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cad5f2.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureLoad_cad5f2() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cad5f2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cad5f2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cad5f2();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl
new file mode 100644
index 0000000..e34e2a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<u32>, array_index: u32, level: i32) -> f32
+fn textureLoad_cb57c2() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cb57c2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cb57c2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cb57c2();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..135cccf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_cb57c2() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cb57c2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cb57c2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cb57c2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..135cccf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_cb57c2() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_cb57c2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_cb57c2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_cb57c2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.glsl
new file mode 100644
index 0000000..4a373bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_cb57c2() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_cb57c2();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_cb57c2() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3).x;
+}
+
+void fragment_main() {
+ textureLoad_cb57c2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_cb57c2() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3).x;
+}
+
+void compute_main() {
+ textureLoad_cb57c2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.msl
new file mode 100644
index 0000000..266af5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_cb57c2(depth2d_array<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_cb57c2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_cb57c2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_cb57c2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.spvasm
new file mode 100644
index 0000000..5475379
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.spvasm
@@ -0,0 +1,99 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_cb57c2 "textureLoad_cb57c2"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %24 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_cb57c2 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %24
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2uint %arg_1
+ %35 = OpCompositeExtract %uint %34 0
+ %36 = OpCompositeExtract %uint %34 1
+ %37 = OpLoad %uint %arg_2
+ %38 = OpCompositeConstruct %v3uint %35 %36 %37
+ %39 = OpLoad %int %arg_3
+ %31 = OpImageFetch %v4float %32 %38 Lod %39
+ %30 = OpCompositeExtract %float %31 0
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_cb57c2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_cb57c2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureLoad_cb57c2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.wgsl
new file mode 100644
index 0000000..6bedb93
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/cb57c2.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_cb57c2() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_cb57c2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_cb57c2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_cb57c2();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl
new file mode 100644
index 0000000..619901a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureLoad(texture: texture_3d<i32>, coords: vec3<i32>, level: u32) -> vec4<i32>
+fn textureLoad_e35f72() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_e35f72();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_e35f72();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_e35f72();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0a1558f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_e35f72() {
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(int4(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_e35f72();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_e35f72();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_e35f72();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0a1558f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_e35f72() {
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(int4(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_e35f72();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_e35f72();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_e35f72();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.glsl
new file mode 100644
index 0000000..b1d0f09
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_e35f72() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_e35f72();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_e35f72() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_e35f72();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_e35f72() {
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_e35f72();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.msl
new file mode 100644
index 0000000..faa6c6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_e35f72(texture3d<int, access::sample> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint arg_2 = 1u;
+ int4 res = tint_symbol_1.read(uint3(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureLoad_e35f72(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture3d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_e35f72(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_e35f72(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.spvasm
new file mode 100644
index 0000000..64cc79d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_e35f72 "textureLoad_e35f72"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v3int = OpTypeVector %int 3
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_e35f72 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v3int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_e35f72
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_e35f72
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_e35f72
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd4853b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e35f72.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureLoad_e35f72() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_e35f72();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_e35f72();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_e35f72();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl
new file mode 100644
index 0000000..843e20c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureLoad(texture: texture_2d<u32>, coords: vec2<i32>, level: u32) -> vec4<u32>
+fn textureLoad_ebfb92() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ebfb92();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ebfb92();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ebfb92();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..6f17474
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_ebfb92() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(int3(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ebfb92();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ebfb92();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ebfb92();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..6f17474
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_ebfb92() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 res = arg_0.Load(int3(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ebfb92();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ebfb92();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ebfb92();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.glsl
new file mode 100644
index 0000000..68072ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_ebfb92() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_ebfb92();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_ebfb92() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_ebfb92();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_ebfb92() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_ebfb92();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.msl
new file mode 100644
index 0000000..4cb0be7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_ebfb92(texture2d<uint, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureLoad_ebfb92(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_ebfb92(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_ebfb92(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.spvasm
new file mode 100644
index 0000000..72acde0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_ebfb92 "textureLoad_ebfb92"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_ebfb92 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_ebfb92
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_ebfb92
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_ebfb92
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.wgsl
new file mode 100644
index 0000000..e3bc181
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ebfb92.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureLoad_ebfb92() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ebfb92();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ebfb92();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ebfb92();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl
new file mode 100644
index 0000000..44ffa5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<f32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<f32>, coords: vec2<u32>, sample_index: i32) -> vec4<f32>
+fn textureLoad_f0abad() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f0abad();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f0abad();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f0abad();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..1ea969f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f0abad() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f0abad();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f0abad();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f0abad();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..1ea969f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f0abad() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f0abad();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f0abad();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f0abad();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.glsl
new file mode 100644
index 0000000..23f1106
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_f0abad() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_f0abad();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_f0abad() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_f0abad();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_f0abad() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_f0abad();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.msl
new file mode 100644
index 0000000..caf35dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_f0abad(texture2d_ms<float, access::read> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_f0abad(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_f0abad(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_f0abad(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.spvasm
new file mode 100644
index 0000000..1c884d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 46
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_f0abad "textureLoad_f0abad"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_f0abad = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2uint %arg_1
+ %29 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Sample %29
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_f0abad
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_f0abad
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_f0abad
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.wgsl
new file mode 100644
index 0000000..a5272f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f0abad.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureLoad_f0abad() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f0abad();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f0abad();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f0abad();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl
new file mode 100644
index 0000000..b610d1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureLoad(texture: texture_2d_array<f32>, coords: vec2<u32>, array_index: u32, level: i32) -> vec4<f32>
+fn textureLoad_f348d9() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f348d9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f348d9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f348d9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..dd04132
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f348d9() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float4 res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f348d9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f348d9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f348d9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..dd04132
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_f348d9() {
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float4 res = arg_0.Load(uint4(uint3(arg_1, arg_2), uint(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f348d9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f348d9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f348d9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.glsl
new file mode 100644
index 0000000..35f6a4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_f348d9() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_f348d9();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_f348d9() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_f348d9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_f348d9() {
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ vec4 res = texelFetch(arg_0_1, ivec3(uvec3(arg_1, arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureLoad_f348d9();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.msl
new file mode 100644
index 0000000..acd3776
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_f348d9(texture2d_array<float, access::sample> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ uint arg_2 = 1u;
+ int arg_3 = 1;
+ float4 res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_f348d9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_f348d9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_f348d9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.spvasm
new file mode 100644
index 0000000..0ad6a0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_f348d9 "textureLoad_f348d9"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %24 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %29 = OpConstantNull %int
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_f348d9 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %24
+ %arg_3 = OpVariable %_ptr_Function_int Function %29
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %int_1
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %36 = OpLoad %uint %arg_2
+ %37 = OpCompositeConstruct %v3uint %34 %35 %36
+ %38 = OpLoad %int %arg_3
+ %30 = OpImageFetch %v4float %31 %37 Lod %38
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_f348d9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_f348d9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureLoad_f348d9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.wgsl
new file mode 100644
index 0000000..f68ba27
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f348d9.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_f348d9() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1i;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f348d9();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f348d9();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f348d9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl
new file mode 100644
index 0000000..340da55
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureLoad(texture: texture_2d<i32>, coords: vec2<i32>, level: u32) -> vec4<i32>
+fn textureLoad_f85291() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f85291();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f85291();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f85291();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..534bddc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_f85291() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(int3(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f85291();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f85291();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f85291();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..534bddc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_f85291() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 res = arg_0.Load(int3(arg_1, int(arg_2)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_f85291();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_f85291();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_f85291();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.glsl
new file mode 100644
index 0000000..b0d8f40
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_f85291() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+vec4 vertex_main() {
+ textureLoad_f85291();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_f85291() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void fragment_main() {
+ textureLoad_f85291();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_f85291() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 res = texelFetch(arg_0_1, arg_1, int(arg_2));
+}
+
+void compute_main() {
+ textureLoad_f85291();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.msl
new file mode 100644
index 0000000..05a688c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_f85291(texture2d<int, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureLoad_f85291(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_f85291(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_f85291(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.spvasm
new file mode 100644
index 0000000..f19cab1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_f85291 "textureLoad_f85291"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %33 = OpConstantNull %v4int
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_f85291 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %res = OpVariable %_ptr_Function_v4int Function %33
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpLoad %uint %arg_2
+ %26 = OpImageFetch %v4int %28 %29 Lod %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_f85291
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_f85291
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_f85291
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.wgsl
new file mode 100644
index 0000000..f06149d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/f85291.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureLoad_f85291() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_f85291();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_f85291();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_f85291();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl
new file mode 100644
index 0000000..84ebebb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d;
+
+// fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<u32>, sample_index: i32) -> f32
+fn textureLoad_fcd23d() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fcd23d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fcd23d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fcd23d();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..9095d2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_fcd23d() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float res = arg_0.Load(uint3(arg_1, uint(0)), arg_2).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fcd23d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fcd23d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fcd23d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..9095d2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_fcd23d() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float res = arg_0.Load(uint3(arg_1, uint(0)), arg_2).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fcd23d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fcd23d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fcd23d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.glsl
new file mode 100644
index 0000000..a9d352b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_fcd23d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, ivec2(arg_1), arg_2).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_fcd23d();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_fcd23d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, ivec2(arg_1), arg_2).x;
+}
+
+void fragment_main() {
+ textureLoad_fcd23d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_fcd23d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, ivec2(arg_1), arg_2).x;
+}
+
+void compute_main() {
+ textureLoad_fcd23d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.msl
new file mode 100644
index 0000000..152e35d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_fcd23d(depth2d_ms<float, access::read> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_2) {
+ textureLoad_fcd23d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_ms<float, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_ms<float, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_fcd23d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_fcd23d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.spvasm
new file mode 100644
index 0000000..903c8a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.spvasm
@@ -0,0 +1,88 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_fcd23d "textureLoad_fcd23d"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_float = OpTypePointer Function %float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_fcd23d = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %27 = OpImageFetch %v4float %28 %29 Sample %30
+ %26 = OpCompositeExtract %float %27 0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_fcd23d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_fcd23d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_fcd23d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.wgsl
new file mode 100644
index 0000000..b784656
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fcd23d.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureLoad_fcd23d() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fcd23d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fcd23d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fcd23d();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl
new file mode 100644
index 0000000..7d350fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<u32>;
+
+// fn textureLoad(texture: texture_multisampled_2d<u32>, coords: vec2<u32>, sample_index: i32) -> vec4<u32>
+fn textureLoad_fe0565() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fe0565();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fe0565();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fe0565();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b03e8a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.dxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_fe0565() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fe0565();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fe0565();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fe0565();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b03e8a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.fxc.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_fe0565() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 res = arg_0.Load(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_fe0565();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_fe0565();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_fe0565();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.glsl
new file mode 100644
index 0000000..ec7a715
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_fe0565() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_fe0565();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_fe0565() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void fragment_main() {
+ textureLoad_fe0565();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_fe0565() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, ivec2(arg_1), arg_2);
+}
+
+void compute_main() {
+ textureLoad_fe0565();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.msl
new file mode 100644
index 0000000..f2e7ed7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_fe0565(texture2d_ms<uint, access::read> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 res = tint_symbol_1.read(uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<uint, access::read> tint_symbol_2) {
+ textureLoad_fe0565(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_ms<uint, access::read> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_ms<uint, access::read> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_fe0565(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_fe0565(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.spvasm
new file mode 100644
index 0000000..a3d2fba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 48
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_fe0565 "textureLoad_fe0565"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 0 1 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %33 = OpConstantNull %v4uint
+ %34 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_fe0565 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2uint %arg_1
+ %30 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4uint %28 %29 Sample %30
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %34
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureLoad_fe0565
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %40
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_fe0565
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_fe0565
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.wgsl
new file mode 100644
index 0000000..704e838
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/fe0565.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureLoad_fe0565() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_fe0565();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_fe0565();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_fe0565();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl
new file mode 100644
index 0000000..2a9ad5e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: i32, level: u32) -> f32
+fn textureLoad_ff1119() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ff1119();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ff1119();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ff1119();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..28a48c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_ff1119() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ff1119();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ff1119();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ff1119();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..28a48c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_ff1119() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = arg_0.Load(int4(int3(arg_1, arg_2), int(arg_3))).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_ff1119();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureLoad_ff1119();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_ff1119();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.glsl
new file mode 100644
index 0000000..f1df6bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_ff1119() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3)).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_ff1119();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_ff1119() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3)).x;
+}
+
+void fragment_main() {
+ textureLoad_ff1119();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_ff1119() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), int(arg_3)).x;
+}
+
+void compute_main() {
+ textureLoad_ff1119();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.msl
new file mode 100644
index 0000000..c7afcd6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_ff1119(depth2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ uint arg_3 = 1u;
+ float res = tint_symbol_1.read(uint2(arg_1), arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureLoad_ff1119(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureLoad_ff1119(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_ff1119(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.spvasm
new file mode 100644
index 0000000..15e9eee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.spvasm
@@ -0,0 +1,99 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureLoad_ff1119 "textureLoad_ff1119"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %29 = OpConstantNull %uint
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_ff1119 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %24
+ %arg_3 = OpVariable %_ptr_Function_uint Function %29
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %uint_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpLoad %v2int %arg_1
+ %35 = OpCompositeExtract %int %34 0
+ %36 = OpCompositeExtract %int %34 1
+ %37 = OpLoad %int %arg_2
+ %38 = OpCompositeConstruct %v3int %35 %36 %37
+ %39 = OpLoad %uint %arg_3
+ %31 = OpImageFetch %v4float %32 %38 Lod %39
+ %30 = OpCompositeExtract %float %31 0
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_ff1119
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_ff1119
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureLoad_ff1119
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.wgsl
new file mode 100644
index 0000000..5804382
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/ff1119.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_ff1119() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1i;
+ var arg_3 = 1u;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_ff1119();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureLoad_ff1119();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureLoad_ff1119();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl
new file mode 100644
index 0000000..afaddb5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: u32) -> f32
+fn textureSampleLevel_2974eb() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1i;
+ var arg_4 = 1u;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_2974eb();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_2974eb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_2974eb();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..22626f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.dxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_2974eb() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_2974eb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..22626f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.fxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_2974eb() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_2974eb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_2974eb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.glsl
new file mode 100644
index 0000000..185c1ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_2974eb() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_2974eb();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLod' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_2974eb() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+void fragment_main() {
+ textureSampleLevel_2974eb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:10: 'textureLod' : no matching overloaded function found
+ERROR: 0:10: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_2974eb() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+void compute_main() {
+ textureSampleLevel_2974eb();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLod' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.msl
new file mode 100644
index 0000000..8c3cf62
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_2974eb(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_2974eb(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_2974eb(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_2974eb(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.spvasm
new file mode 100644
index 0000000..05d6dc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.spvasm
@@ -0,0 +1,110 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_2974eb "textureSampleLevel_2974eb"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %20 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %32 = OpConstantNull %uint
+ %37 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %50 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_2974eb = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %27
+ %arg_4 = OpVariable %_ptr_Function_uint Function %32
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %uint_1
+ %35 = OpLoad %14 %arg_1
+ %36 = OpLoad %11 %arg_0
+ %38 = OpSampledImage %37 %36 %35
+ %40 = OpLoad %v2float %arg_2
+ %41 = OpCompositeExtract %float %40 0
+ %42 = OpCompositeExtract %float %40 1
+ %44 = OpLoad %int %arg_3
+ %43 = OpConvertSToF %float %44
+ %45 = OpCompositeConstruct %v3float %41 %42 %43
+ %47 = OpLoad %uint %arg_4
+ %46 = OpConvertSToF %float %47
+ %34 = OpImageSampleExplicitLod %v4float %38 %45 Lod %46
+ %33 = OpCompositeExtract %float %34 0
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %50
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureSampleLevel_2974eb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %56
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureSampleLevel_2974eb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %textureSampleLevel_2974eb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.wgsl
new file mode 100644
index 0000000..3d501ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/2974eb.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_2974eb() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1i;
+ var arg_4 = 1u;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_2974eb();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_2974eb();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_2974eb();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl
new file mode 100644
index 0000000..c03589d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: u32, @const offset: vec2<i32>) -> f32
+fn textureSampleLevel_36f0d3() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1i;
+ var arg_4 = 1u;
+ const arg_5 = vec2<i32>();
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_36f0d3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_36f0d3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_36f0d3();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..15d3909
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.dxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_36f0d3() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_36f0d3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..15d3909
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.fxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_36f0d3() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_36f0d3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_36f0d3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.glsl
new file mode 100644
index 0000000..8b7fae4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36f0d3() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_36f0d3();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36f0d3() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_36f0d3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:10: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:10: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36f0d3() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_36f0d3();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.msl
new file mode 100644
index 0000000..253a816
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_36f0d3(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_36f0d3(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_36f0d3(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_36f0d3(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.spvasm
new file mode 100644
index 0000000..c672f18
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.spvasm
@@ -0,0 +1,112 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 66
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_36f0d3 "textureSampleLevel_36f0d3"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %20 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %32 = OpConstantNull %uint
+ %37 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %49 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %52 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_36f0d3 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %27
+ %arg_4 = OpVariable %_ptr_Function_uint Function %32
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %uint_1
+ %35 = OpLoad %14 %arg_1
+ %36 = OpLoad %11 %arg_0
+ %38 = OpSampledImage %37 %36 %35
+ %40 = OpLoad %v2float %arg_2
+ %41 = OpCompositeExtract %float %40 0
+ %42 = OpCompositeExtract %float %40 1
+ %44 = OpLoad %int %arg_3
+ %43 = OpConvertSToF %float %44
+ %45 = OpCompositeConstruct %v3float %41 %42 %43
+ %47 = OpLoad %uint %arg_4
+ %46 = OpConvertSToF %float %47
+ %34 = OpImageSampleExplicitLod %v4float %38 %45 Lod|ConstOffset %46 %49
+ %33 = OpCompositeExtract %float %34 0
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %52
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureSampleLevel_36f0d3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %58
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %61 = OpLabel
+ %62 = OpFunctionCall %void %textureSampleLevel_36f0d3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %64 = OpLabel
+ %65 = OpFunctionCall %void %textureSampleLevel_36f0d3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.wgsl
new file mode 100644
index 0000000..5812a97
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36f0d3.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_36f0d3() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1i;
+ var arg_4 = 1u;
+ const arg_5 = vec2<i32>();
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_36f0d3();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_36f0d3();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_36f0d3();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl
new file mode 100644
index 0000000..bca9bb7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: u32, level: i32) -> f32
+fn textureSampleLevel_3c3442() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1u;
+ var arg_4 = 1i;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_3c3442();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_3c3442();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_3c3442();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d26576d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.dxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_3c3442() {
+ float2 arg_2 = (0.0f).xx;
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_3c3442();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d26576d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.fxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_3c3442() {
+ float2 arg_2 = (0.0f).xx;
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_3c3442();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_3c3442();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.glsl
new file mode 100644
index 0000000..17c62e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_3c3442() {
+ vec2 arg_2 = vec2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_3c3442();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLod' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_3c3442() {
+ vec2 arg_2 = vec2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+void fragment_main() {
+ textureSampleLevel_3c3442();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:10: 'textureLod' : no matching overloaded function found
+ERROR: 0:10: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_3c3442() {
+ vec2 arg_2 = vec2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+void compute_main() {
+ textureSampleLevel_3c3442();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLod' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.msl
new file mode 100644
index 0000000..35a4af2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_3c3442(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_3c3442(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_3c3442(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_3c3442(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.spvasm
new file mode 100644
index 0000000..764f969
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.spvasm
@@ -0,0 +1,110 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_3c3442 "textureSampleLevel_3c3442"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %20 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %27 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %32 = OpConstantNull %int
+ %37 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %50 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_3c3442 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_uint Function %27
+ %arg_4 = OpVariable %_ptr_Function_int Function %32
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %uint_1
+ OpStore %arg_4 %int_1
+ %35 = OpLoad %14 %arg_1
+ %36 = OpLoad %11 %arg_0
+ %38 = OpSampledImage %37 %36 %35
+ %40 = OpLoad %v2float %arg_2
+ %41 = OpCompositeExtract %float %40 0
+ %42 = OpCompositeExtract %float %40 1
+ %44 = OpLoad %uint %arg_3
+ %43 = OpConvertUToF %float %44
+ %45 = OpCompositeConstruct %v3float %41 %42 %43
+ %47 = OpLoad %int %arg_4
+ %46 = OpConvertSToF %float %47
+ %34 = OpImageSampleExplicitLod %v4float %38 %45 Lod %46
+ %33 = OpCompositeExtract %float %34 0
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %50
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureSampleLevel_3c3442
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %56
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureSampleLevel_3c3442
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %textureSampleLevel_3c3442
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.wgsl
new file mode 100644
index 0000000..2196df7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/3c3442.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_3c3442() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1u;
+ var arg_4 = 1i;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_3c3442();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_3c3442();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_3c3442();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl
new file mode 100644
index 0000000..6a38486
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32, level: u32) -> f32
+fn textureSampleLevel_a12142() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1i;
+ var arg_4 = 1u;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_a12142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_a12142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_a12142();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..25a17d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.dxc.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_a12142() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_a12142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_a12142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_a12142();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..25a17d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.fxc.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_a12142() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_a12142();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_a12142();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_a12142();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.glsl
new file mode 100644
index 0000000..3d24c0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_a12142() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_a12142();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_a12142() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+void fragment_main() {
+ textureSampleLevel_a12142();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_a12142() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+void compute_main() {
+ textureSampleLevel_a12142();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.msl
new file mode 100644
index 0000000..e8b772e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_a12142(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ uint arg_4 = 1u;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_a12142(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_a12142(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_a12142(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.spvasm
new file mode 100644
index 0000000..ebde5f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.spvasm
@@ -0,0 +1,111 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_a12142 "textureSampleLevel_a12142"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %20 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %27 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %32 = OpConstantNull %uint
+ %37 = OpTypeSampledImage %11
+%_ptr_Function_float = OpTypePointer Function %float
+ %50 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_a12142 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %27
+ %arg_4 = OpVariable %_ptr_Function_uint Function %32
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %uint_1
+ %35 = OpLoad %14 %arg_1
+ %36 = OpLoad %11 %arg_0
+ %38 = OpSampledImage %37 %36 %35
+ %39 = OpLoad %v3float %arg_2
+ %40 = OpCompositeExtract %float %39 0
+ %41 = OpCompositeExtract %float %39 1
+ %42 = OpCompositeExtract %float %39 2
+ %44 = OpLoad %int %arg_3
+ %43 = OpConvertSToF %float %44
+ %45 = OpCompositeConstruct %v4float %40 %41 %42 %43
+ %47 = OpLoad %uint %arg_4
+ %46 = OpConvertSToF %float %47
+ %34 = OpImageSampleExplicitLod %v4float %38 %45 Lod %46
+ %33 = OpCompositeExtract %float %34 0
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %50
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureSampleLevel_a12142
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %56
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureSampleLevel_a12142
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %textureSampleLevel_a12142
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.wgsl
new file mode 100644
index 0000000..4b06240
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/a12142.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_a12142() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1i;
+ var arg_4 = 1u;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_a12142();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_a12142();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_a12142();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl
new file mode 100644
index 0000000..284904f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: u32, level: i32, @const offset: vec2<i32>) -> f32
+fn textureSampleLevel_e6ce9e() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1u;
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_e6ce9e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_e6ce9e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..416f7c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.dxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_e6ce9e() {
+ float2 arg_2 = (0.0f).xx;
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_e6ce9e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..416f7c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.fxc.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_e6ce9e() {
+ float2 arg_2 = (0.0f).xx;
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_e6ce9e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_e6ce9e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.glsl
new file mode 100644
index 0000000..3c58f6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_e6ce9e() {
+ vec2 arg_2 = vec2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_e6ce9e();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_e6ce9e() {
+ vec2 arg_2 = vec2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:10: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:10: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_e6ce9e() {
+ vec2 arg_2 = vec2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLodOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'textureLodOffset' : no matching overloaded function found
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.msl
new file mode 100644
index 0000000..d4cb9c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_e6ce9e(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_e6ce9e(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_e6ce9e(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_e6ce9e(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.spvasm
new file mode 100644
index 0000000..55a16bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.spvasm
@@ -0,0 +1,112 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 66
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_e6ce9e "textureSampleLevel_e6ce9e"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %20 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %27 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %32 = OpConstantNull %int
+ %37 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %49 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %52 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_e6ce9e = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_uint Function %27
+ %arg_4 = OpVariable %_ptr_Function_int Function %32
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %uint_1
+ OpStore %arg_4 %int_1
+ %35 = OpLoad %14 %arg_1
+ %36 = OpLoad %11 %arg_0
+ %38 = OpSampledImage %37 %36 %35
+ %40 = OpLoad %v2float %arg_2
+ %41 = OpCompositeExtract %float %40 0
+ %42 = OpCompositeExtract %float %40 1
+ %44 = OpLoad %uint %arg_3
+ %43 = OpConvertUToF %float %44
+ %45 = OpCompositeConstruct %v3float %41 %42 %43
+ %47 = OpLoad %int %arg_4
+ %46 = OpConvertSToF %float %47
+ %34 = OpImageSampleExplicitLod %v4float %38 %45 Lod|ConstOffset %46 %49
+ %33 = OpCompositeExtract %float %34 0
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %52
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureSampleLevel_e6ce9e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %58
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %61 = OpLabel
+ %62 = OpFunctionCall %void %textureSampleLevel_e6ce9e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %64 = OpLabel
+ %65 = OpFunctionCall %void %textureSampleLevel_e6ce9e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.wgsl
new file mode 100644
index 0000000..c1ddb35
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/e6ce9e.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_e6ce9e() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1u;
+ var arg_4 = 1i;
+ const arg_5 = vec2<i32>();
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_e6ce9e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_e6ce9e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_e6ce9e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl
new file mode 100644
index 0000000..013b132
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: u32, level: i32) -> f32
+fn textureSampleLevel_ff11bc() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1u;
+ var arg_4 = 1i;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_ff11bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_ff11bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_ff11bc();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..fc2da63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_ff11bc() {
+ float3 arg_2 = (0.0f).xxx;
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_ff11bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..fc2da63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_ff11bc() {
+ float3 arg_2 = (0.0f).xxx;
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_ff11bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_ff11bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.glsl
new file mode 100644
index 0000000..e3d2bb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ff11bc() {
+ vec3 arg_2 = vec3(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_ff11bc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ff11bc() {
+ vec3 arg_2 = vec3(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+void fragment_main() {
+ textureSampleLevel_ff11bc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ff11bc() {
+ vec3 arg_2 = vec3(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+void compute_main() {
+ textureSampleLevel_ff11bc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'samplerCubeArrayShadow' : Reserved word.
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.msl
new file mode 100644
index 0000000..a6166a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_ff11bc(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ uint arg_3 = 1u;
+ int arg_4 = 1;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, level(arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_ff11bc(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_ff11bc(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_ff11bc(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.spvasm
new file mode 100644
index 0000000..65b80ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.spvasm
@@ -0,0 +1,111 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 64
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_ff11bc "textureSampleLevel_ff11bc"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %14 = OpTypeSampler
+%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
+ %arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
+ %void = OpTypeVoid
+ %15 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %20 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %27 = OpConstantNull %uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %32 = OpConstantNull %int
+ %37 = OpTypeSampledImage %11
+%_ptr_Function_float = OpTypePointer Function %float
+ %50 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_ff11bc = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_uint Function %27
+ %arg_4 = OpVariable %_ptr_Function_int Function %32
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %uint_1
+ OpStore %arg_4 %int_1
+ %35 = OpLoad %14 %arg_1
+ %36 = OpLoad %11 %arg_0
+ %38 = OpSampledImage %37 %36 %35
+ %39 = OpLoad %v3float %arg_2
+ %40 = OpCompositeExtract %float %39 0
+ %41 = OpCompositeExtract %float %39 1
+ %42 = OpCompositeExtract %float %39 2
+ %44 = OpLoad %uint %arg_3
+ %43 = OpConvertUToF %float %44
+ %45 = OpCompositeConstruct %v4float %40 %41 %42 %43
+ %47 = OpLoad %int %arg_4
+ %46 = OpConvertSToF %float %47
+ %34 = OpImageSampleExplicitLod %v4float %38 %45 Lod %46
+ %33 = OpCompositeExtract %float %34 0
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %50
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureSampleLevel_ff11bc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %56
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureSampleLevel_ff11bc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %62 = OpLabel
+ %63 = OpFunctionCall %void %textureSampleLevel_ff11bc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.wgsl
new file mode 100644
index 0000000..31ed6fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ff11bc.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_ff11bc() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1u;
+ var arg_4 = 1i;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_ff11bc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureSampleLevel_ff11bc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_ff11bc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl
new file mode 100644
index 0000000..8c8d6c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_00ca64() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_00ca64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_00ca64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_00ca64();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..bc0aef6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_00ca64() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_00ca64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_00ca64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_00ca64();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..bc0aef6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_00ca64() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_00ca64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_00ca64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_00ca64();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.glsl
new file mode 100644
index 0000000..2d80cee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_00ca64() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_00ca64();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_00ca64() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_00ca64();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_00ca64() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_00ca64();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.msl
new file mode 100644
index 0000000..eb9a573
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_00ca64(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_00ca64(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_00ca64(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_00ca64(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.spvasm
new file mode 100644
index 0000000..4469ec0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_00ca64 "textureStore_00ca64"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_00ca64 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_00ca64
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_00ca64
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_00ca64
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.wgsl
new file mode 100644
index 0000000..a9d8fc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/00ca64.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureStore_00ca64() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_00ca64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_00ca64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_00ca64();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl
new file mode 100644
index 0000000..8ca7f68
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_0148bd() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0148bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0148bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0148bd();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..05d3e35
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0148bd() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0148bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0148bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0148bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..05d3e35
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0148bd() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0148bd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0148bd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0148bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.glsl
new file mode 100644
index 0000000..c028f23
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0148bd() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_0148bd();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0148bd() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_0148bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0148bd() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_0148bd();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.msl
new file mode 100644
index 0000000..0426dc0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0148bd(texture2d_array<int, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_0148bd(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0148bd(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0148bd(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..2d64adc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_0148bd "textureStore_0148bd"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0148bd = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_0148bd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_0148bd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_0148bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..80f6c27
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0148bd.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureStore_0148bd() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0148bd();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0148bd();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0148bd();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl
new file mode 100644
index 0000000..dcc3c36
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_06e49c() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_06e49c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_06e49c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_06e49c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..632d664
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_06e49c() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_06e49c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_06e49c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_06e49c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..632d664
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_06e49c() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_06e49c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_06e49c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_06e49c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.glsl
new file mode 100644
index 0000000..8e3732f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_06e49c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_06e49c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_06e49c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_06e49c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_06e49c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_06e49c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.msl
new file mode 100644
index 0000000..a2beb54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_06e49c(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_06e49c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_06e49c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_06e49c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.spvasm
new file mode 100644
index 0000000..2db7642
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_06e49c "textureStore_06e49c"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_06e49c = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_06e49c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_06e49c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_06e49c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.wgsl
new file mode 100644
index 0000000..0373258
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/06e49c.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureStore_06e49c() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_06e49c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_06e49c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_06e49c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl
new file mode 100644
index 0000000..90e3619
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_0a1a79() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0a1a79();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0a1a79();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0a1a79();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..62d0c96
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_0a1a79() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0a1a79();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0a1a79();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0a1a79();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..62d0c96
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_0a1a79() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0a1a79();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0a1a79();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0a1a79();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.glsl
new file mode 100644
index 0000000..931033d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_0a1a79() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_0a1a79();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_0a1a79() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_0a1a79();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_0a1a79() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_0a1a79();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.msl
new file mode 100644
index 0000000..8d201f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0a1a79(texture2d_array<uint, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_0a1a79(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0a1a79(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0a1a79(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.spvasm
new file mode 100644
index 0000000..417481a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_0a1a79 "textureStore_0a1a79"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0a1a79 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_0a1a79
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_0a1a79
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_0a1a79
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.wgsl
new file mode 100644
index 0000000..9c8a216
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0a1a79.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureStore_0a1a79() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0a1a79();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0a1a79();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0a1a79();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl
new file mode 100644
index 0000000..1c34d7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_0cc825() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0cc825();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0cc825();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0cc825();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d0d43f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0cc825() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0cc825();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0cc825();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0cc825();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d0d43f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_0cc825() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0cc825();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_0cc825();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0cc825();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.glsl
new file mode 100644
index 0000000..5b99527
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0cc825() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_0cc825();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0cc825() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_0cc825();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_0cc825() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_0cc825();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.msl
new file mode 100644
index 0000000..64aa5a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0cc825(texture2d_array<int, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_0cc825(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0cc825(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0cc825(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.spvasm
new file mode 100644
index 0000000..93080b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_0cc825 "textureStore_0cc825"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0cc825 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_0cc825
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_0cc825
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_0cc825
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.wgsl
new file mode 100644
index 0000000..b5dce9d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0cc825.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureStore_0cc825() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0cc825();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_0cc825();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_0cc825();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl
new file mode 100644
index 0000000..11f4582
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_1f1ef8() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1f1ef8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_1f1ef8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_1f1ef8();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ffa0ed2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_1f1ef8() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_1f1ef8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_1f1ef8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_1f1ef8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ffa0ed2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_1f1ef8() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_1f1ef8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_1f1ef8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_1f1ef8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.glsl
new file mode 100644
index 0000000..81f7833
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1f1ef8() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_1f1ef8();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1f1ef8() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_1f1ef8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1f1ef8() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_1f1ef8();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.msl
new file mode 100644
index 0000000..d7023a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_1f1ef8(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_1f1ef8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_1f1ef8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_1f1ef8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.spvasm
new file mode 100644
index 0000000..2f0bad3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_1f1ef8 "textureStore_1f1ef8"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba16i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_1f1ef8 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_1f1ef8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_1f1ef8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_1f1ef8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.wgsl
new file mode 100644
index 0000000..5a4ba99
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1f1ef8.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureStore_1f1ef8() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1f1ef8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_1f1ef8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_1f1ef8();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl b/test/tint/builtins/gen/var/textureStore/22f045.wgsl
new file mode 100644
index 0000000..6e2e0a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8snorm, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_22f045() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_22f045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_22f045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_22f045();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..9f081c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_22f045() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_22f045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_22f045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_22f045();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..9f081c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_22f045() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_22f045();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_22f045();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_22f045();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.glsl
new file mode 100644
index 0000000..d57b75b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_22f045() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_22f045();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_22f045() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_22f045();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_22f045() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_22f045();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.msl
new file mode 100644
index 0000000..0195bd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_22f045(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_22f045(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_22f045(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_22f045(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.spvasm
new file mode 100644
index 0000000..164d082
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_22f045 "textureStore_22f045"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_22f045 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_22f045
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_22f045
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_22f045
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.wgsl
new file mode 100644
index 0000000..28b7b5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22f045.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureStore_22f045() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_22f045();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_22f045();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_22f045();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl
new file mode 100644
index 0000000..a6845ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_2383fc() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2383fc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_2383fc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_2383fc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ea89155
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_2383fc() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2383fc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_2383fc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2383fc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ea89155
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_2383fc() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2383fc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_2383fc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2383fc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.glsl
new file mode 100644
index 0000000..73f19f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_2383fc() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_2383fc();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_2383fc() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_2383fc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_2383fc() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_2383fc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.msl
new file mode 100644
index 0000000..f343b91
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_2383fc(texture2d_array<uint, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_2383fc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_2383fc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_2383fc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.spvasm
new file mode 100644
index 0000000..b31de19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_2383fc "textureStore_2383fc"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_2383fc = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_2383fc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_2383fc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_2383fc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.wgsl
new file mode 100644
index 0000000..a8fb10c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2383fc.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureStore_2383fc() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2383fc();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_2383fc();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_2383fc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl
new file mode 100644
index 0000000..651efea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8unorm, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_258ab0() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_258ab0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_258ab0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_258ab0();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..81ca1b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_258ab0() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_258ab0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_258ab0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_258ab0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..81ca1b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_258ab0() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_258ab0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_258ab0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_258ab0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.glsl
new file mode 100644
index 0000000..63b7d96
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_258ab0() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_258ab0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_258ab0() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_258ab0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_258ab0() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_258ab0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.msl
new file mode 100644
index 0000000..e471f48
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_258ab0(texture2d_array<float, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_258ab0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_258ab0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_258ab0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.spvasm
new file mode 100644
index 0000000..21ec492
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_258ab0 "textureStore_258ab0"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3uint = OpTypeVector %uint 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_258ab0 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_258ab0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_258ab0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_258ab0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.wgsl
new file mode 100644
index 0000000..17cc765
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/258ab0.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureStore_258ab0() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_258ab0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_258ab0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_258ab0();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl
new file mode 100644
index 0000000..644c834
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_28a7ec() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_28a7ec();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_28a7ec();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_28a7ec();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..adc7c02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_28a7ec() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_28a7ec();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_28a7ec();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_28a7ec();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..adc7c02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_28a7ec() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_28a7ec();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_28a7ec();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_28a7ec();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.glsl
new file mode 100644
index 0000000..f477fb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_28a7ec() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_28a7ec();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_28a7ec() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_28a7ec();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_28a7ec() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_28a7ec();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.msl
new file mode 100644
index 0000000..55511c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_28a7ec(texture2d_array<int, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_28a7ec(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_28a7ec(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_28a7ec(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.spvasm
new file mode 100644
index 0000000..1ce8ddf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_28a7ec "textureStore_28a7ec"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 R32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_28a7ec = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_28a7ec
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_28a7ec
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_28a7ec
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.wgsl
new file mode 100644
index 0000000..ab8d410a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/28a7ec.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureStore_28a7ec() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_28a7ec();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_28a7ec();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_28a7ec();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl
new file mode 100644
index 0000000..392288f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_30b0b0() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_30b0b0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_30b0b0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_30b0b0();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..79d2f71
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_30b0b0() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_30b0b0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_30b0b0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_30b0b0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..79d2f71
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_30b0b0() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_30b0b0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_30b0b0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_30b0b0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.glsl
new file mode 100644
index 0000000..9fd35ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_30b0b0() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_30b0b0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_30b0b0() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_30b0b0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_30b0b0() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_30b0b0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.msl
new file mode 100644
index 0000000..4b580cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_30b0b0(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_30b0b0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_30b0b0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_30b0b0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.spvasm
new file mode 100644
index 0000000..15a126f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_30b0b0 "textureStore_30b0b0"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_30b0b0 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_30b0b0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_30b0b0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_30b0b0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.wgsl
new file mode 100644
index 0000000..9ee34ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/30b0b0.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureStore_30b0b0() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_30b0b0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_30b0b0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_30b0b0();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl
new file mode 100644
index 0000000..b713ef0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_33cec0() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_33cec0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_33cec0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_33cec0();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..df6a6f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_33cec0() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_33cec0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_33cec0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_33cec0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..df6a6f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_33cec0() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_33cec0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_33cec0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_33cec0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.glsl
new file mode 100644
index 0000000..63ee534
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_33cec0() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_33cec0();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_33cec0() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_33cec0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_33cec0() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_33cec0();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.msl
new file mode 100644
index 0000000..34013f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_33cec0(texture2d_array<uint, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_33cec0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_33cec0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_33cec0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.spvasm
new file mode 100644
index 0000000..9419b08
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_33cec0 "textureStore_33cec0"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_33cec0 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_33cec0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_33cec0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_33cec0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.wgsl
new file mode 100644
index 0000000..69b0ffd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/33cec0.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureStore_33cec0() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_33cec0();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_33cec0();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_33cec0();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl
new file mode 100644
index 0000000..4c3130b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_37ffd4() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_37ffd4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_37ffd4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_37ffd4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..96673e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_37ffd4() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_37ffd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_37ffd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_37ffd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..96673e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_37ffd4() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_37ffd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_37ffd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_37ffd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.glsl
new file mode 100644
index 0000000..e8eb1a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_37ffd4() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_37ffd4();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_37ffd4() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_37ffd4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_37ffd4() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_37ffd4();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.msl
new file mode 100644
index 0000000..7e89ceb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_37ffd4(texture2d_array<float, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_37ffd4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_37ffd4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_37ffd4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.spvasm
new file mode 100644
index 0000000..8c2ae06
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_37ffd4 "textureStore_37ffd4"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3uint = OpTypeVector %uint 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_37ffd4 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_37ffd4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_37ffd4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_37ffd4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.wgsl
new file mode 100644
index 0000000..a26203a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/37ffd4.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureStore_37ffd4() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_37ffd4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_37ffd4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_37ffd4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl
new file mode 100644
index 0000000..c5299a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_44daa7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_44daa7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_44daa7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_44daa7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c2793de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_44daa7() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_44daa7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_44daa7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_44daa7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c2793de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_44daa7() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_44daa7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_44daa7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_44daa7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.glsl
new file mode 100644
index 0000000..ea56040
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_44daa7() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_44daa7();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_44daa7() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_44daa7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_44daa7() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_44daa7();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.msl
new file mode 100644
index 0000000..3175b4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_44daa7(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_44daa7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_44daa7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_44daa7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.spvasm
new file mode 100644
index 0000000..88c6042
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_44daa7 "textureStore_44daa7"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_44daa7 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_44daa7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_44daa7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_44daa7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.wgsl
new file mode 100644
index 0000000..73656cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/44daa7.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureStore_44daa7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_44daa7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_44daa7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_44daa7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl
new file mode 100644
index 0000000..e17d98f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_4d359d() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_4d359d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_4d359d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_4d359d();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e10746c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_4d359d() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_4d359d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_4d359d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_4d359d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e10746c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_4d359d() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_4d359d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_4d359d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_4d359d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.glsl
new file mode 100644
index 0000000..f62af08
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_4d359d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_4d359d();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_4d359d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_4d359d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_4d359d() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_4d359d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.msl
new file mode 100644
index 0000000..4ac18bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_4d359d(texture2d_array<uint, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_4d359d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_4d359d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_4d359d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.spvasm
new file mode 100644
index 0000000..76be202
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.spvasm
@@ -0,0 +1,97 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_4d359d "textureStore_4d359d"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_4d359d = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_4d359d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_4d359d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_4d359d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.wgsl
new file mode 100644
index 0000000..19c62dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4d359d.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureStore_4d359d() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_4d359d();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_4d359d();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_4d359d();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl
new file mode 100644
index 0000000..bd75214
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8snorm, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_59a0ab() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_59a0ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_59a0ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_59a0ab();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..717254e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_59a0ab() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_59a0ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_59a0ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_59a0ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..717254e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_59a0ab() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_59a0ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_59a0ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_59a0ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.glsl
new file mode 100644
index 0000000..3cdcbf3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_59a0ab() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_59a0ab();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_59a0ab() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_59a0ab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_59a0ab() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_59a0ab();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.msl
new file mode 100644
index 0000000..a22db66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_59a0ab(texture2d_array<float, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_59a0ab(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_59a0ab(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_59a0ab(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.spvasm
new file mode 100644
index 0000000..3427873
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_59a0ab "textureStore_59a0ab"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8Snorm
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3uint = OpTypeVector %uint 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_59a0ab = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_59a0ab
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_59a0ab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_59a0ab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.wgsl
new file mode 100644
index 0000000..a481390
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/59a0ab.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureStore_59a0ab() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_59a0ab();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_59a0ab();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_59a0ab();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl
new file mode 100644
index 0000000..6638789
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_5ddc61() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_5ddc61();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_5ddc61();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_5ddc61();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..6126253
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_5ddc61() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_5ddc61();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_5ddc61();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_5ddc61();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..6126253
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_5ddc61() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_5ddc61();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_5ddc61();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_5ddc61();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.glsl
new file mode 100644
index 0000000..49630cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_5ddc61() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_5ddc61();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_5ddc61() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_5ddc61();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_5ddc61() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_5ddc61();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.msl
new file mode 100644
index 0000000..d02d76e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_5ddc61(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_5ddc61(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_5ddc61(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_5ddc61(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.spvasm
new file mode 100644
index 0000000..962f216
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_5ddc61 "textureStore_5ddc61"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_5ddc61 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_5ddc61
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_5ddc61
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_5ddc61
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc049db
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5ddc61.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureStore_5ddc61() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_5ddc61();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_5ddc61();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_5ddc61();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl b/test/tint/builtins/gen/var/textureStore/658a74.wgsl
new file mode 100644
index 0000000..eb287ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_658a74() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_658a74();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_658a74();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_658a74();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e611206
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_658a74() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_658a74();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_658a74();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_658a74();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e611206
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_658a74() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_658a74();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_658a74();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_658a74();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.glsl
new file mode 100644
index 0000000..e18d900
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_658a74() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_658a74();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_658a74() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_658a74();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_658a74() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_658a74();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.msl
new file mode 100644
index 0000000..d121d3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_658a74(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_658a74(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_658a74(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_658a74(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.spvasm
new file mode 100644
index 0000000..52fc52c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_658a74 "textureStore_658a74"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_658a74 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_658a74
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_658a74
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_658a74
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.wgsl
new file mode 100644
index 0000000..c29799b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/658a74.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureStore_658a74() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_658a74();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_658a74();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_658a74();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl
new file mode 100644
index 0000000..23a8676
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba32uint, write>, coords: vec2<u32>, array_index: i32, value: vec4<u32>)
+fn textureStore_6f8642() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6f8642();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_6f8642();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_6f8642();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..68d1cee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_6f8642() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6f8642();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_6f8642();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6f8642();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..68d1cee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_6f8642() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6f8642();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_6f8642();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6f8642();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.glsl
new file mode 100644
index 0000000..c44aae7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6f8642() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_6f8642();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6f8642() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_6f8642();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6f8642() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_6f8642();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.msl
new file mode 100644
index 0000000..5b98209
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_6f8642(texture2d_array<uint, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_6f8642(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_6f8642(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_6f8642(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.spvasm
new file mode 100644
index 0000000..cd9d76a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_6f8642 "textureStore_6f8642"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_6f8642 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_6f8642
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_6f8642
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_6f8642
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.wgsl
new file mode 100644
index 0000000..36630e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6f8642.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureStore_6f8642() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6f8642();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_6f8642();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_6f8642();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl
new file mode 100644
index 0000000..08b9a1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_72fa64() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_72fa64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_72fa64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_72fa64();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..8de0613
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_72fa64() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_72fa64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_72fa64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_72fa64();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..8de0613
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_72fa64() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_72fa64();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_72fa64();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_72fa64();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.glsl
new file mode 100644
index 0000000..6ca1d78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_72fa64() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_72fa64();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_72fa64() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_72fa64();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_72fa64() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_72fa64();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.msl
new file mode 100644
index 0000000..501db77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_72fa64(texture2d_array<int, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_72fa64(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_72fa64(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_72fa64(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.spvasm
new file mode 100644
index 0000000..2f14a12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.spvasm
@@ -0,0 +1,97 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_72fa64 "textureStore_72fa64"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_72fa64 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_72fa64
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_72fa64
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_72fa64
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.wgsl
new file mode 100644
index 0000000..0e90aab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/72fa64.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureStore_72fa64() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_72fa64();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_72fa64();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_72fa64();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl
new file mode 100644
index 0000000..c9fe455
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_7bb211() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7bb211();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_7bb211();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_7bb211();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0074f0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_7bb211() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_7bb211();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_7bb211();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_7bb211();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0074f0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_7bb211() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_7bb211();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_7bb211();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_7bb211();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.glsl
new file mode 100644
index 0000000..11b482d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7bb211() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_7bb211();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7bb211() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_7bb211();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7bb211() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_7bb211();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.msl
new file mode 100644
index 0000000..6d2729b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_7bb211(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_7bb211(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_7bb211(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_7bb211(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.spvasm
new file mode 100644
index 0000000..cb6aa19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.spvasm
@@ -0,0 +1,97 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_7bb211 "textureStore_7bb211"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rg32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_7bb211 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_7bb211
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_7bb211
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_7bb211
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.wgsl
new file mode 100644
index 0000000..990b9c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7bb211.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureStore_7bb211() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7bb211();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_7bb211();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_7bb211();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl
new file mode 100644
index 0000000..9c6fc3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_8ff674() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8ff674();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_8ff674();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_8ff674();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4265f0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_8ff674() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_8ff674();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_8ff674();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_8ff674();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4265f0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_8ff674() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_8ff674();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_8ff674();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_8ff674();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.glsl
new file mode 100644
index 0000000..cf082e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8ff674() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_8ff674();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8ff674() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_8ff674();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8ff674() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_8ff674();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.msl
new file mode 100644
index 0000000..051723b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_8ff674(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_8ff674(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_8ff674(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_8ff674(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.spvasm
new file mode 100644
index 0000000..768cb93
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_8ff674 "textureStore_8ff674"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 R32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_8ff674 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_8ff674
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_8ff674
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_8ff674
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc5d1f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8ff674.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureStore_8ff674() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8ff674();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_8ff674();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_8ff674();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl
new file mode 100644
index 0000000..bbd789c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32sint, write>, coords: vec2<i32>, array_index: u32, value: vec4<i32>)
+fn textureStore_9938b7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9938b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9938b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9938b7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..80692a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_9938b7() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9938b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9938b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9938b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..80692a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_9938b7() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9938b7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9938b7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9938b7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.glsl
new file mode 100644
index 0000000..3a267d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_9938b7() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_9938b7();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_9938b7() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_9938b7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_9938b7() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_9938b7();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.msl
new file mode 100644
index 0000000..2a67476
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9938b7(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_9938b7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9938b7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9938b7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.spvasm
new file mode 100644
index 0000000..3874961
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_9938b7 "textureStore_9938b7"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 R32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9938b7 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_9938b7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_9938b7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_9938b7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.wgsl
new file mode 100644
index 0000000..b2c3376
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9938b7.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureStore_9938b7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9938b7();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9938b7();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9938b7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl
new file mode 100644
index 0000000..fd44463
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8unorm, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_9d8668() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9d8668();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9d8668();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9d8668();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0ad43ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_9d8668() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9d8668();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9d8668();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9d8668();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0ad43ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_9d8668() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9d8668();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9d8668();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9d8668();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.glsl
new file mode 100644
index 0000000..5600dbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d8668() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_9d8668();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d8668() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_9d8668();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d8668() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_9d8668();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.msl
new file mode 100644
index 0000000..e0efa79
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9d8668(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_9d8668(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9d8668(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9d8668(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.spvasm
new file mode 100644
index 0000000..8c3095c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_9d8668 "textureStore_9d8668"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9d8668 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_9d8668
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_9d8668
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_9d8668
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.wgsl
new file mode 100644
index 0000000..b04ebc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d8668.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureStore_9d8668() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9d8668();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9d8668();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9d8668();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl
new file mode 100644
index 0000000..dc02938
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_9f7cea() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9f7cea();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9f7cea();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9f7cea();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..9decbcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_9f7cea() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9f7cea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9f7cea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9f7cea();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..9decbcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_9f7cea() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9f7cea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_9f7cea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9f7cea();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.glsl
new file mode 100644
index 0000000..a561d87
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_9f7cea() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_9f7cea();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_9f7cea() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_9f7cea();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_9f7cea() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_9f7cea();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.msl
new file mode 100644
index 0000000..c6000bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9f7cea(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_9f7cea(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9f7cea(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9f7cea(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.spvasm
new file mode 100644
index 0000000..71767cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_9f7cea "textureStore_9f7cea"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba8ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9f7cea = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_9f7cea
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_9f7cea
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_9f7cea
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.wgsl
new file mode 100644
index 0000000..6b55981
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9f7cea.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureStore_9f7cea() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9f7cea();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_9f7cea();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_9f7cea();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl
new file mode 100644
index 0000000..45715a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_a6a986() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_a6a986();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_a6a986();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_a6a986();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..87243b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_a6a986() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_a6a986();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_a6a986();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_a6a986();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..87243b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_a6a986() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_a6a986();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_a6a986();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_a6a986();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.glsl
new file mode 100644
index 0000000..63d69b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_a6a986() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_a6a986();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_a6a986() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_a6a986();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_a6a986() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_a6a986();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.msl
new file mode 100644
index 0000000..b331c2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_a6a986(texture2d_array<float, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_a6a986(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_a6a986(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_a6a986(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.spvasm
new file mode 100644
index 0000000..e1eee7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_a6a986 "textureStore_a6a986"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rgba16f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3uint = OpTypeVector %uint 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_a6a986 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_a6a986
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_a6a986
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_a6a986
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.wgsl
new file mode 100644
index 0000000..5ca9a01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/a6a986.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureStore_a6a986() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_a6a986();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_a6a986();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_a6a986();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl b/test/tint/builtins/gen/var/textureStore/c32905.wgsl
new file mode 100644
index 0000000..759c4b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba8sint, write>, coords: vec2<u32>, array_index: i32, value: vec4<i32>)
+fn textureStore_c32905() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c32905();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_c32905();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_c32905();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..4d99be6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_c32905() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_c32905();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_c32905();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_c32905();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..4d99be6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_c32905() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_c32905();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_c32905();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_c32905();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.glsl
new file mode 100644
index 0000000..4a695bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_c32905() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_c32905();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_c32905() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_c32905();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_c32905() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_c32905();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.msl
new file mode 100644
index 0000000..52e8a02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_c32905(texture2d_array<int, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ int4 arg_3 = int4(0);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureStore_c32905(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<int, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_c32905(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_c32905(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.spvasm
new file mode 100644
index 0000000..48e2220
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_c32905 "textureStore_c32905"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %int = OpTypeInt 32 1
+ %11 = OpTypeImage %int 2D 0 1 0 2 Rgba8i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %19 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %27 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3uint = OpTypeVector %uint 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_c32905 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4int Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2uint %arg_1
+ %34 = OpCompositeExtract %uint %33 0
+ %35 = OpCompositeExtract %uint %33 1
+ %37 = OpLoad %int %arg_2
+ %36 = OpBitcast %uint %37
+ %38 = OpCompositeConstruct %v3uint %34 %35 %36
+ %39 = OpLoad %v4int %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_c32905
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_c32905
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_c32905
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.wgsl
new file mode 100644
index 0000000..73f1d99
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c32905.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureStore_c32905() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c32905();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_c32905();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_c32905();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl
new file mode 100644
index 0000000..82ce654
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_d55e65() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_d55e65();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_d55e65();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_d55e65();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..7933088
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_d55e65() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_d55e65();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_d55e65();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_d55e65();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..7933088
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_d55e65() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_d55e65();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_d55e65();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_d55e65();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.glsl
new file mode 100644
index 0000000..87199ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_d55e65() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_d55e65();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_d55e65() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_d55e65();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_d55e65() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_d55e65();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.msl
new file mode 100644
index 0000000..11b7b3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_d55e65(texture2d_array<float, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_d55e65(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_d55e65(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_d55e65(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.spvasm
new file mode 100644
index 0000000..e36f65d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_d55e65 "textureStore_d55e65"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3uint = OpTypeVector %uint 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_d55e65 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_d55e65
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_d55e65
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_d55e65
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.wgsl
new file mode 100644
index 0000000..939d999
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d55e65.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureStore_d55e65() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_d55e65();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_d55e65();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_d55e65();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl
new file mode 100644
index 0000000..7d52fc2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<r32float, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
+fn textureStore_df2ca4() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_df2ca4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_df2ca4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_df2ca4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..46b5844
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_df2ca4() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_df2ca4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_df2ca4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_df2ca4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..46b5844
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_df2ca4() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_df2ca4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_df2ca4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_df2ca4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.glsl
new file mode 100644
index 0000000..e7547d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_df2ca4() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_df2ca4();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_df2ca4() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_df2ca4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_df2ca4() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_df2ca4();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.msl
new file mode 100644
index 0000000..d3eea8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_df2ca4(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_df2ca4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_df2ca4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_df2ca4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.spvasm
new file mode 100644
index 0000000..90f4c06
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_df2ca4 "textureStore_df2ca4"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 R32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %18 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_df2ca4 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %35 = OpLoad %uint %arg_2
+ %34 = OpBitcast %int %35
+ %36 = OpCompositeConstruct %v3int %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_df2ca4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_df2ca4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_df2ca4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.wgsl
new file mode 100644
index 0000000..60250cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/df2ca4.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureStore_df2ca4() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_df2ca4();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_df2ca4();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_df2ca4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl
new file mode 100644
index 0000000..f8595d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32float, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
+fn textureStore_dfa9a1() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dfa9a1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dfa9a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dfa9a1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0342085
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_dfa9a1() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dfa9a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dfa9a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dfa9a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0342085
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_dfa9a1() {
+ uint2 arg_1 = (0u).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[uint3(arg_1, uint(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dfa9a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dfa9a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dfa9a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.glsl
new file mode 100644
index 0000000..b348fde
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_dfa9a1() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_dfa9a1();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_dfa9a1() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void fragment_main() {
+ textureStore_dfa9a1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_dfa9a1() {
+ uvec2 arg_1 = uvec2(0u);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(uvec3(arg_1, uint(arg_2))), arg_3);
+}
+
+void compute_main() {
+ textureStore_dfa9a1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.msl
new file mode 100644
index 0000000..48961ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_dfa9a1(texture2d_array<float, access::write> tint_symbol_1) {
+ uint2 arg_1 = uint2(0u);
+ int arg_2 = 1;
+ float4 arg_3 = float4(0.0f);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureStore_dfa9a1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_dfa9a1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_dfa9a1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..1bf8a16
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_dfa9a1 "textureStore_dfa9a1"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %11 = OpTypeImage %float 2D 0 1 0 2 Rg32f
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %12 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3uint = OpTypeVector %uint 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_dfa9a1 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2uint %arg_1
+ %32 = OpCompositeExtract %uint %31 0
+ %33 = OpCompositeExtract %uint %31 1
+ %35 = OpLoad %int %arg_2
+ %34 = OpBitcast %uint %35
+ %36 = OpCompositeConstruct %v3uint %32 %33 %34
+ %37 = OpLoad %v4float %arg_3
+ OpImageWrite %29 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_dfa9a1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_dfa9a1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_dfa9a1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..f811438
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dfa9a1.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureStore_dfa9a1() {
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1i;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dfa9a1();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dfa9a1();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dfa9a1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl
new file mode 100644
index 0000000..760a063
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rg32uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_dffb13() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dffb13();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dffb13();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dffb13();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..532d05c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_dffb13() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dffb13();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dffb13();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dffb13();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..532d05c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_dffb13() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dffb13();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_dffb13();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dffb13();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.glsl
new file mode 100644
index 0000000..f626157
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dffb13() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_dffb13();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dffb13() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_dffb13();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image load-store format' : not supported with this profile: es
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dffb13() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_dffb13();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:3: 'image load-store format' : not supported with this profile: es
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.msl
new file mode 100644
index 0000000..7218365
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_dffb13(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_dffb13(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_dffb13(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_dffb13(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.spvasm
new file mode 100644
index 0000000..35fc43a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.spvasm
@@ -0,0 +1,97 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_dffb13 "textureStore_dffb13"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rg32ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_dffb13 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_dffb13
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_dffb13
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_dffb13
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.wgsl
new file mode 100644
index 0000000..e3ba416
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dffb13.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureStore_dffb13() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dffb13();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_dffb13();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_dffb13();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl
new file mode 100644
index 0000000..9126e10
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_2d_array<rgba16uint, write>, coords: vec2<i32>, array_index: u32, value: vec4<u32>)
+fn textureStore_fd350c() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fd350c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_fd350c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_fd350c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..d932e87
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_fd350c() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_fd350c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_fd350c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_fd350c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..d932e87
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_fd350c() {
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, int(arg_2))] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_fd350c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureStore_fd350c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_fd350c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.glsl
new file mode 100644
index 0000000..6b1fe61
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_fd350c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_fd350c();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_fd350c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void fragment_main() {
+ textureStore_fd350c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_fd350c() {
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, int(arg_2)), arg_3);
+}
+
+void compute_main() {
+ textureStore_fd350c();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.msl
new file mode 100644
index 0000000..a35e4c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_fd350c(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint4 arg_3 = uint4(0u);
+ tint_symbol_1.write(arg_3, uint2(arg_1), arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureStore_fd350c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d_array<uint, access::write> tint_symbol_3 [[texture(0)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_3);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d_array<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_fd350c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_fd350c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.spvasm
new file mode 100644
index 0000000..1dcd751
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 54
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %arg_0 "arg_0"
+ OpName %textureStore_fd350c "textureStore_fd350c"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ OpDecorate %arg_0 NonReadable
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %uint = OpTypeInt 32 0
+ %11 = OpTypeImage %uint 2D 0 1 0 2 Rgba16ui
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %25 = OpConstantNull %uint
+ %v4uint = OpTypeVector %uint 4
+ %27 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %v3int = OpTypeVector %int 3
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_fd350c = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_uint Function %25
+ %arg_3 = OpVariable %_ptr_Function_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %27
+ %31 = OpLoad %11 %arg_0
+ %33 = OpLoad %v2int %arg_1
+ %34 = OpCompositeExtract %int %33 0
+ %35 = OpCompositeExtract %int %33 1
+ %37 = OpLoad %uint %arg_2
+ %36 = OpBitcast %int %37
+ %38 = OpCompositeConstruct %v3int %34 %35 %36
+ %39 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %38 %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_fd350c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureStore_fd350c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureStore_fd350c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.wgsl
new file mode 100644
index 0000000..6e3a293
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fd350c.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureStore_fd350c() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fd350c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ textureStore_fd350c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ textureStore_fd350c();
+}