tint: Add builtin tests for arguments passed by var
Change-Id: I81b69d23e40675d7f525e6369afec9aa0659d043
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92321
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl b/test/tint/builtins/gen/var/abs/002533.wgsl
new file mode 100644
index 0000000..edf0d3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/002533.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<4, f32>) -> vec<4, f32>
+fn abs_002533() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_002533();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_002533();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_002533();
+}
diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl
new file mode 100644
index 0000000..cf37977
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_002533() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_002533();
+ 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;
+
+void abs_002533() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_002533();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_002533() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_002533();
+}
+
+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/abs/002533.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.hlsl
new file mode 100644
index 0000000..42104cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_002533() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_002533();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_002533();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_002533();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl
new file mode 100644
index 0000000..ffe76fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_002533() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = fabs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_002533();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_002533();
+ return;
+}
+
+kernel void compute_main() {
+ abs_002533();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm
new file mode 100644
index 0000000..e420cb9
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_002533 "abs_002533"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_002533 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 FAbs %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %abs_002533
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %abs_002533
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %abs_002533
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl
new file mode 100644
index 0000000..d62346e
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/002533.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_002533() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_002533();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_002533();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_002533();
+}
diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl b/test/tint/builtins/gen/var/abs/005174.wgsl
new file mode 100644
index 0000000..88d62cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/005174.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<3, f32>) -> vec<3, f32>
+fn abs_005174() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_005174();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_005174();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_005174();
+}
diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl
new file mode 100644
index 0000000..bc996cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_005174() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_005174();
+ 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;
+
+void abs_005174() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_005174();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_005174() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_005174();
+}
+
+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/abs/005174.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.hlsl
new file mode 100644
index 0000000..679d38c
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_005174() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_005174();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_005174();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_005174();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl
new file mode 100644
index 0000000..db44af8
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_005174() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = fabs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_005174();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_005174();
+ return;
+}
+
+kernel void compute_main() {
+ abs_005174();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm
new file mode 100644
index 0000000..8e0efab
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_005174 "abs_005174"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_005174 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 FAbs %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %abs_005174
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %abs_005174
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %abs_005174
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl
new file mode 100644
index 0000000..43910f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/005174.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_005174() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_005174();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_005174();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_005174();
+}
diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl
new file mode 100644
index 0000000..d1a59e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<4, u32>) -> vec<4, u32>
+fn abs_1ce782() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_1ce782();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_1ce782();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_1ce782();
+}
diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl
new file mode 100644
index 0000000..05ce517
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_1ce782() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = arg_0;
+}
+
+vec4 vertex_main() {
+ abs_1ce782();
+ 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;
+
+void abs_1ce782() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = arg_0;
+}
+
+void fragment_main() {
+ abs_1ce782();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_1ce782() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = arg_0;
+}
+
+void compute_main() {
+ abs_1ce782();
+}
+
+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/abs/1ce782.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.hlsl
new file mode 100644
index 0000000..3ddb403
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_1ce782() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_1ce782();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_1ce782();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_1ce782();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl
new file mode 100644
index 0000000..22dc5ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_1ce782() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_1ce782();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_1ce782();
+ return;
+}
+
+kernel void compute_main() {
+ abs_1ce782();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm
new file mode 100644
index 0000000..3128b60
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %abs_1ce782 "abs_1ce782"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_1ce782 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4uint %arg_0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %abs_1ce782
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %abs_1ce782
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %abs_1ce782
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl
new file mode 100644
index 0000000..74c2441
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1ce782.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_1ce782() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_1ce782();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_1ce782();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_1ce782();
+}
diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl
new file mode 100644
index 0000000..b8c68d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<2, f32>) -> vec<2, f32>
+fn abs_1e9d53() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_1e9d53();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_1e9d53();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_1e9d53();
+}
diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl
new file mode 100644
index 0000000..907f07b
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_1e9d53() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_1e9d53();
+ 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;
+
+void abs_1e9d53() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_1e9d53();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_1e9d53() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_1e9d53();
+}
+
+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/abs/1e9d53.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.hlsl
new file mode 100644
index 0000000..aff322d
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_1e9d53() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_1e9d53();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_1e9d53();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_1e9d53();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl
new file mode 100644
index 0000000..87cd8bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_1e9d53() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = fabs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_1e9d53();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_1e9d53();
+ return;
+}
+
+kernel void compute_main() {
+ abs_1e9d53();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm
new file mode 100644
index 0000000..9f60fa4
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_1e9d53 "abs_1e9d53"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_1e9d53 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 FAbs %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %abs_1e9d53
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %abs_1e9d53
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %abs_1e9d53
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl
new file mode 100644
index 0000000..c2ff64d
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/1e9d53.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_1e9d53() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_1e9d53();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_1e9d53();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_1e9d53();
+}
diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl
new file mode 100644
index 0000000..cbc465a
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(u32) -> u32
+fn abs_467cd1() {
+ var arg_0 = 1u;
+ var res: u32 = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_467cd1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_467cd1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_467cd1();
+}
diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl
new file mode 100644
index 0000000..14629ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_467cd1() {
+ uint arg_0 = 1u;
+ uint res = arg_0;
+}
+
+vec4 vertex_main() {
+ abs_467cd1();
+ 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;
+
+void abs_467cd1() {
+ uint arg_0 = 1u;
+ uint res = arg_0;
+}
+
+void fragment_main() {
+ abs_467cd1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_467cd1() {
+ uint arg_0 = 1u;
+ uint res = arg_0;
+}
+
+void compute_main() {
+ abs_467cd1();
+}
+
+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/abs/467cd1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.hlsl
new file mode 100644
index 0000000..1843aff
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_467cd1() {
+ uint arg_0 = 1u;
+ uint res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_467cd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_467cd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_467cd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl
new file mode 100644
index 0000000..2185834
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_467cd1() {
+ uint arg_0 = 1u;
+ uint res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_467cd1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_467cd1();
+ return;
+}
+
+kernel void compute_main() {
+ abs_467cd1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm
new file mode 100644
index 0000000..0c22f42
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %abs_467cd1 "abs_467cd1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_467cd1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ %19 = OpLoad %uint %arg_0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %abs_467cd1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %abs_467cd1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %abs_467cd1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl
new file mode 100644
index 0000000..47ad192
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/467cd1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_467cd1() {
+ var arg_0 = 1u;
+ var res : u32 = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_467cd1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_467cd1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_467cd1();
+}
diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl
new file mode 100644
index 0000000..46aeeef
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(i32) -> i32
+fn abs_4ad288() {
+ var arg_0 = 1;
+ var res: i32 = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_4ad288();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_4ad288();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_4ad288();
+}
diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl
new file mode 100644
index 0000000..cf24591
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_4ad288() {
+ int arg_0 = 1;
+ int res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_4ad288();
+ 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;
+
+void abs_4ad288() {
+ int arg_0 = 1;
+ int res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_4ad288();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_4ad288() {
+ int arg_0 = 1;
+ int res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_4ad288();
+}
+
+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/abs/4ad288.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.hlsl
new file mode 100644
index 0000000..4b75546
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_4ad288() {
+ int arg_0 = 1;
+ int res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_4ad288();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_4ad288();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_4ad288();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl
new file mode 100644
index 0000000..a721e91
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_4ad288() {
+ int arg_0 = 1;
+ int res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_4ad288();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_4ad288();
+ return;
+}
+
+kernel void compute_main() {
+ abs_4ad288();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm
new file mode 100644
index 0000000..2de82a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_4ad288 "abs_4ad288"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_4ad288 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ %20 = OpLoad %int %arg_0
+ %18 = OpExtInst %int %19 SAbs %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %abs_4ad288
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %abs_4ad288
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %abs_4ad288
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl
new file mode 100644
index 0000000..261ea6d
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/4ad288.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_4ad288() {
+ var arg_0 = 1;
+ var res : i32 = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_4ad288();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_4ad288();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_4ad288();
+}
diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl
new file mode 100644
index 0000000..0d0385e
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<3, i32>) -> vec<3, i32>
+fn abs_5ad50a() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_5ad50a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_5ad50a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_5ad50a();
+}
diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl
new file mode 100644
index 0000000..c3ccd6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_5ad50a() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_5ad50a();
+ 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;
+
+void abs_5ad50a() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_5ad50a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_5ad50a() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_5ad50a();
+}
+
+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/abs/5ad50a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.hlsl
new file mode 100644
index 0000000..3e97613
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_5ad50a() {
+ int3 arg_0 = (0).xxx;
+ int3 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_5ad50a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_5ad50a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_5ad50a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl
new file mode 100644
index 0000000..98f9bbd
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_5ad50a() {
+ int3 arg_0 = int3(0);
+ int3 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_5ad50a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_5ad50a();
+ return;
+}
+
+kernel void compute_main() {
+ abs_5ad50a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm
new file mode 100644
index 0000000..7cb5399
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_5ad50a "abs_5ad50a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_5ad50a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ %20 = OpLoad %v3int %arg_0
+ %18 = OpExtInst %v3int %19 SAbs %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %abs_5ad50a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %abs_5ad50a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %abs_5ad50a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl
new file mode 100644
index 0000000..c26a8c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/5ad50a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_5ad50a() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_5ad50a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_5ad50a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_5ad50a();
+}
diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl b/test/tint/builtins/gen/var/abs/7326de.wgsl
new file mode 100644
index 0000000..3bbe715
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7326de.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<3, u32>) -> vec<3, u32>
+fn abs_7326de() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_7326de();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_7326de();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_7326de();
+}
diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl
new file mode 100644
index 0000000..ffb4efb
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_7326de() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = arg_0;
+}
+
+vec4 vertex_main() {
+ abs_7326de();
+ 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;
+
+void abs_7326de() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = arg_0;
+}
+
+void fragment_main() {
+ abs_7326de();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_7326de() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = arg_0;
+}
+
+void compute_main() {
+ abs_7326de();
+}
+
+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/abs/7326de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.hlsl
new file mode 100644
index 0000000..4932150
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_7326de() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_7326de();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_7326de();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_7326de();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl
new file mode 100644
index 0000000..216fa21
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_7326de() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_7326de();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_7326de();
+ return;
+}
+
+kernel void compute_main() {
+ abs_7326de();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm
new file mode 100644
index 0000000..5944ba3
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %abs_7326de "abs_7326de"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_7326de = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3uint %arg_0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %abs_7326de
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %abs_7326de
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %abs_7326de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl
new file mode 100644
index 0000000..312eaa1
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7326de.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_7326de() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_7326de();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_7326de();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_7326de();
+}
diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl
new file mode 100644
index 0000000..1768ce9
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<2, u32>) -> vec<2, u32>
+fn abs_7f28e6() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_7f28e6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_7f28e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_7f28e6();
+}
diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl
new file mode 100644
index 0000000..731a483
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_7f28e6() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = arg_0;
+}
+
+vec4 vertex_main() {
+ abs_7f28e6();
+ 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;
+
+void abs_7f28e6() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = arg_0;
+}
+
+void fragment_main() {
+ abs_7f28e6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_7f28e6() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = arg_0;
+}
+
+void compute_main() {
+ abs_7f28e6();
+}
+
+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/abs/7f28e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.hlsl
new file mode 100644
index 0000000..cc4964e
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_7f28e6() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_7f28e6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_7f28e6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_7f28e6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl
new file mode 100644
index 0000000..a3ea253
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_7f28e6() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_7f28e6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_7f28e6();
+ return;
+}
+
+kernel void compute_main() {
+ abs_7f28e6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm
new file mode 100644
index 0000000..fe29c46
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %abs_7f28e6 "abs_7f28e6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_7f28e6 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2uint %arg_0
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %abs_7f28e6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %abs_7f28e6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %abs_7f28e6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl
new file mode 100644
index 0000000..3d20295
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7f28e6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_7f28e6() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_7f28e6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_7f28e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_7f28e6();
+}
diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl
new file mode 100644
index 0000000..49c451c
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<2, i32>) -> vec<2, i32>
+fn abs_7faa9e() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_7faa9e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_7faa9e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_7faa9e();
+}
diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl
new file mode 100644
index 0000000..11023ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_7faa9e() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_7faa9e();
+ 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;
+
+void abs_7faa9e() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_7faa9e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_7faa9e() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_7faa9e();
+}
+
+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/abs/7faa9e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.hlsl
new file mode 100644
index 0000000..6a8e403
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_7faa9e() {
+ int2 arg_0 = (0).xx;
+ int2 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_7faa9e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_7faa9e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_7faa9e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl
new file mode 100644
index 0000000..7150734
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_7faa9e() {
+ int2 arg_0 = int2(0);
+ int2 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_7faa9e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_7faa9e();
+ return;
+}
+
+kernel void compute_main() {
+ abs_7faa9e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm
new file mode 100644
index 0000000..fe6e8ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_7faa9e "abs_7faa9e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_7faa9e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ %20 = OpLoad %v2int %arg_0
+ %18 = OpExtInst %v2int %19 SAbs %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %abs_7faa9e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %abs_7faa9e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %abs_7faa9e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl
new file mode 100644
index 0000000..95ebb29
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/7faa9e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_7faa9e() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_7faa9e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_7faa9e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_7faa9e();
+}
diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl
new file mode 100644
index 0000000..ec9f3e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(vec<4, i32>) -> vec<4, i32>
+fn abs_9c80a6() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_9c80a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_9c80a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_9c80a6();
+}
diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl
new file mode 100644
index 0000000..bd0c1f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_9c80a6() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_9c80a6();
+ 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;
+
+void abs_9c80a6() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_9c80a6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_9c80a6() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_9c80a6();
+}
+
+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/abs/9c80a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.hlsl
new file mode 100644
index 0000000..9457142
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_9c80a6() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_9c80a6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_9c80a6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_9c80a6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl
new file mode 100644
index 0000000..e3a3aad
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_9c80a6() {
+ int4 arg_0 = int4(0);
+ int4 res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_9c80a6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_9c80a6();
+ return;
+}
+
+kernel void compute_main() {
+ abs_9c80a6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm
new file mode 100644
index 0000000..170b055
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_9c80a6 "abs_9c80a6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %abs_9c80a6 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ %20 = OpLoad %v4int %arg_0
+ %18 = OpExtInst %v4int %19 SAbs %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %abs_9c80a6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %abs_9c80a6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %abs_9c80a6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl
new file mode 100644
index 0000000..9fb60c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/9c80a6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_9c80a6() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_9c80a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_9c80a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_9c80a6();
+}
diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl b/test/tint/builtins/gen/var/abs/b96037.wgsl
new file mode 100644
index 0000000..7d4df57
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/b96037.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn abs(f32) -> f32
+fn abs_b96037() {
+ var arg_0 = 1.0;
+ var res: f32 = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_b96037();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_b96037();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_b96037();
+}
diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl
new file mode 100644
index 0000000..0c3a364
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void abs_b96037() {
+ float arg_0 = 1.0f;
+ float res = abs(arg_0);
+}
+
+vec4 vertex_main() {
+ abs_b96037();
+ 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;
+
+void abs_b96037() {
+ float arg_0 = 1.0f;
+ float res = abs(arg_0);
+}
+
+void fragment_main() {
+ abs_b96037();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void abs_b96037() {
+ float arg_0 = 1.0f;
+ float res = abs(arg_0);
+}
+
+void compute_main() {
+ abs_b96037();
+}
+
+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/abs/b96037.wgsl.expected.hlsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.hlsl
new file mode 100644
index 0000000..b19d55f
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void abs_b96037() {
+ float arg_0 = 1.0f;
+ float res = abs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ abs_b96037();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ abs_b96037();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ abs_b96037();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl
new file mode 100644
index 0000000..ad39e75
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void abs_b96037() {
+ float arg_0 = 1.0f;
+ float res = fabs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ abs_b96037();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ abs_b96037();
+ return;
+}
+
+kernel void compute_main() {
+ abs_b96037();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm
new file mode 100644
index 0000000..419d3a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %abs_b96037 "abs_b96037"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %abs_b96037 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 FAbs %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %abs_b96037
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %abs_b96037
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %abs_b96037
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl
new file mode 100644
index 0000000..e77b0cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/abs/b96037.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn abs_b96037() {
+ var arg_0 = 1.0;
+ var res : f32 = abs(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ abs_b96037();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ abs_b96037();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ abs_b96037();
+}
diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl
new file mode 100644
index 0000000..3fe1481
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/489247.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn acos(f32) -> f32
+fn acos_489247() {
+ var arg_0 = 1.0;
+ var res: f32 = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_489247();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_489247();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_489247();
+}
diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl
new file mode 100644
index 0000000..bd507c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void acos_489247() {
+ float arg_0 = 1.0f;
+ float res = acos(arg_0);
+}
+
+vec4 vertex_main() {
+ acos_489247();
+ 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;
+
+void acos_489247() {
+ float arg_0 = 1.0f;
+ float res = acos(arg_0);
+}
+
+void fragment_main() {
+ acos_489247();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void acos_489247() {
+ float arg_0 = 1.0f;
+ float res = acos(arg_0);
+}
+
+void compute_main() {
+ acos_489247();
+}
+
+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/acos/489247.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.hlsl
new file mode 100644
index 0000000..9f53955
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void acos_489247() {
+ float arg_0 = 1.0f;
+ float res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ acos_489247();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ acos_489247();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ acos_489247();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl
new file mode 100644
index 0000000..273a93f
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void acos_489247() {
+ float arg_0 = 1.0f;
+ float res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ acos_489247();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ acos_489247();
+ return;
+}
+
+kernel void compute_main() {
+ acos_489247();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm
new file mode 100644
index 0000000..854923b
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %acos_489247 "acos_489247"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%acos_489247 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Acos %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %acos_489247
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %acos_489247
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %acos_489247
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl
new file mode 100644
index 0000000..c1cf170
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn acos_489247() {
+ var arg_0 = 1.0;
+ var res : f32 = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_489247();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_489247();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_489247();
+}
diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl
new file mode 100644
index 0000000..d706cf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn acos(vec<4, f32>) -> vec<4, f32>
+fn acos_8e2acf() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_8e2acf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_8e2acf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_8e2acf();
+}
diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl
new file mode 100644
index 0000000..c0f9881
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void acos_8e2acf() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = acos(arg_0);
+}
+
+vec4 vertex_main() {
+ acos_8e2acf();
+ 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;
+
+void acos_8e2acf() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = acos(arg_0);
+}
+
+void fragment_main() {
+ acos_8e2acf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void acos_8e2acf() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = acos(arg_0);
+}
+
+void compute_main() {
+ acos_8e2acf();
+}
+
+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/acos/8e2acf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.hlsl
new file mode 100644
index 0000000..4e05e04
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void acos_8e2acf() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ acos_8e2acf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ acos_8e2acf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ acos_8e2acf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl
new file mode 100644
index 0000000..6908f7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void acos_8e2acf() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ acos_8e2acf();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ acos_8e2acf();
+ return;
+}
+
+kernel void compute_main() {
+ acos_8e2acf();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm
new file mode 100644
index 0000000..3d0fda7
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %acos_8e2acf "acos_8e2acf"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%acos_8e2acf = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Acos %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %acos_8e2acf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %acos_8e2acf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %acos_8e2acf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl
new file mode 100644
index 0000000..b284e35
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn acos_8e2acf() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_8e2acf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_8e2acf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_8e2acf();
+}
diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl
new file mode 100644
index 0000000..f8c535b
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn acos(vec<3, f32>) -> vec<3, f32>
+fn acos_a610c4() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_a610c4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_a610c4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_a610c4();
+}
diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl
new file mode 100644
index 0000000..eb76a03
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void acos_a610c4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = acos(arg_0);
+}
+
+vec4 vertex_main() {
+ acos_a610c4();
+ 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;
+
+void acos_a610c4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = acos(arg_0);
+}
+
+void fragment_main() {
+ acos_a610c4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void acos_a610c4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = acos(arg_0);
+}
+
+void compute_main() {
+ acos_a610c4();
+}
+
+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/acos/a610c4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.hlsl
new file mode 100644
index 0000000..df2b231
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void acos_a610c4() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ acos_a610c4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ acos_a610c4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ acos_a610c4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl
new file mode 100644
index 0000000..fa8d78c
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void acos_a610c4() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ acos_a610c4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ acos_a610c4();
+ return;
+}
+
+kernel void compute_main() {
+ acos_a610c4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm
new file mode 100644
index 0000000..1fedd83
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %acos_a610c4 "acos_a610c4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%acos_a610c4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Acos %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %acos_a610c4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %acos_a610c4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %acos_a610c4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl
new file mode 100644
index 0000000..fed3a9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn acos_a610c4() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_a610c4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_a610c4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_a610c4();
+}
diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl
new file mode 100644
index 0000000..e517978
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn acos(vec<2, f32>) -> vec<2, f32>
+fn acos_dfc915() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_dfc915();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_dfc915();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_dfc915();
+}
diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl
new file mode 100644
index 0000000..7645730
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void acos_dfc915() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = acos(arg_0);
+}
+
+vec4 vertex_main() {
+ acos_dfc915();
+ 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;
+
+void acos_dfc915() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = acos(arg_0);
+}
+
+void fragment_main() {
+ acos_dfc915();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void acos_dfc915() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = acos(arg_0);
+}
+
+void compute_main() {
+ acos_dfc915();
+}
+
+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/acos/dfc915.wgsl.expected.hlsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.hlsl
new file mode 100644
index 0000000..01e6a4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void acos_dfc915() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ acos_dfc915();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ acos_dfc915();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ acos_dfc915();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl
new file mode 100644
index 0000000..0981ef0
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void acos_dfc915() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = acos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ acos_dfc915();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ acos_dfc915();
+ return;
+}
+
+kernel void compute_main() {
+ acos_dfc915();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm
new file mode 100644
index 0000000..0e80066
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %acos_dfc915 "acos_dfc915"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%acos_dfc915 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Acos %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %acos_dfc915
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %acos_dfc915
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %acos_dfc915
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl
new file mode 100644
index 0000000..f1044c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn acos_dfc915() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = acos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ acos_dfc915();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ acos_dfc915();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ acos_dfc915();
+}
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl b/test/tint/builtins/gen/var/all/353d6a.wgsl
new file mode 100644
index 0000000..e443991
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn all(bool) -> bool
+fn all_353d6a() {
+ var arg_0 = bool();
+ var res: bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_353d6a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_353d6a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_353d6a();
+}
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl
new file mode 100644
index 0000000..cd35887
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void all_353d6a() {
+ bool arg_0 = false;
+ bool res = arg_0;
+}
+
+vec4 vertex_main() {
+ all_353d6a();
+ 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;
+
+void all_353d6a() {
+ bool arg_0 = false;
+ bool res = arg_0;
+}
+
+void fragment_main() {
+ all_353d6a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void all_353d6a() {
+ bool arg_0 = false;
+ bool res = arg_0;
+}
+
+void compute_main() {
+ all_353d6a();
+}
+
+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/all/353d6a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.hlsl
new file mode 100644
index 0000000..2bc0778
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void all_353d6a() {
+ bool arg_0 = false;
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ all_353d6a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ all_353d6a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ all_353d6a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl
new file mode 100644
index 0000000..8e2d6a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void all_353d6a() {
+ bool arg_0 = false;
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ all_353d6a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ all_353d6a();
+ return;
+}
+
+kernel void compute_main() {
+ all_353d6a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm
new file mode 100644
index 0000000..58378ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; 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 %all_353d6a "all_353d6a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %14 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %20 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %all_353d6a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_bool Function %14
+ %res = OpVariable %_ptr_Function_bool Function %14
+ OpStore %arg_0 %14
+ %18 = OpLoad %bool %arg_0
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %all_353d6a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %all_353d6a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %all_353d6a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl
new file mode 100644
index 0000000..d9993da
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/353d6a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn all_353d6a() {
+ var arg_0 = bool();
+ var res : bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_353d6a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_353d6a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_353d6a();
+}
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl b/test/tint/builtins/gen/var/all/986c7b.wgsl
new file mode 100644
index 0000000..5248372
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn all(vec<4, bool>) -> bool
+fn all_986c7b() {
+ var arg_0 = vec4<bool>();
+ var res: bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_986c7b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_986c7b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_986c7b();
+}
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl
new file mode 100644
index 0000000..f64d3d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void all_986c7b() {
+ bvec4 arg_0 = bvec4(false);
+ bool res = all(arg_0);
+}
+
+vec4 vertex_main() {
+ all_986c7b();
+ 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;
+
+void all_986c7b() {
+ bvec4 arg_0 = bvec4(false);
+ bool res = all(arg_0);
+}
+
+void fragment_main() {
+ all_986c7b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void all_986c7b() {
+ bvec4 arg_0 = bvec4(false);
+ bool res = all(arg_0);
+}
+
+void compute_main() {
+ all_986c7b();
+}
+
+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/all/986c7b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.hlsl
new file mode 100644
index 0000000..5bac853
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void all_986c7b() {
+ bool4 arg_0 = (false).xxxx;
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ all_986c7b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ all_986c7b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ all_986c7b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl
new file mode 100644
index 0000000..4254635
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void all_986c7b() {
+ bool4 arg_0 = bool4(false);
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ all_986c7b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ all_986c7b();
+ return;
+}
+
+kernel void compute_main() {
+ all_986c7b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm
new file mode 100644
index 0000000..f6d2124
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %all_986c7b "all_986c7b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %15 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %all_986c7b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4bool Function %15
+ %res = OpVariable %_ptr_Function_bool Function %22
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4bool %arg_0
+ %18 = OpAll %bool %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %all_986c7b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %all_986c7b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %all_986c7b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl
new file mode 100644
index 0000000..6aab44d
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/986c7b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn all_986c7b() {
+ var arg_0 = vec4<bool>();
+ var res : bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_986c7b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_986c7b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_986c7b();
+}
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl
new file mode 100644
index 0000000..2383e0d
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn all(vec<3, bool>) -> bool
+fn all_bd2dba() {
+ var arg_0 = vec3<bool>();
+ var res: bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_bd2dba();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_bd2dba();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_bd2dba();
+}
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl
new file mode 100644
index 0000000..9ed5d6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void all_bd2dba() {
+ bvec3 arg_0 = bvec3(false);
+ bool res = all(arg_0);
+}
+
+vec4 vertex_main() {
+ all_bd2dba();
+ 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;
+
+void all_bd2dba() {
+ bvec3 arg_0 = bvec3(false);
+ bool res = all(arg_0);
+}
+
+void fragment_main() {
+ all_bd2dba();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void all_bd2dba() {
+ bvec3 arg_0 = bvec3(false);
+ bool res = all(arg_0);
+}
+
+void compute_main() {
+ all_bd2dba();
+}
+
+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/all/bd2dba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.hlsl
new file mode 100644
index 0000000..c9bf7af
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void all_bd2dba() {
+ bool3 arg_0 = (false).xxx;
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ all_bd2dba();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ all_bd2dba();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ all_bd2dba();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl
new file mode 100644
index 0000000..2e5b633
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void all_bd2dba() {
+ bool3 arg_0 = bool3(false);
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ all_bd2dba();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ all_bd2dba();
+ return;
+}
+
+kernel void compute_main() {
+ all_bd2dba();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm
new file mode 100644
index 0000000..0a55820
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %all_bd2dba "all_bd2dba"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %15 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %all_bd2dba = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3bool Function %15
+ %res = OpVariable %_ptr_Function_bool Function %22
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3bool %arg_0
+ %18 = OpAll %bool %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %all_bd2dba
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %all_bd2dba
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %all_bd2dba
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl
new file mode 100644
index 0000000..4bfafa1
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/bd2dba.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn all_bd2dba() {
+ var arg_0 = vec3<bool>();
+ var res : bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_bd2dba();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_bd2dba();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_bd2dba();
+}
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl b/test/tint/builtins/gen/var/all/f46790.wgsl
new file mode 100644
index 0000000..b8217b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn all(vec<2, bool>) -> bool
+fn all_f46790() {
+ var arg_0 = vec2<bool>();
+ var res: bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_f46790();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_f46790();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_f46790();
+}
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl
new file mode 100644
index 0000000..4840d1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void all_f46790() {
+ bvec2 arg_0 = bvec2(false);
+ bool res = all(arg_0);
+}
+
+vec4 vertex_main() {
+ all_f46790();
+ 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;
+
+void all_f46790() {
+ bvec2 arg_0 = bvec2(false);
+ bool res = all(arg_0);
+}
+
+void fragment_main() {
+ all_f46790();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void all_f46790() {
+ bvec2 arg_0 = bvec2(false);
+ bool res = all(arg_0);
+}
+
+void compute_main() {
+ all_f46790();
+}
+
+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/all/f46790.wgsl.expected.hlsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.hlsl
new file mode 100644
index 0000000..e82b132
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void all_f46790() {
+ bool2 arg_0 = (false).xx;
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ all_f46790();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ all_f46790();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ all_f46790();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl
new file mode 100644
index 0000000..855b1c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void all_f46790() {
+ bool2 arg_0 = bool2(false);
+ bool res = all(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ all_f46790();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ all_f46790();
+ return;
+}
+
+kernel void compute_main() {
+ all_f46790();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm
new file mode 100644
index 0000000..9efeee7
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %all_f46790 "all_f46790"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %15 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %all_f46790 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2bool Function %15
+ %res = OpVariable %_ptr_Function_bool Function %22
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2bool %arg_0
+ %18 = OpAll %bool %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %all_f46790
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %all_f46790
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %all_f46790
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl
new file mode 100644
index 0000000..6921680
--- /dev/null
+++ b/test/tint/builtins/gen/var/all/f46790.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn all_f46790() {
+ var arg_0 = vec2<bool>();
+ var res : bool = all(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ all_f46790();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ all_f46790();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ all_f46790();
+}
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl b/test/tint/builtins/gen/var/any/083428.wgsl
new file mode 100644
index 0000000..3a7a69a
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/083428.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn any(vec<4, bool>) -> bool
+fn any_083428() {
+ var arg_0 = vec4<bool>();
+ var res: bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_083428();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_083428();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_083428();
+}
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl
new file mode 100644
index 0000000..3a47aaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void any_083428() {
+ bvec4 arg_0 = bvec4(false);
+ bool res = any(arg_0);
+}
+
+vec4 vertex_main() {
+ any_083428();
+ 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;
+
+void any_083428() {
+ bvec4 arg_0 = bvec4(false);
+ bool res = any(arg_0);
+}
+
+void fragment_main() {
+ any_083428();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void any_083428() {
+ bvec4 arg_0 = bvec4(false);
+ bool res = any(arg_0);
+}
+
+void compute_main() {
+ any_083428();
+}
+
+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/any/083428.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.hlsl
new file mode 100644
index 0000000..3064009
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void any_083428() {
+ bool4 arg_0 = (false).xxxx;
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ any_083428();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ any_083428();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ any_083428();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl
new file mode 100644
index 0000000..faeff8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void any_083428() {
+ bool4 arg_0 = bool4(false);
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ any_083428();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ any_083428();
+ return;
+}
+
+kernel void compute_main() {
+ any_083428();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm
new file mode 100644
index 0000000..5911608
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %any_083428 "any_083428"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %15 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %any_083428 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4bool Function %15
+ %res = OpVariable %_ptr_Function_bool Function %22
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4bool %arg_0
+ %18 = OpAny %bool %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %any_083428
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %any_083428
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %any_083428
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl
new file mode 100644
index 0000000..6db2c9a
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/083428.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn any_083428() {
+ var arg_0 = vec4<bool>();
+ var res : bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_083428();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_083428();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_083428();
+}
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl
new file mode 100644
index 0000000..270012c
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn any(vec<2, bool>) -> bool
+fn any_0e3e58() {
+ var arg_0 = vec2<bool>();
+ var res: bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_0e3e58();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_0e3e58();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_0e3e58();
+}
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl
new file mode 100644
index 0000000..6b9459a
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void any_0e3e58() {
+ bvec2 arg_0 = bvec2(false);
+ bool res = any(arg_0);
+}
+
+vec4 vertex_main() {
+ any_0e3e58();
+ 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;
+
+void any_0e3e58() {
+ bvec2 arg_0 = bvec2(false);
+ bool res = any(arg_0);
+}
+
+void fragment_main() {
+ any_0e3e58();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void any_0e3e58() {
+ bvec2 arg_0 = bvec2(false);
+ bool res = any(arg_0);
+}
+
+void compute_main() {
+ any_0e3e58();
+}
+
+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/any/0e3e58.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.hlsl
new file mode 100644
index 0000000..2662733
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void any_0e3e58() {
+ bool2 arg_0 = (false).xx;
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ any_0e3e58();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ any_0e3e58();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ any_0e3e58();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl
new file mode 100644
index 0000000..8890ff5
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void any_0e3e58() {
+ bool2 arg_0 = bool2(false);
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ any_0e3e58();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ any_0e3e58();
+ return;
+}
+
+kernel void compute_main() {
+ any_0e3e58();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm
new file mode 100644
index 0000000..1dc30ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %any_0e3e58 "any_0e3e58"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %15 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %any_0e3e58 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2bool Function %15
+ %res = OpVariable %_ptr_Function_bool Function %22
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2bool %arg_0
+ %18 = OpAny %bool %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %any_0e3e58
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %any_0e3e58
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %any_0e3e58
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl
new file mode 100644
index 0000000..c21cd01
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/0e3e58.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn any_0e3e58() {
+ var arg_0 = vec2<bool>();
+ var res : bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_0e3e58();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_0e3e58();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_0e3e58();
+}
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl
new file mode 100644
index 0000000..c234642
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn any(bool) -> bool
+fn any_2ab91a() {
+ var arg_0 = bool();
+ var res: bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_2ab91a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_2ab91a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_2ab91a();
+}
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl
new file mode 100644
index 0000000..05c9236
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void any_2ab91a() {
+ bool arg_0 = false;
+ bool res = arg_0;
+}
+
+vec4 vertex_main() {
+ any_2ab91a();
+ 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;
+
+void any_2ab91a() {
+ bool arg_0 = false;
+ bool res = arg_0;
+}
+
+void fragment_main() {
+ any_2ab91a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void any_2ab91a() {
+ bool arg_0 = false;
+ bool res = arg_0;
+}
+
+void compute_main() {
+ any_2ab91a();
+}
+
+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/any/2ab91a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.hlsl
new file mode 100644
index 0000000..d34bc39
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void any_2ab91a() {
+ bool arg_0 = false;
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ any_2ab91a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ any_2ab91a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ any_2ab91a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl
new file mode 100644
index 0000000..c304db3
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void any_2ab91a() {
+ bool arg_0 = false;
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ any_2ab91a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ any_2ab91a();
+ return;
+}
+
+kernel void compute_main() {
+ any_2ab91a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm
new file mode 100644
index 0000000..d50f7f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; 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 %any_2ab91a "any_2ab91a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %14 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %20 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %any_2ab91a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_bool Function %14
+ %res = OpVariable %_ptr_Function_bool Function %14
+ OpStore %arg_0 %14
+ %18 = OpLoad %bool %arg_0
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %any_2ab91a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %any_2ab91a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %any_2ab91a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl
new file mode 100644
index 0000000..74315cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/2ab91a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn any_2ab91a() {
+ var arg_0 = bool();
+ var res : bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_2ab91a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_2ab91a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_2ab91a();
+}
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl b/test/tint/builtins/gen/var/any/e755c1.wgsl
new file mode 100644
index 0000000..983e8cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn any(vec<3, bool>) -> bool
+fn any_e755c1() {
+ var arg_0 = vec3<bool>();
+ var res: bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_e755c1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_e755c1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_e755c1();
+}
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl
new file mode 100644
index 0000000..355f53a
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void any_e755c1() {
+ bvec3 arg_0 = bvec3(false);
+ bool res = any(arg_0);
+}
+
+vec4 vertex_main() {
+ any_e755c1();
+ 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;
+
+void any_e755c1() {
+ bvec3 arg_0 = bvec3(false);
+ bool res = any(arg_0);
+}
+
+void fragment_main() {
+ any_e755c1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void any_e755c1() {
+ bvec3 arg_0 = bvec3(false);
+ bool res = any(arg_0);
+}
+
+void compute_main() {
+ any_e755c1();
+}
+
+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/any/e755c1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.hlsl
new file mode 100644
index 0000000..cac18b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void any_e755c1() {
+ bool3 arg_0 = (false).xxx;
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ any_e755c1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ any_e755c1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ any_e755c1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl
new file mode 100644
index 0000000..9ae6049
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void any_e755c1() {
+ bool3 arg_0 = bool3(false);
+ bool res = any(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ any_e755c1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ any_e755c1();
+ return;
+}
+
+kernel void compute_main() {
+ any_e755c1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm
new file mode 100644
index 0000000..b0c2406
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %any_e755c1 "any_e755c1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %15 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %any_e755c1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3bool Function %15
+ %res = OpVariable %_ptr_Function_bool Function %22
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3bool %arg_0
+ %18 = OpAny %bool %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %any_e755c1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %any_e755c1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %any_e755c1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl
new file mode 100644
index 0000000..5c5c750
--- /dev/null
+++ b/test/tint/builtins/gen/var/any/e755c1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn any_e755c1() {
+ var arg_0 = vec3<bool>();
+ var res : bool = any(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ any_e755c1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ any_e755c1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ any_e755c1();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl
new file mode 100644
index 0000000..c4dec13
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RO {
+ arg_0: array<i32>,
+};
+@group(0) @binding(1) var<storage, read> sb_ro : SB_RO;
+
+// fn arrayLength(ptr<storage, array<i32>, read>) -> u32
+fn arrayLength_1588cd() {
+ var res: u32 = arrayLength(&sb_ro.arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_1588cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_1588cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_1588cd();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl
new file mode 100644
index 0000000..a143e18
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(binding = 1, std430) buffer SB_RO_1 {
+ int arg_0[];
+} sb_ro;
+void arrayLength_1588cd() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+vec4 vertex_main() {
+ arrayLength_1588cd();
+ 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(binding = 1, std430) buffer SB_RO_1 {
+ int arg_0[];
+} sb_ro;
+void arrayLength_1588cd() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+void fragment_main() {
+ arrayLength_1588cd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(binding = 1, std430) buffer SB_RO_1 {
+ int arg_0[];
+} sb_ro;
+void arrayLength_1588cd() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+void compute_main() {
+ arrayLength_1588cd();
+}
+
+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/arrayLength/1588cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.hlsl
new file mode 100644
index 0000000..fabbad5
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+ByteAddressBuffer sb_ro : register(t1, space0);
+
+void arrayLength_1588cd() {
+ uint tint_symbol_2 = 0u;
+ sb_ro.GetDimensions(tint_symbol_2);
+ const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
+ uint res = tint_symbol_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ arrayLength_1588cd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ arrayLength_1588cd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ arrayLength_1588cd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl
new file mode 100644
index 0000000..1f8ac29
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.msl
@@ -0,0 +1,41 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+
+struct SB_RO {
+ int arg_0[1];
+};
+
+void arrayLength_1588cd(const constant tint_symbol_1* const tint_symbol_3) {
+ uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) {
+ arrayLength_1588cd(tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) {
+ arrayLength_1588cd(tint_symbol_6);
+ return;
+}
+
+kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) {
+ arrayLength_1588cd(tint_symbol_7);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm
new file mode 100644
index 0000000..40b7f6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %SB_RO "SB_RO"
+ OpMemberName %SB_RO 0 "arg_0"
+ OpName %sb_ro "sb_ro"
+ OpName %arrayLength_1588cd "arrayLength_1588cd"
+ 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 %SB_RO Block
+ OpMemberDecorate %SB_RO 0 Offset 0
+ OpDecorate %_runtimearr_int ArrayStride 4
+ OpDecorate %sb_ro NonWritable
+ OpDecorate %sb_ro DescriptorSet 0
+ OpDecorate %sb_ro 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
+ %int = OpTypeInt 32 1
+%_runtimearr_int = OpTypeRuntimeArray %int
+ %SB_RO = OpTypeStruct %_runtimearr_int
+%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO
+ %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %22 = OpConstantNull %uint
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%arrayLength_1588cd = OpFunction %void None %14
+ %17 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %22
+ %18 = OpArrayLength %uint %sb_ro 0
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %arrayLength_1588cd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %14
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %14
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %arrayLength_1588cd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %14
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %arrayLength_1588cd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl
new file mode 100644
index 0000000..2a2648d
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/1588cd.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+struct SB_RO {
+ arg_0 : array<i32>,
+}
+
+@group(0) @binding(1) var<storage, read> sb_ro : SB_RO;
+
+fn arrayLength_1588cd() {
+ var res : u32 = arrayLength(&(sb_ro.arg_0));
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_1588cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_1588cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_1588cd();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl
new file mode 100644
index 0000000..a7adcc1
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: array<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn arrayLength(ptr<storage, array<i32>, read_write>) -> u32
+fn arrayLength_61b1c7() {
+ var res: u32 = arrayLength(&sb_rw.arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_61b1c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_61b1c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_61b1c7();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl
new file mode 100644
index 0000000..46667de
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0[];
+} sb_rw;
+void arrayLength_61b1c7() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+vec4 vertex_main() {
+ arrayLength_61b1c7();
+ 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(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0[];
+} sb_rw;
+void arrayLength_61b1c7() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+void fragment_main() {
+ arrayLength_61b1c7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0[];
+} sb_rw;
+void arrayLength_61b1c7() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+void compute_main() {
+ arrayLength_61b1c7();
+}
+
+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/arrayLength/61b1c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.hlsl
new file mode 100644
index 0000000..ba47339
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+void arrayLength_61b1c7() {
+ uint tint_symbol_2 = 0u;
+ sb_rw.GetDimensions(tint_symbol_2);
+ const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
+ uint res = tint_symbol_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ arrayLength_61b1c7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ arrayLength_61b1c7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ arrayLength_61b1c7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl
new file mode 100644
index 0000000..9fa02f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.msl
@@ -0,0 +1,41 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+
+struct SB_RW {
+ int arg_0[1];
+};
+
+void arrayLength_61b1c7(const constant tint_symbol_1* const tint_symbol_3) {
+ uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) {
+ arrayLength_61b1c7(tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) {
+ arrayLength_61b1c7(tint_symbol_6);
+ return;
+}
+
+kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) {
+ arrayLength_61b1c7(tint_symbol_7);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm
new file mode 100644
index 0000000..482bb98
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %arrayLength_61b1c7 "arrayLength_61b1c7"
+ 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 %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %_runtimearr_int ArrayStride 4
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw 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
+%_runtimearr_int = OpTypeRuntimeArray %int
+ %SB_RW = OpTypeStruct %_runtimearr_int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %22 = OpConstantNull %uint
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%arrayLength_61b1c7 = OpFunction %void None %14
+ %17 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %22
+ %18 = OpArrayLength %uint %sb_rw 0
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %arrayLength_61b1c7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %14
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %14
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %arrayLength_61b1c7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %14
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %arrayLength_61b1c7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl
new file mode 100644
index 0000000..73dbbb7
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/61b1c7.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+struct SB_RW {
+ arg_0 : array<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn arrayLength_61b1c7() {
+ var res : u32 = arrayLength(&(sb_rw.arg_0));
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_61b1c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_61b1c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_61b1c7();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl
new file mode 100644
index 0000000..3f83858
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RO {
+ arg_0: array<f32>,
+};
+@group(0) @binding(1) var<storage, read> sb_ro : SB_RO;
+
+// fn arrayLength(ptr<storage, array<f32>, read>) -> u32
+fn arrayLength_a0f5ca() {
+ var res: u32 = arrayLength(&sb_ro.arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_a0f5ca();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_a0f5ca();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_a0f5ca();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl
new file mode 100644
index 0000000..44aaf23
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(binding = 1, std430) buffer SB_RO_1 {
+ float arg_0[];
+} sb_ro;
+void arrayLength_a0f5ca() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+vec4 vertex_main() {
+ arrayLength_a0f5ca();
+ 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(binding = 1, std430) buffer SB_RO_1 {
+ float arg_0[];
+} sb_ro;
+void arrayLength_a0f5ca() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+void fragment_main() {
+ arrayLength_a0f5ca();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(binding = 1, std430) buffer SB_RO_1 {
+ float arg_0[];
+} sb_ro;
+void arrayLength_a0f5ca() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+void compute_main() {
+ arrayLength_a0f5ca();
+}
+
+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/arrayLength/a0f5ca.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.hlsl
new file mode 100644
index 0000000..cee7ff2
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+ByteAddressBuffer sb_ro : register(t1, space0);
+
+void arrayLength_a0f5ca() {
+ uint tint_symbol_2 = 0u;
+ sb_ro.GetDimensions(tint_symbol_2);
+ const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
+ uint res = tint_symbol_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ arrayLength_a0f5ca();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ arrayLength_a0f5ca();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ arrayLength_a0f5ca();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl
new file mode 100644
index 0000000..f1b7785
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.msl
@@ -0,0 +1,41 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+
+struct SB_RO {
+ float arg_0[1];
+};
+
+void arrayLength_a0f5ca(const constant tint_symbol_1* const tint_symbol_3) {
+ uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) {
+ arrayLength_a0f5ca(tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) {
+ arrayLength_a0f5ca(tint_symbol_6);
+ return;
+}
+
+kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) {
+ arrayLength_a0f5ca(tint_symbol_7);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm
new file mode 100644
index 0000000..0af5f92
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; 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 %SB_RO "SB_RO"
+ OpMemberName %SB_RO 0 "arg_0"
+ OpName %sb_ro "sb_ro"
+ OpName %arrayLength_a0f5ca "arrayLength_a0f5ca"
+ 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 %SB_RO Block
+ OpMemberDecorate %SB_RO 0 Offset 0
+ OpDecorate %_runtimearr_float ArrayStride 4
+ OpDecorate %sb_ro NonWritable
+ OpDecorate %sb_ro DescriptorSet 0
+ OpDecorate %sb_ro 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
+%_runtimearr_float = OpTypeRuntimeArray %float
+ %SB_RO = OpTypeStruct %_runtimearr_float
+%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO
+ %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%arrayLength_a0f5ca = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %21
+ %17 = OpArrayLength %uint %sb_ro 0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %arrayLength_a0f5ca
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %arrayLength_a0f5ca
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %arrayLength_a0f5ca
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl
new file mode 100644
index 0000000..a1eb324
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/a0f5ca.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+struct SB_RO {
+ arg_0 : array<f32>,
+}
+
+@group(0) @binding(1) var<storage, read> sb_ro : SB_RO;
+
+fn arrayLength_a0f5ca() {
+ var res : u32 = arrayLength(&(sb_ro.arg_0));
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_a0f5ca();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_a0f5ca();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_a0f5ca();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl
new file mode 100644
index 0000000..3b38e51
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: array<f32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn arrayLength(ptr<storage, array<f32>, read_write>) -> u32
+fn arrayLength_cdd123() {
+ var res: u32 = arrayLength(&sb_rw.arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_cdd123();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_cdd123();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_cdd123();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl
new file mode 100644
index 0000000..dac4336
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ float arg_0[];
+} sb_rw;
+void arrayLength_cdd123() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+vec4 vertex_main() {
+ arrayLength_cdd123();
+ 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(binding = 0, std430) buffer SB_RW_1 {
+ float arg_0[];
+} sb_rw;
+void arrayLength_cdd123() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+void fragment_main() {
+ arrayLength_cdd123();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ float arg_0[];
+} sb_rw;
+void arrayLength_cdd123() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+void compute_main() {
+ arrayLength_cdd123();
+}
+
+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/arrayLength/cdd123.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.hlsl
new file mode 100644
index 0000000..2156844
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+void arrayLength_cdd123() {
+ uint tint_symbol_2 = 0u;
+ sb_rw.GetDimensions(tint_symbol_2);
+ const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
+ uint res = tint_symbol_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ arrayLength_cdd123();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ arrayLength_cdd123();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ arrayLength_cdd123();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl
new file mode 100644
index 0000000..22cfa6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.msl
@@ -0,0 +1,41 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+
+struct SB_RW {
+ float arg_0[1];
+};
+
+void arrayLength_cdd123(const constant tint_symbol_1* const tint_symbol_3) {
+ uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) {
+ arrayLength_cdd123(tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) {
+ arrayLength_cdd123(tint_symbol_6);
+ return;
+}
+
+kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) {
+ arrayLength_cdd123(tint_symbol_7);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm
new file mode 100644
index 0000000..4644796
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; 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 %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %arrayLength_cdd123 "arrayLength_cdd123"
+ 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 %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %_runtimearr_float ArrayStride 4
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw 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
+%_runtimearr_float = OpTypeRuntimeArray %float
+ %SB_RW = OpTypeStruct %_runtimearr_float
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%arrayLength_cdd123 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %21
+ %17 = OpArrayLength %uint %sb_rw 0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %arrayLength_cdd123
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %arrayLength_cdd123
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %arrayLength_cdd123
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl
new file mode 100644
index 0000000..1f2d17c
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cdd123.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+struct SB_RW {
+ arg_0 : array<f32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn arrayLength_cdd123() {
+ var res : u32 = arrayLength(&(sb_rw.arg_0));
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_cdd123();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_cdd123();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_cdd123();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl
new file mode 100644
index 0000000..99d788d
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RO {
+ arg_0: array<u32>,
+};
+@group(0) @binding(1) var<storage, read> sb_ro : SB_RO;
+
+// fn arrayLength(ptr<storage, array<u32>, read>) -> u32
+fn arrayLength_cfca0a() {
+ var res: u32 = arrayLength(&sb_ro.arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_cfca0a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_cfca0a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_cfca0a();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl
new file mode 100644
index 0000000..e159bef
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(binding = 1, std430) buffer SB_RO_1 {
+ uint arg_0[];
+} sb_ro;
+void arrayLength_cfca0a() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+vec4 vertex_main() {
+ arrayLength_cfca0a();
+ 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(binding = 1, std430) buffer SB_RO_1 {
+ uint arg_0[];
+} sb_ro;
+void arrayLength_cfca0a() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+void fragment_main() {
+ arrayLength_cfca0a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(binding = 1, std430) buffer SB_RO_1 {
+ uint arg_0[];
+} sb_ro;
+void arrayLength_cfca0a() {
+ uint res = uint(sb_ro.arg_0.length());
+}
+
+void compute_main() {
+ arrayLength_cfca0a();
+}
+
+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/arrayLength/cfca0a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.hlsl
new file mode 100644
index 0000000..a6cf72c
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+ByteAddressBuffer sb_ro : register(t1, space0);
+
+void arrayLength_cfca0a() {
+ uint tint_symbol_2 = 0u;
+ sb_ro.GetDimensions(tint_symbol_2);
+ const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
+ uint res = tint_symbol_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ arrayLength_cfca0a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ arrayLength_cfca0a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ arrayLength_cfca0a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl
new file mode 100644
index 0000000..d64c1e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.msl
@@ -0,0 +1,41 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+
+struct SB_RO {
+ uint arg_0[1];
+};
+
+void arrayLength_cfca0a(const constant tint_symbol_1* const tint_symbol_3) {
+ uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) {
+ arrayLength_cfca0a(tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) {
+ arrayLength_cfca0a(tint_symbol_6);
+ return;
+}
+
+kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) {
+ arrayLength_cfca0a(tint_symbol_7);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm
new file mode 100644
index 0000000..db230e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; 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 %SB_RO "SB_RO"
+ OpMemberName %SB_RO 0 "arg_0"
+ OpName %sb_ro "sb_ro"
+ OpName %arrayLength_cfca0a "arrayLength_cfca0a"
+ 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 %SB_RO Block
+ OpMemberDecorate %SB_RO 0 Offset 0
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %sb_ro NonWritable
+ OpDecorate %sb_ro DescriptorSet 0
+ OpDecorate %sb_ro 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
+ %uint = OpTypeInt 32 0
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %SB_RO = OpTypeStruct %_runtimearr_uint
+%_ptr_StorageBuffer_SB_RO = OpTypePointer StorageBuffer %SB_RO
+ %sb_ro = OpVariable %_ptr_StorageBuffer_SB_RO StorageBuffer
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%arrayLength_cfca0a = OpFunction %void None %14
+ %17 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %21
+ %18 = OpArrayLength %uint %sb_ro 0
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %arrayLength_cfca0a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %14
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %14
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %arrayLength_cfca0a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %14
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %arrayLength_cfca0a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl
new file mode 100644
index 0000000..5778963
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/cfca0a.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+struct SB_RO {
+ arg_0 : array<u32>,
+}
+
+@group(0) @binding(1) var<storage, read> sb_ro : SB_RO;
+
+fn arrayLength_cfca0a() {
+ var res : u32 = arrayLength(&(sb_ro.arg_0));
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_cfca0a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_cfca0a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_cfca0a();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl
new file mode 100644
index 0000000..cc2627b
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: array<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn arrayLength(ptr<storage, array<u32>, read_write>) -> u32
+fn arrayLength_eb510f() {
+ var res: u32 = arrayLength(&sb_rw.arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_eb510f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_eb510f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_eb510f();
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl
new file mode 100644
index 0000000..a11f1aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0[];
+} sb_rw;
+void arrayLength_eb510f() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+vec4 vertex_main() {
+ arrayLength_eb510f();
+ 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(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0[];
+} sb_rw;
+void arrayLength_eb510f() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+void fragment_main() {
+ arrayLength_eb510f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0[];
+} sb_rw;
+void arrayLength_eb510f() {
+ uint res = uint(sb_rw.arg_0.length());
+}
+
+void compute_main() {
+ arrayLength_eb510f();
+}
+
+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/arrayLength/eb510f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.hlsl
new file mode 100644
index 0000000..4b05a0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+void arrayLength_eb510f() {
+ uint tint_symbol_2 = 0u;
+ sb_rw.GetDimensions(tint_symbol_2);
+ const uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
+ uint res = tint_symbol_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ arrayLength_eb510f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ arrayLength_eb510f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ arrayLength_eb510f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl
new file mode 100644
index 0000000..4412853
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.msl
@@ -0,0 +1,41 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol_1 {
+ /* 0x0000 */ uint4 buffer_size[1];
+};
+
+struct SB_RW {
+ uint arg_0[1];
+};
+
+void arrayLength_eb510f(const constant tint_symbol_1* const tint_symbol_3) {
+ uint res = (((*(tint_symbol_3)).buffer_size[0u][0u] - 0u) / 4u);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(const constant tint_symbol_1* const tint_symbol_4) {
+ arrayLength_eb510f(tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(const constant tint_symbol_1* tint_symbol_5 [[buffer(30)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_5);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(const constant tint_symbol_1* tint_symbol_6 [[buffer(30)]]) {
+ arrayLength_eb510f(tint_symbol_6);
+ return;
+}
+
+kernel void compute_main(const constant tint_symbol_1* tint_symbol_7 [[buffer(30)]]) {
+ arrayLength_eb510f(tint_symbol_7);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm
new file mode 100644
index 0000000..b165c3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; 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 %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %arrayLength_eb510f "arrayLength_eb510f"
+ 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 %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %_runtimearr_uint ArrayStride 4
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw 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
+%_runtimearr_uint = OpTypeRuntimeArray %uint
+ %SB_RW = OpTypeStruct %_runtimearr_uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %14 = OpTypeFunction %void
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%arrayLength_eb510f = OpFunction %void None %14
+ %17 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %21
+ %18 = OpArrayLength %uint %sb_rw 0
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %arrayLength_eb510f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %14
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %14
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %arrayLength_eb510f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %14
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %arrayLength_eb510f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl
new file mode 100644
index 0000000..805917c
--- /dev/null
+++ b/test/tint/builtins/gen/var/arrayLength/eb510f.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+struct SB_RW {
+ arg_0 : array<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn arrayLength_eb510f() {
+ var res : u32 = arrayLength(&(sb_rw.arg_0));
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ arrayLength_eb510f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ arrayLength_eb510f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ arrayLength_eb510f();
+}
diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl b/test/tint/builtins/gen/var/asin/064953.wgsl
new file mode 100644
index 0000000..5e2ba51
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/064953.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn asin(vec<4, f32>) -> vec<4, f32>
+fn asin_064953() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_064953();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_064953();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_064953();
+}
diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl
new file mode 100644
index 0000000..3ea2994
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void asin_064953() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = asin(arg_0);
+}
+
+vec4 vertex_main() {
+ asin_064953();
+ 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;
+
+void asin_064953() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = asin(arg_0);
+}
+
+void fragment_main() {
+ asin_064953();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void asin_064953() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = asin(arg_0);
+}
+
+void compute_main() {
+ asin_064953();
+}
+
+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/asin/064953.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.hlsl
new file mode 100644
index 0000000..21168e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void asin_064953() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ asin_064953();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ asin_064953();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ asin_064953();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl
new file mode 100644
index 0000000..ee8a542
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void asin_064953() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ asin_064953();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ asin_064953();
+ return;
+}
+
+kernel void compute_main() {
+ asin_064953();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm
new file mode 100644
index 0000000..632fae4
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %asin_064953 "asin_064953"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%asin_064953 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Asin %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %asin_064953
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %asin_064953
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %asin_064953
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl
new file mode 100644
index 0000000..3753e5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/064953.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn asin_064953() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_064953();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_064953();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_064953();
+}
diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl
new file mode 100644
index 0000000..a52ec14
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn asin(vec<2, f32>) -> vec<2, f32>
+fn asin_7b6a44() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_7b6a44();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_7b6a44();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_7b6a44();
+}
diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl
new file mode 100644
index 0000000..28c990f
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void asin_7b6a44() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = asin(arg_0);
+}
+
+vec4 vertex_main() {
+ asin_7b6a44();
+ 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;
+
+void asin_7b6a44() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = asin(arg_0);
+}
+
+void fragment_main() {
+ asin_7b6a44();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void asin_7b6a44() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = asin(arg_0);
+}
+
+void compute_main() {
+ asin_7b6a44();
+}
+
+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/asin/7b6a44.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.hlsl
new file mode 100644
index 0000000..306769c
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void asin_7b6a44() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ asin_7b6a44();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ asin_7b6a44();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ asin_7b6a44();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl
new file mode 100644
index 0000000..f1e70f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void asin_7b6a44() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ asin_7b6a44();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ asin_7b6a44();
+ return;
+}
+
+kernel void compute_main() {
+ asin_7b6a44();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm
new file mode 100644
index 0000000..a77325c
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %asin_7b6a44 "asin_7b6a44"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%asin_7b6a44 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Asin %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %asin_7b6a44
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %asin_7b6a44
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %asin_7b6a44
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl
new file mode 100644
index 0000000..ec5ec15
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/7b6a44.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn asin_7b6a44() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_7b6a44();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_7b6a44();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_7b6a44();
+}
diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl
new file mode 100644
index 0000000..e568908
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn asin(vec<3, f32>) -> vec<3, f32>
+fn asin_8cd9c9() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_8cd9c9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_8cd9c9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_8cd9c9();
+}
diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl
new file mode 100644
index 0000000..f1a2967
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void asin_8cd9c9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = asin(arg_0);
+}
+
+vec4 vertex_main() {
+ asin_8cd9c9();
+ 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;
+
+void asin_8cd9c9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = asin(arg_0);
+}
+
+void fragment_main() {
+ asin_8cd9c9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void asin_8cd9c9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = asin(arg_0);
+}
+
+void compute_main() {
+ asin_8cd9c9();
+}
+
+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/asin/8cd9c9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.hlsl
new file mode 100644
index 0000000..ba54cdc
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void asin_8cd9c9() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ asin_8cd9c9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ asin_8cd9c9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ asin_8cd9c9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl
new file mode 100644
index 0000000..848555c
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void asin_8cd9c9() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ asin_8cd9c9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ asin_8cd9c9();
+ return;
+}
+
+kernel void compute_main() {
+ asin_8cd9c9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm
new file mode 100644
index 0000000..85c702d
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %asin_8cd9c9 "asin_8cd9c9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%asin_8cd9c9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Asin %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %asin_8cd9c9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %asin_8cd9c9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %asin_8cd9c9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl
new file mode 100644
index 0000000..be247dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/8cd9c9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn asin_8cd9c9() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_8cd9c9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_8cd9c9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_8cd9c9();
+}
diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl
new file mode 100644
index 0000000..f7c1933
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn asin(f32) -> f32
+fn asin_c0c272() {
+ var arg_0 = 1.0;
+ var res: f32 = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_c0c272();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_c0c272();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_c0c272();
+}
diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl
new file mode 100644
index 0000000..9869bdb
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void asin_c0c272() {
+ float arg_0 = 1.0f;
+ float res = asin(arg_0);
+}
+
+vec4 vertex_main() {
+ asin_c0c272();
+ 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;
+
+void asin_c0c272() {
+ float arg_0 = 1.0f;
+ float res = asin(arg_0);
+}
+
+void fragment_main() {
+ asin_c0c272();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void asin_c0c272() {
+ float arg_0 = 1.0f;
+ float res = asin(arg_0);
+}
+
+void compute_main() {
+ asin_c0c272();
+}
+
+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/asin/c0c272.wgsl.expected.hlsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.hlsl
new file mode 100644
index 0000000..ad66315
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void asin_c0c272() {
+ float arg_0 = 1.0f;
+ float res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ asin_c0c272();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ asin_c0c272();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ asin_c0c272();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl
new file mode 100644
index 0000000..c8dc4da
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void asin_c0c272() {
+ float arg_0 = 1.0f;
+ float res = asin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ asin_c0c272();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ asin_c0c272();
+ return;
+}
+
+kernel void compute_main() {
+ asin_c0c272();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm
new file mode 100644
index 0000000..6ee3f4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %asin_c0c272 "asin_c0c272"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%asin_c0c272 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Asin %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %asin_c0c272
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %asin_c0c272
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %asin_c0c272
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl
new file mode 100644
index 0000000..1593185
--- /dev/null
+++ b/test/tint/builtins/gen/var/asin/c0c272.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn asin_c0c272() {
+ var arg_0 = 1.0;
+ var res : f32 = asin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ asin_c0c272();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ asin_c0c272();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ asin_c0c272();
+}
diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl b/test/tint/builtins/gen/var/atan/02979a.wgsl
new file mode 100644
index 0000000..b78ade5
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/02979a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan(f32) -> f32
+fn atan_02979a() {
+ var arg_0 = 1.0;
+ var res: f32 = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_02979a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_02979a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_02979a();
+}
diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl
new file mode 100644
index 0000000..b228c08
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void atan_02979a() {
+ float arg_0 = 1.0f;
+ float res = atan(arg_0);
+}
+
+vec4 vertex_main() {
+ atan_02979a();
+ 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;
+
+void atan_02979a() {
+ float arg_0 = 1.0f;
+ float res = atan(arg_0);
+}
+
+void fragment_main() {
+ atan_02979a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_02979a() {
+ float arg_0 = 1.0f;
+ float res = atan(arg_0);
+}
+
+void compute_main() {
+ atan_02979a();
+}
+
+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/atan/02979a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.hlsl
new file mode 100644
index 0000000..8b78942
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void atan_02979a() {
+ float arg_0 = 1.0f;
+ float res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_02979a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan_02979a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_02979a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl
new file mode 100644
index 0000000..53002f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_02979a() {
+ float arg_0 = 1.0f;
+ float res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_02979a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan_02979a();
+ return;
+}
+
+kernel void compute_main() {
+ atan_02979a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm
new file mode 100644
index 0000000..b405e4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %atan_02979a "atan_02979a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%atan_02979a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Atan %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %atan_02979a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_02979a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_02979a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl
new file mode 100644
index 0000000..398e043
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/02979a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_02979a() {
+ var arg_0 = 1.0;
+ var res : f32 = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_02979a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_02979a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_02979a();
+}
diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl
new file mode 100644
index 0000000..672efcb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan(vec<3, f32>) -> vec<3, f32>
+fn atan_331e6d() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_331e6d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_331e6d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_331e6d();
+}
diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl
new file mode 100644
index 0000000..89f42e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void atan_331e6d() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = atan(arg_0);
+}
+
+vec4 vertex_main() {
+ atan_331e6d();
+ 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;
+
+void atan_331e6d() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = atan(arg_0);
+}
+
+void fragment_main() {
+ atan_331e6d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_331e6d() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = atan(arg_0);
+}
+
+void compute_main() {
+ atan_331e6d();
+}
+
+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/atan/331e6d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.hlsl
new file mode 100644
index 0000000..11f8b76
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void atan_331e6d() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_331e6d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan_331e6d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_331e6d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl
new file mode 100644
index 0000000..4594dbc
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_331e6d() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_331e6d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan_331e6d();
+ return;
+}
+
+kernel void compute_main() {
+ atan_331e6d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm
new file mode 100644
index 0000000..3f6e2f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %atan_331e6d "atan_331e6d"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_331e6d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Atan %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atan_331e6d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan_331e6d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %atan_331e6d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl
new file mode 100644
index 0000000..22be443
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/331e6d.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_331e6d() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_331e6d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_331e6d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_331e6d();
+}
diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl
new file mode 100644
index 0000000..edab37d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan(vec<4, f32>) -> vec<4, f32>
+fn atan_a8b696() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_a8b696();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_a8b696();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_a8b696();
+}
diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl
new file mode 100644
index 0000000..3581829
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void atan_a8b696() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = atan(arg_0);
+}
+
+vec4 vertex_main() {
+ atan_a8b696();
+ 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;
+
+void atan_a8b696() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = atan(arg_0);
+}
+
+void fragment_main() {
+ atan_a8b696();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_a8b696() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = atan(arg_0);
+}
+
+void compute_main() {
+ atan_a8b696();
+}
+
+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/atan/a8b696.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.hlsl
new file mode 100644
index 0000000..952af66
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void atan_a8b696() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_a8b696();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan_a8b696();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_a8b696();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl
new file mode 100644
index 0000000..28232e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_a8b696() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_a8b696();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan_a8b696();
+ return;
+}
+
+kernel void compute_main() {
+ atan_a8b696();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm
new file mode 100644
index 0000000..71ce407
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %atan_a8b696 "atan_a8b696"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_a8b696 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Atan %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atan_a8b696
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atan_a8b696
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atan_a8b696
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl
new file mode 100644
index 0000000..88209b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/a8b696.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_a8b696() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_a8b696();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_a8b696();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_a8b696();
+}
diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl
new file mode 100644
index 0000000..0d33269
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan(vec<2, f32>) -> vec<2, f32>
+fn atan_ad96e4() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_ad96e4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_ad96e4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_ad96e4();
+}
diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl
new file mode 100644
index 0000000..cef5994
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void atan_ad96e4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = atan(arg_0);
+}
+
+vec4 vertex_main() {
+ atan_ad96e4();
+ 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;
+
+void atan_ad96e4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = atan(arg_0);
+}
+
+void fragment_main() {
+ atan_ad96e4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan_ad96e4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = atan(arg_0);
+}
+
+void compute_main() {
+ atan_ad96e4();
+}
+
+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/atan/ad96e4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.hlsl
new file mode 100644
index 0000000..dca78eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void atan_ad96e4() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan_ad96e4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan_ad96e4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan_ad96e4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl
new file mode 100644
index 0000000..683f31d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan_ad96e4() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = atan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan_ad96e4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan_ad96e4();
+ return;
+}
+
+kernel void compute_main() {
+ atan_ad96e4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm
new file mode 100644
index 0000000..2434fef
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %atan_ad96e4 "atan_ad96e4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan_ad96e4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Atan %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atan_ad96e4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan_ad96e4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %atan_ad96e4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl
new file mode 100644
index 0000000..7fa376b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan/ad96e4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn atan_ad96e4() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = atan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan_ad96e4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan_ad96e4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan_ad96e4();
+}
diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl
new file mode 100644
index 0000000..768cf69
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan2(vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn atan2_57fb13() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: vec2<f32> = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_57fb13();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_57fb13();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_57fb13();
+}
diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl
new file mode 100644
index 0000000..b3a643b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void atan2_57fb13() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = atan(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ atan2_57fb13();
+ 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;
+
+void atan2_57fb13() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = atan(arg_0, arg_1);
+}
+
+void fragment_main() {
+ atan2_57fb13();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan2_57fb13() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = atan(arg_0, arg_1);
+}
+
+void compute_main() {
+ atan2_57fb13();
+}
+
+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/atan2/57fb13.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.hlsl
new file mode 100644
index 0000000..8cccbb7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void atan2_57fb13() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan2_57fb13();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan2_57fb13();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan2_57fb13();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl
new file mode 100644
index 0000000..4db45ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan2_57fb13() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan2_57fb13();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan2_57fb13();
+ return;
+}
+
+kernel void compute_main() {
+ atan2_57fb13();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm
new file mode 100644
index 0000000..32423fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %atan2_57fb13 "atan2_57fb13"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan2_57fb13 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %v2float %19 Atan2 %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %atan2_57fb13
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %atan2_57fb13
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %atan2_57fb13
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl
new file mode 100644
index 0000000..d53cd33
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/57fb13.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn atan2_57fb13() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : vec2<f32> = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_57fb13();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_57fb13();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_57fb13();
+}
diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl
new file mode 100644
index 0000000..789461b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan2(f32, f32) -> f32
+fn atan2_96057c() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res: f32 = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_96057c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_96057c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_96057c();
+}
diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl
new file mode 100644
index 0000000..f1ea03a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void atan2_96057c() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = atan(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ atan2_96057c();
+ 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;
+
+void atan2_96057c() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = atan(arg_0, arg_1);
+}
+
+void fragment_main() {
+ atan2_96057c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan2_96057c() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = atan(arg_0, arg_1);
+}
+
+void compute_main() {
+ atan2_96057c();
+}
+
+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/atan2/96057c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.hlsl
new file mode 100644
index 0000000..39bf0d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void atan2_96057c() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan2_96057c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan2_96057c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan2_96057c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl
new file mode 100644
index 0000000..799efaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan2_96057c() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan2_96057c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan2_96057c();
+ return;
+}
+
+kernel void compute_main() {
+ atan2_96057c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm
new file mode 100644
index 0000000..8a92d4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %atan2_96057c "atan2_96057c"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+%atan2_96057c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ %19 = OpLoad %float %arg_0
+ %20 = OpLoad %float %arg_1
+ %17 = OpExtInst %float %18 Atan2 %19 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atan2_96057c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan2_96057c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %atan2_96057c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl
new file mode 100644
index 0000000..7931ce2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/96057c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn atan2_96057c() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res : f32 = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_96057c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_96057c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_96057c();
+}
diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl
new file mode 100644
index 0000000..1a5599b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan2(vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn atan2_a70d0d() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_a70d0d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_a70d0d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_a70d0d();
+}
diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl
new file mode 100644
index 0000000..4a5efeb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void atan2_a70d0d() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = atan(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ atan2_a70d0d();
+ 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;
+
+void atan2_a70d0d() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = atan(arg_0, arg_1);
+}
+
+void fragment_main() {
+ atan2_a70d0d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan2_a70d0d() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = atan(arg_0, arg_1);
+}
+
+void compute_main() {
+ atan2_a70d0d();
+}
+
+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/atan2/a70d0d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.hlsl
new file mode 100644
index 0000000..e21a03a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void atan2_a70d0d() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan2_a70d0d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan2_a70d0d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan2_a70d0d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl
new file mode 100644
index 0000000..e76e753
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan2_a70d0d() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan2_a70d0d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan2_a70d0d();
+ return;
+}
+
+kernel void compute_main() {
+ atan2_a70d0d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm
new file mode 100644
index 0000000..e6675dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %atan2_a70d0d "atan2_a70d0d"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan2_a70d0d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 Atan2 %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %atan2_a70d0d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %atan2_a70d0d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %atan2_a70d0d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl
new file mode 100644
index 0000000..3cc0e0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/a70d0d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn atan2_a70d0d() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_a70d0d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_a70d0d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_a70d0d();
+}
diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl
new file mode 100644
index 0000000..1045aea
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn atan2(vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn atan2_ae713e() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: vec4<f32> = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_ae713e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_ae713e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_ae713e();
+}
diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl
new file mode 100644
index 0000000..54f87fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void atan2_ae713e() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = atan(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ atan2_ae713e();
+ 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;
+
+void atan2_ae713e() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = atan(arg_0, arg_1);
+}
+
+void fragment_main() {
+ atan2_ae713e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void atan2_ae713e() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = atan(arg_0, arg_1);
+}
+
+void compute_main() {
+ atan2_ae713e();
+}
+
+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/atan2/ae713e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.hlsl
new file mode 100644
index 0000000..68a82e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void atan2_ae713e() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ atan2_ae713e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ atan2_ae713e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atan2_ae713e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl
new file mode 100644
index 0000000..1fb8aa2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atan2_ae713e() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 res = atan2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ atan2_ae713e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ atan2_ae713e();
+ return;
+}
+
+kernel void compute_main() {
+ atan2_ae713e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm
new file mode 100644
index 0000000..7b4ac18
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %atan2_ae713e "atan2_ae713e"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%atan2_ae713e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %v4float %17 Atan2 %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atan2_ae713e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atan2_ae713e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %atan2_ae713e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl
new file mode 100644
index 0000000..cfdb8ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/atan2/ae713e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn atan2_ae713e() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : vec4<f32> = atan2(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ atan2_ae713e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atan2_ae713e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atan2_ae713e();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl
new file mode 100644
index 0000000..7c911e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicAdd(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicAdd_794055() {
+ var arg_1 = 1;
+ var res: i32 = atomicAdd(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_794055();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl
new file mode 100644
index 0000000..6e7ea7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicAdd_794055() {
+ int arg_1 = 1;
+ int res = atomicAdd(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicAdd_794055();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl
new file mode 100644
index 0000000..94edce7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicAdd_794055() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedAdd(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicAdd_794055();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl
new file mode 100644
index 0000000..b84f508
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicAdd_794055(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_add_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicAdd_794055(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm
new file mode 100644
index 0000000..9a311f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicAdd_794055 "atomicAdd_794055"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicAdd_794055 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicIAdd %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicAdd_794055
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl
new file mode 100644
index 0000000..113cf03
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/794055.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicAdd_794055() {
+ var arg_1 = 1;
+ var res : i32 = atomicAdd(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_794055();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl
new file mode 100644
index 0000000..d84abb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicAdd(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicAdd_8a199a() {
+ var arg_1 = 1u;
+ var res: u32 = atomicAdd(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAdd_8a199a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_8a199a();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl
new file mode 100644
index 0000000..b4e7e25
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicAdd_8a199a() {
+ uint arg_1 = 1u;
+ uint res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicAdd_8a199a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicAdd_8a199a() {
+ uint arg_1 = 1u;
+ uint res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicAdd_8a199a();
+}
+
+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/atomicAdd/8a199a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.hlsl
new file mode 100644
index 0000000..1bf7c3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedAdd(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicAdd_8a199a() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicAdd(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicAdd_8a199a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicAdd_8a199a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl
new file mode 100644
index 0000000..e1e7c61
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicAdd_8a199a(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicAdd_8a199a(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicAdd_8a199a(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm
new file mode 100644
index 0000000..98d9690
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicAdd_8a199a "atomicAdd_8a199a"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicAdd_8a199a = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicIAdd %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicAdd_8a199a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicAdd_8a199a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl
new file mode 100644
index 0000000..63cef4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/8a199a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicAdd_8a199a() {
+ var arg_1 = 1u;
+ var res : u32 = atomicAdd(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAdd_8a199a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_8a199a();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl
new file mode 100644
index 0000000..38cca7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicAdd(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicAdd_d32fe4() {
+ var arg_1 = 1;
+ var res: i32 = atomicAdd(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAdd_d32fe4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_d32fe4();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl
new file mode 100644
index 0000000..c589612
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicAdd_d32fe4() {
+ int arg_1 = 1;
+ int res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicAdd_d32fe4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicAdd_d32fe4() {
+ int arg_1 = 1;
+ int res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicAdd_d32fe4();
+}
+
+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/atomicAdd/d32fe4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.hlsl
new file mode 100644
index 0000000..213221b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedAdd(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicAdd_d32fe4() {
+ int arg_1 = 1;
+ int res = tint_atomicAdd(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicAdd_d32fe4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicAdd_d32fe4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl
new file mode 100644
index 0000000..2ef2df3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicAdd_d32fe4(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_add_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicAdd_d32fe4(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicAdd_d32fe4(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm
new file mode 100644
index 0000000..2fd0e19
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicAdd_d32fe4 "atomicAdd_d32fe4"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicAdd_d32fe4 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicIAdd %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicAdd_d32fe4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicAdd_d32fe4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl
new file mode 100644
index 0000000..bc1c383
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d32fe4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicAdd_d32fe4() {
+ var arg_1 = 1;
+ var res : i32 = atomicAdd(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAdd_d32fe4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_d32fe4();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl
new file mode 100644
index 0000000..528d4aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicAdd(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicAdd_d5db1d() {
+ var arg_1 = 1u;
+ var res: u32 = atomicAdd(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_d5db1d();
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl
new file mode 100644
index 0000000..4d92172
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicAdd_d5db1d() {
+ uint arg_1 = 1u;
+ uint res = atomicAdd(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicAdd_d5db1d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl
new file mode 100644
index 0000000..c74e7bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicAdd_d5db1d() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedAdd(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicAdd_d5db1d();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl
new file mode 100644
index 0000000..c05a45c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicAdd_d5db1d(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_add_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicAdd_d5db1d(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm
new file mode 100644
index 0000000..7ab1e8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicAdd_d5db1d "atomicAdd_d5db1d"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicAdd_d5db1d = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicIAdd %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicAdd_d5db1d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl
new file mode 100644
index 0000000..eaafde0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAdd/d5db1d.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicAdd_d5db1d() {
+ var arg_1 = 1u;
+ var res : u32 = atomicAdd(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAdd_d5db1d();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl
new file mode 100644
index 0000000..62d12c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicAnd(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicAnd_152966() {
+ var arg_1 = 1;
+ var res: i32 = atomicAnd(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAnd_152966();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_152966();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl
new file mode 100644
index 0000000..3e8c40f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicAnd_152966() {
+ int arg_1 = 1;
+ int res = atomicAnd(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicAnd_152966();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicAnd_152966() {
+ int arg_1 = 1;
+ int res = atomicAnd(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicAnd_152966();
+}
+
+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/atomicAnd/152966.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.hlsl
new file mode 100644
index 0000000..4562edb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedAnd(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicAnd_152966() {
+ int arg_1 = 1;
+ int res = tint_atomicAnd(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicAnd_152966();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicAnd_152966();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl
new file mode 100644
index 0000000..c7bf4a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicAnd_152966(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicAnd_152966(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicAnd_152966(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm
new file mode 100644
index 0000000..18408ba
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicAnd_152966 "atomicAnd_152966"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicAnd_152966 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicAnd %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicAnd_152966
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicAnd_152966
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl
new file mode 100644
index 0000000..52984c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/152966.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicAnd_152966() {
+ var arg_1 = 1;
+ var res : i32 = atomicAnd(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAnd_152966();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_152966();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl
new file mode 100644
index 0000000..ffb20d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicAnd(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicAnd_34edd3() {
+ var arg_1 = 1u;
+ var res: u32 = atomicAnd(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_34edd3();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl
new file mode 100644
index 0000000..1233dc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicAnd_34edd3() {
+ uint arg_1 = 1u;
+ uint res = atomicAnd(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicAnd_34edd3();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl
new file mode 100644
index 0000000..9aca847
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicAnd_34edd3() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedAnd(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicAnd_34edd3();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl
new file mode 100644
index 0000000..ea6ba7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicAnd_34edd3(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_and_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicAnd_34edd3(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm
new file mode 100644
index 0000000..e6e94c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicAnd_34edd3 "atomicAnd_34edd3"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicAnd_34edd3 = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicAnd %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicAnd_34edd3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7070c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/34edd3.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicAnd_34edd3() {
+ var arg_1 = 1u;
+ var res : u32 = atomicAnd(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_34edd3();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl
new file mode 100644
index 0000000..dfd0ca1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicAnd(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicAnd_45a819() {
+ var arg_1 = 1;
+ var res: i32 = atomicAnd(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_45a819();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl
new file mode 100644
index 0000000..5f90d4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicAnd_45a819() {
+ int arg_1 = 1;
+ int res = atomicAnd(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicAnd_45a819();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl
new file mode 100644
index 0000000..7bf2f53
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicAnd_45a819() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedAnd(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicAnd_45a819();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl
new file mode 100644
index 0000000..ece0c9f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicAnd_45a819(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_and_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicAnd_45a819(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm
new file mode 100644
index 0000000..e0c9a7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicAnd_45a819 "atomicAnd_45a819"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicAnd_45a819 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicAnd %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicAnd_45a819
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl
new file mode 100644
index 0000000..1d8af20
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/45a819.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicAnd_45a819() {
+ var arg_1 = 1;
+ var res : i32 = atomicAnd(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_45a819();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl
new file mode 100644
index 0000000..726d4ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicAnd(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicAnd_85a8d9() {
+ var arg_1 = 1u;
+ var res: u32 = atomicAnd(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAnd_85a8d9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_85a8d9();
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl
new file mode 100644
index 0000000..6d6dd70
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicAnd_85a8d9() {
+ uint arg_1 = 1u;
+ uint res = atomicAnd(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicAnd_85a8d9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicAnd_85a8d9() {
+ uint arg_1 = 1u;
+ uint res = atomicAnd(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicAnd_85a8d9();
+}
+
+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/atomicAnd/85a8d9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.hlsl
new file mode 100644
index 0000000..f2099cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicAnd(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedAnd(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicAnd_85a8d9() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicAnd(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicAnd_85a8d9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicAnd_85a8d9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl
new file mode 100644
index 0000000..f38ff43
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicAnd_85a8d9(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_and_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicAnd_85a8d9(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicAnd_85a8d9(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm
new file mode 100644
index 0000000..d8c4b78
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicAnd_85a8d9 "atomicAnd_85a8d9"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicAnd_85a8d9 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicAnd %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicAnd_85a8d9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicAnd_85a8d9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl
new file mode 100644
index 0000000..f93a934
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicAnd/85a8d9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicAnd_85a8d9() {
+ var arg_1 = 1u;
+ var res : u32 = atomicAnd(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicAnd_85a8d9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicAnd_85a8d9();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl
new file mode 100644
index 0000000..10dfb91
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicCompareExchangeWeak(ptr<storage, atomic<i32>, read_write>, i32, i32) -> __atomic_compare_exchange_result<i32>
+fn atomicCompareExchangeWeak_1bd40a() {
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res = atomicCompareExchangeWeak(&sb_rw.arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicCompareExchangeWeak_1bd40a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_1bd40a();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl
new file mode 100644
index 0000000..cae561b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.glsl
@@ -0,0 +1,66 @@
+#version 310 es
+precision mediump float;
+
+struct atomic_compare_exchange_resulti32 {
+ int old_value;
+ bool exchanged;
+};
+
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicCompareExchangeWeak_1bd40a() {
+ int arg_1 = 1;
+ int arg_2 = 1;
+ atomic_compare_exchange_resulti32 atomic_compare_result;
+ atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2);
+ atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1;
+ atomic_compare_exchange_resulti32 res = atomic_compare_result;
+}
+
+void fragment_main() {
+ atomicCompareExchangeWeak_1bd40a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct atomic_compare_exchange_resulti32 {
+ int old_value;
+ bool exchanged;
+};
+
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicCompareExchangeWeak_1bd40a() {
+ int arg_1 = 1;
+ int arg_2 = 1;
+ atomic_compare_exchange_resulti32 atomic_compare_result;
+ atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2);
+ atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1;
+ atomic_compare_exchange_resulti32 res = atomic_compare_result;
+}
+
+void compute_main() {
+ atomicCompareExchangeWeak_1bd40a();
+}
+
+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/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl
new file mode 100644
index 0000000..53a01c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+struct atomic_compare_exchange_weak_ret_type {
+ int old_value;
+ bool exchanged;
+};
+
+atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, int compare, int value) {
+ atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0;
+ buffer.InterlockedCompareExchange(offset, compare, value, result.old_value);
+ result.exchanged = result.old_value == compare;
+ return result;
+}
+
+
+void atomicCompareExchangeWeak_1bd40a() {
+ int arg_1 = 1;
+ int arg_2 = 1;
+ atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2);
+}
+
+void fragment_main() {
+ atomicCompareExchangeWeak_1bd40a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicCompareExchangeWeak_1bd40a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl
new file mode 100644
index 0000000..11d8177
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct atomic_compare_exchange_resulti32 {
+ int old_value;
+ bool exchanged;
+};
+template <typename A, typename T>
+atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(device A* atomic, T compare, T value) {
+ T old_value = compare;
+ bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
+ return {old_value, exchanged};
+}
+
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicCompareExchangeWeak_1bd40a(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int arg_2 = 1;
+ atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), arg_1, arg_2);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicCompareExchangeWeak_1bd40a(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicCompareExchangeWeak_1bd40a(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm
new file mode 100644
index 0000000..0c93134
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+SKIP: FAILED
+
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicCompareExchangeWeak_1bd40a "atomicCompareExchangeWeak_1bd40a"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32"
+ OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value"
+ OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0
+ OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %bool = OpTypeBool
+%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32
+ %28 = OpConstantNull %__atomic_compare_exchange_resulti32
+%atomicCompareExchangeWeak_1bd40a = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %arg_2 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %28
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %int_1
+ %22 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %23 = OpLoad %int %arg_2
+ %24 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %arg_1
+ %25 = OpIEqual %bool %24 %23
+ %14 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %24 %25
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %atomicCompareExchangeWeak_1bd40a
+ OpReturn
+ OpFunctionEnd
+1:1: AtomicCompareExchange: expected Comparator to be of type Result Type
+ %24 = OpAtomicCompareExchange %int %22 %uint_1 %uint_0 %uint_0 %23 %arg_1
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl
new file mode 100644
index 0000000..5db36c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/1bd40a.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicCompareExchangeWeak_1bd40a() {
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicCompareExchangeWeak_1bd40a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_1bd40a();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl
new file mode 100644
index 0000000..591914b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl
@@ -0,0 +1,45 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicCompareExchangeWeak(ptr<storage, atomic<u32>, read_write>, u32, u32) -> __atomic_compare_exchange_result<u32>
+fn atomicCompareExchangeWeak_63d8e6() {
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res = atomicCompareExchangeWeak(&sb_rw.arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicCompareExchangeWeak_63d8e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_63d8e6();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl
new file mode 100644
index 0000000..a30b533
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.glsl
@@ -0,0 +1,66 @@
+#version 310 es
+precision mediump float;
+
+struct atomic_compare_exchange_resultu32 {
+ uint old_value;
+ bool exchanged;
+};
+
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicCompareExchangeWeak_63d8e6() {
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ atomic_compare_exchange_resultu32 atomic_compare_result;
+ atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2);
+ atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1;
+ atomic_compare_exchange_resultu32 res = atomic_compare_result;
+}
+
+void fragment_main() {
+ atomicCompareExchangeWeak_63d8e6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct atomic_compare_exchange_resultu32 {
+ uint old_value;
+ bool exchanged;
+};
+
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicCompareExchangeWeak_63d8e6() {
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ atomic_compare_exchange_resultu32 atomic_compare_result;
+ atomic_compare_result.old_value = atomicCompSwap(sb_rw.arg_0, arg_1, arg_2);
+ atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1;
+ atomic_compare_exchange_resultu32 res = atomic_compare_result;
+}
+
+void compute_main() {
+ atomicCompareExchangeWeak_63d8e6();
+}
+
+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/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl
new file mode 100644
index 0000000..3c22dc7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+struct atomic_compare_exchange_weak_ret_type {
+ uint old_value;
+ bool exchanged;
+};
+
+atomic_compare_exchange_weak_ret_type tint_atomicCompareExchangeWeak(RWByteAddressBuffer buffer, uint offset, uint compare, uint value) {
+ atomic_compare_exchange_weak_ret_type result=(atomic_compare_exchange_weak_ret_type)0;
+ buffer.InterlockedCompareExchange(offset, compare, value, result.old_value);
+ result.exchanged = result.old_value == compare;
+ return result;
+}
+
+
+void atomicCompareExchangeWeak_63d8e6() {
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ atomic_compare_exchange_weak_ret_type res = tint_atomicCompareExchangeWeak(sb_rw, 0u, arg_1, arg_2);
+}
+
+void fragment_main() {
+ atomicCompareExchangeWeak_63d8e6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicCompareExchangeWeak_63d8e6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl
new file mode 100644
index 0000000..545803b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct atomic_compare_exchange_resultu32 {
+ uint old_value;
+ bool exchanged;
+};
+template <typename A, typename T>
+atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(device A* atomic, T compare, T value) {
+ T old_value = compare;
+ bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
+ return {old_value, exchanged};
+}
+
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicCompareExchangeWeak_63d8e6(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(&((*(tint_symbol)).arg_0), arg_1, arg_2);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicCompareExchangeWeak_63d8e6(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicCompareExchangeWeak_63d8e6(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm
new file mode 100644
index 0000000..62eac61
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+SKIP: FAILED
+
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicCompareExchangeWeak_63d8e6 "atomicCompareExchangeWeak_63d8e6"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32"
+ OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value"
+ OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0
+ OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %bool = OpTypeBool
+%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32
+ %26 = OpConstantNull %__atomic_compare_exchange_resultu32
+%atomicCompareExchangeWeak_63d8e6 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %arg_2 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %26
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %20 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %21 = OpLoad %uint %arg_2
+ %22 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %arg_1
+ %23 = OpIEqual %bool %22 %21
+ %14 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %22 %23
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %atomicCompareExchangeWeak_63d8e6
+ OpReturn
+ OpFunctionEnd
+1:1: AtomicCompareExchange: expected Comparator to be of type Result Type
+ %22 = OpAtomicCompareExchange %uint %20 %uint_1 %uint_0 %uint_0 %21 %arg_1
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl
new file mode 100644
index 0000000..6be230e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/63d8e6.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicCompareExchangeWeak_63d8e6() {
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res = atomicCompareExchangeWeak(&(sb_rw.arg_0), arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicCompareExchangeWeak_63d8e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_63d8e6();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl
new file mode 100644
index 0000000..b13a4e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicCompareExchangeWeak(ptr<workgroup, atomic<u32>, read_write>, u32, u32) -> __atomic_compare_exchange_result<u32>
+fn atomicCompareExchangeWeak_83580d() {
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res = atomicCompareExchangeWeak(&arg_0, arg_1, arg_2);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_83580d();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
new file mode 100644
index 0000000..a9569da
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.glsl
@@ -0,0 +1,31 @@
+#version 310 es
+
+struct atomic_compare_exchange_resultu32 {
+ uint old_value;
+ bool exchanged;
+};
+
+
+shared uint arg_0;
+void atomicCompareExchangeWeak_83580d() {
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ atomic_compare_exchange_resultu32 atomic_compare_result;
+ atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, arg_2);
+ atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1;
+ atomic_compare_exchange_resultu32 res = atomic_compare_result;
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicCompareExchangeWeak_83580d();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl
new file mode 100644
index 0000000..57e527d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.hlsl
@@ -0,0 +1,17 @@
+SKIP: FAILED
+
+
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicCompareExchangeWeak_83580d() {
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_83580d();
+}
+
+Failed to generate: error: unknown type in EmitType
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
new file mode 100644
index 0000000..6e181e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct atomic_compare_exchange_resultu32 {
+ uint old_value;
+ bool exchanged;
+};
+template <typename A, typename T>
+atomic_compare_exchange_resultu32 atomicCompareExchangeWeak_1(threadgroup A* atomic, T compare, T value) {
+ T old_value = compare;
+ bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
+ return {old_value, exchanged};
+}
+
+void atomicCompareExchangeWeak_83580d(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ atomic_compare_exchange_resultu32 res = atomicCompareExchangeWeak_1(tint_symbol, arg_1, arg_2);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicCompareExchangeWeak_83580d(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
new file mode 100644
index 0000000..4f519e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicCompareExchangeWeak_83580d "atomicCompareExchangeWeak_83580d"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %__atomic_compare_exchange_resultu32 "__atomic_compare_exchange_resultu32"
+ OpMemberName %__atomic_compare_exchange_resultu32 0 "old_value"
+ OpMemberName %__atomic_compare_exchange_resultu32 1 "exchanged"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ OpMemberDecorate %__atomic_compare_exchange_resultu32 0 Offset 0
+ OpMemberDecorate %__atomic_compare_exchange_resultu32 1 Offset 4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %bool = OpTypeBool
+%__atomic_compare_exchange_resultu32 = OpTypeStruct %uint %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function___atomic_compare_exchange_resultu32 = OpTypePointer Function %__atomic_compare_exchange_resultu32
+ %26 = OpConstantNull %__atomic_compare_exchange_resultu32
+ %27 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicCompareExchangeWeak_83580d = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %arg_2 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function___atomic_compare_exchange_resultu32 Function %26
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %21 = OpLoad %uint %arg_2
+ %22 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %21 %arg_1
+ %23 = OpIEqual %bool %22 %21
+ %15 = OpCompositeConstruct %__atomic_compare_exchange_resultu32 %22 %23
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %27
+%local_invocation_index = OpFunctionParameter %uint
+ %30 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %35 = OpFunctionCall %void %atomicCompareExchangeWeak_83580d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %37 = OpLabel
+ %39 = OpLoad %uint %local_invocation_index_1
+ %38 = OpFunctionCall %void %compute_main_inner %39
+ OpReturn
+ OpFunctionEnd
+1:1: AtomicCompareExchange: expected Comparator to be of type Result Type
+ %22 = OpAtomicCompareExchange %uint %arg_0 %uint_2 %uint_0 %uint_0 %21 %arg_1
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl
new file mode 100644
index 0000000..385448d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/83580d.wgsl.expected.wgsl
@@ -0,0 +1,12 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicCompareExchangeWeak_83580d() {
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_83580d();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl
new file mode 100644
index 0000000..c31c39d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicCompareExchangeWeak(ptr<workgroup, atomic<i32>, read_write>, i32, i32) -> __atomic_compare_exchange_result<i32>
+fn atomicCompareExchangeWeak_e88938() {
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res = atomicCompareExchangeWeak(&arg_0, arg_1, arg_2);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_e88938();
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
new file mode 100644
index 0000000..2c5d1a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.glsl
@@ -0,0 +1,31 @@
+#version 310 es
+
+struct atomic_compare_exchange_resulti32 {
+ int old_value;
+ bool exchanged;
+};
+
+
+shared int arg_0;
+void atomicCompareExchangeWeak_e88938() {
+ int arg_1 = 1;
+ int arg_2 = 1;
+ atomic_compare_exchange_resulti32 atomic_compare_result;
+ atomic_compare_result.old_value = atomicCompSwap(arg_0, arg_1, arg_2);
+ atomic_compare_result.exchanged = atomic_compare_result.old_value == arg_1;
+ atomic_compare_exchange_resulti32 res = atomic_compare_result;
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicCompareExchangeWeak_e88938();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl
new file mode 100644
index 0000000..d74ead1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.hlsl
@@ -0,0 +1,17 @@
+SKIP: FAILED
+
+
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicCompareExchangeWeak_e88938() {
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_e88938();
+}
+
+Failed to generate: error: unknown type in EmitType
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
new file mode 100644
index 0000000..38f9dc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct atomic_compare_exchange_resulti32 {
+ int old_value;
+ bool exchanged;
+};
+template <typename A, typename T>
+atomic_compare_exchange_resulti32 atomicCompareExchangeWeak_1(threadgroup A* atomic, T compare, T value) {
+ T old_value = compare;
+ bool exchanged = atomic_compare_exchange_weak_explicit(atomic, &old_value, value, memory_order_relaxed, memory_order_relaxed);
+ return {old_value, exchanged};
+}
+
+void atomicCompareExchangeWeak_e88938(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int arg_2 = 1;
+ atomic_compare_exchange_resulti32 res = atomicCompareExchangeWeak_1(tint_symbol, arg_1, arg_2);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicCompareExchangeWeak_e88938(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
new file mode 100644
index 0000000..9bf039b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+SKIP: FAILED
+
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicCompareExchangeWeak_e88938 "atomicCompareExchangeWeak_e88938"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %__atomic_compare_exchange_resulti32 "__atomic_compare_exchange_resulti32"
+ OpMemberName %__atomic_compare_exchange_resulti32 0 "old_value"
+ OpMemberName %__atomic_compare_exchange_resulti32 1 "exchanged"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ OpMemberDecorate %__atomic_compare_exchange_resulti32 0 Offset 0
+ OpMemberDecorate %__atomic_compare_exchange_resulti32 1 Offset 4
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %bool = OpTypeBool
+%__atomic_compare_exchange_resulti32 = OpTypeStruct %int %bool
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function___atomic_compare_exchange_resulti32 = OpTypePointer Function %__atomic_compare_exchange_resulti32
+ %27 = OpConstantNull %__atomic_compare_exchange_resulti32
+ %28 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicCompareExchangeWeak_e88938 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %arg_2 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function___atomic_compare_exchange_resulti32 Function %27
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %int_1
+ %22 = OpLoad %int %arg_2
+ %23 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %22 %arg_1
+ %24 = OpIEqual %bool %23 %22
+ %16 = OpCompositeConstruct %__atomic_compare_exchange_resulti32 %23 %24
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %28
+%local_invocation_index = OpFunctionParameter %uint
+ %31 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %36 = OpFunctionCall %void %atomicCompareExchangeWeak_e88938
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %38 = OpLabel
+ %40 = OpLoad %uint %local_invocation_index_1
+ %39 = OpFunctionCall %void %compute_main_inner %40
+ OpReturn
+ OpFunctionEnd
+1:1: AtomicCompareExchange: expected Comparator to be of type Result Type
+ %23 = OpAtomicCompareExchange %int %arg_0 %uint_2 %uint_0 %uint_0 %22 %arg_1
+
diff --git a/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl
new file mode 100644
index 0000000..ce2d4c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicCompareExchangeWeak/e88938.wgsl.expected.wgsl
@@ -0,0 +1,12 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicCompareExchangeWeak_e88938() {
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res = atomicCompareExchangeWeak(&(arg_0), arg_1, arg_2);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicCompareExchangeWeak_e88938();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl
new file mode 100644
index 0000000..1f089d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicExchange(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicExchange_0a5dca() {
+ var arg_1 = 1u;
+ var res: u32 = atomicExchange(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_0a5dca();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl
new file mode 100644
index 0000000..268ea18
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicExchange_0a5dca() {
+ uint arg_1 = 1u;
+ uint res = atomicExchange(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicExchange_0a5dca();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl
new file mode 100644
index 0000000..b119a3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicExchange_0a5dca() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedExchange(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicExchange_0a5dca();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl
new file mode 100644
index 0000000..3b21e2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicExchange_0a5dca(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_exchange_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicExchange_0a5dca(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm
new file mode 100644
index 0000000..3bbfe18
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicExchange_0a5dca "atomicExchange_0a5dca"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicExchange_0a5dca = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicExchange %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicExchange_0a5dca
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl
new file mode 100644
index 0000000..97df00c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/0a5dca.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicExchange_0a5dca() {
+ var arg_1 = 1u;
+ var res : u32 = atomicExchange(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_0a5dca();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl
new file mode 100644
index 0000000..da57ab2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicExchange(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicExchange_d59712() {
+ var arg_1 = 1u;
+ var res: u32 = atomicExchange(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicExchange_d59712();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_d59712();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl
new file mode 100644
index 0000000..36903e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicExchange_d59712() {
+ uint arg_1 = 1u;
+ uint res = atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicExchange_d59712();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicExchange_d59712() {
+ uint arg_1 = 1u;
+ uint res = atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicExchange_d59712();
+}
+
+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/atomicExchange/d59712.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.hlsl
new file mode 100644
index 0000000..cec9984
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedExchange(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicExchange_d59712() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicExchange(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicExchange_d59712();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicExchange_d59712();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl
new file mode 100644
index 0000000..425a34f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicExchange_d59712(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicExchange_d59712(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicExchange_d59712(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm
new file mode 100644
index 0000000..2ec90f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicExchange_d59712 "atomicExchange_d59712"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicExchange_d59712 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicExchange %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicExchange_d59712
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicExchange_d59712
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl
new file mode 100644
index 0000000..e2f39b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/d59712.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicExchange_d59712() {
+ var arg_1 = 1u;
+ var res : u32 = atomicExchange(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicExchange_d59712();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_d59712();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl
new file mode 100644
index 0000000..5d88b53
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicExchange(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicExchange_e114ba() {
+ var arg_1 = 1;
+ var res: i32 = atomicExchange(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_e114ba();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl
new file mode 100644
index 0000000..7eb05f37b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicExchange_e114ba() {
+ int arg_1 = 1;
+ int res = atomicExchange(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicExchange_e114ba();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl
new file mode 100644
index 0000000..86842c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicExchange_e114ba() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedExchange(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicExchange_e114ba();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl
new file mode 100644
index 0000000..a7180f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicExchange_e114ba(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_exchange_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicExchange_e114ba(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm
new file mode 100644
index 0000000..0e6f0a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicExchange_e114ba "atomicExchange_e114ba"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicExchange_e114ba = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicExchange %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicExchange_e114ba
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl
new file mode 100644
index 0000000..4002898
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/e114ba.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicExchange_e114ba() {
+ var arg_1 = 1;
+ var res : i32 = atomicExchange(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_e114ba();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl
new file mode 100644
index 0000000..29390d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicExchange(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicExchange_f2e22f() {
+ var arg_1 = 1;
+ var res: i32 = atomicExchange(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicExchange_f2e22f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_f2e22f();
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl
new file mode 100644
index 0000000..c74e310
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicExchange_f2e22f() {
+ int arg_1 = 1;
+ int res = atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicExchange_f2e22f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicExchange_f2e22f() {
+ int arg_1 = 1;
+ int res = atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicExchange_f2e22f();
+}
+
+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/atomicExchange/f2e22f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.hlsl
new file mode 100644
index 0000000..8c0fe23
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicExchange(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedExchange(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicExchange_f2e22f() {
+ int arg_1 = 1;
+ int res = tint_atomicExchange(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicExchange_f2e22f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicExchange_f2e22f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl
new file mode 100644
index 0000000..e4e291f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicExchange_f2e22f(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_exchange_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicExchange_f2e22f(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicExchange_f2e22f(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm
new file mode 100644
index 0000000..755a537
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicExchange_f2e22f "atomicExchange_f2e22f"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicExchange_f2e22f = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicExchange %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicExchange_f2e22f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicExchange_f2e22f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl
new file mode 100644
index 0000000..9cb7731
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicExchange/f2e22f.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicExchange_f2e22f() {
+ var arg_1 = 1;
+ var res : i32 = atomicExchange(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicExchange_f2e22f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicExchange_f2e22f();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl
new file mode 100644
index 0000000..e20d830
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl
@@ -0,0 +1,43 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicLoad(ptr<storage, atomic<i32>, read_write>) -> i32
+fn atomicLoad_0806ad() {
+ var res: i32 = atomicLoad(&sb_rw.arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicLoad_0806ad();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_0806ad();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl
new file mode 100644
index 0000000..38a8c92
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.glsl
@@ -0,0 +1,44 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicLoad_0806ad() {
+ int res = atomicOr(sb_rw.arg_0, 0);
+}
+
+void fragment_main() {
+ atomicLoad_0806ad();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicLoad_0806ad() {
+ int res = atomicOr(sb_rw.arg_0, 0);
+}
+
+void compute_main() {
+ atomicLoad_0806ad();
+}
+
+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/atomicLoad/0806ad.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.hlsl
new file mode 100644
index 0000000..a278b2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.hlsl
@@ -0,0 +1,23 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) {
+ int value = 0;
+ buffer.InterlockedOr(offset, 0, value);
+ return value;
+}
+
+
+void atomicLoad_0806ad() {
+ int res = tint_atomicLoad(sb_rw, 0u);
+}
+
+void fragment_main() {
+ atomicLoad_0806ad();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicLoad_0806ad();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl
new file mode 100644
index 0000000..2335d0d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicLoad_0806ad(device SB_RW* const tint_symbol) {
+ int res = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicLoad_0806ad(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicLoad_0806ad(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm
new file mode 100644
index 0000000..d961ea5
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicLoad_0806ad "atomicLoad_0806ad"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %18 = OpConstantNull %int
+%atomicLoad_0806ad = OpFunction %void None %5
+ %8 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %18
+ %15 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %9 = OpAtomicLoad %int %15 %uint_1 %uint_0
+ OpStore %res %9
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %atomicLoad_0806ad
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicLoad_0806ad
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl
new file mode 100644
index 0000000..e761dd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/0806ad.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicLoad_0806ad() {
+ var res : i32 = atomicLoad(&(sb_rw.arg_0));
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicLoad_0806ad();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_0806ad();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl
new file mode 100644
index 0000000..e0cc43f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicLoad(ptr<workgroup, atomic<u32>, read_write>) -> u32
+fn atomicLoad_361bf1() {
+ var res: u32 = atomicLoad(&arg_0);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_361bf1();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl
new file mode 100644
index 0000000..f56f5a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.glsl
@@ -0,0 +1,20 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicLoad_361bf1() {
+ uint res = atomicOr(arg_0, 0u);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicLoad_361bf1();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl
new file mode 100644
index 0000000..f0f031f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.hlsl
@@ -0,0 +1,26 @@
+groupshared uint arg_0;
+
+void atomicLoad_361bf1() {
+ uint atomic_result = 0u;
+ InterlockedOr(arg_0, 0, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicLoad_361bf1();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl
new file mode 100644
index 0000000..eedf946
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicLoad_361bf1(threadgroup atomic_uint* const tint_symbol) {
+ uint res = atomic_load_explicit(tint_symbol, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicLoad_361bf1(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm
new file mode 100644
index 0000000..20eeca7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicLoad_361bf1 "atomicLoad_361bf1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %16 = OpConstantNull %uint
+ %17 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicLoad_361bf1 = OpFunction %void None %6
+ %9 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %16
+ %10 = OpAtomicLoad %uint %arg_0 %uint_2 %uint_0
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %17
+%local_invocation_index = OpFunctionParameter %uint
+ %20 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %16
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %25 = OpFunctionCall %void %atomicLoad_361bf1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %27 = OpLabel
+ %29 = OpLoad %uint %local_invocation_index_1
+ %28 = OpFunctionCall %void %compute_main_inner %29
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl
new file mode 100644
index 0000000..1040bf2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/361bf1.wgsl.expected.wgsl
@@ -0,0 +1,10 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicLoad_361bf1() {
+ var res : u32 = atomicLoad(&(arg_0));
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_361bf1();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl
new file mode 100644
index 0000000..025384f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicLoad(ptr<workgroup, atomic<i32>, read_write>) -> i32
+fn atomicLoad_afcc03() {
+ var res: i32 = atomicLoad(&arg_0);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_afcc03();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl
new file mode 100644
index 0000000..a290c99
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.glsl
@@ -0,0 +1,20 @@
+#version 310 es
+
+shared int arg_0;
+void atomicLoad_afcc03() {
+ int res = atomicOr(arg_0, 0);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicLoad_afcc03();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl
new file mode 100644
index 0000000..adf265f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.hlsl
@@ -0,0 +1,26 @@
+groupshared int arg_0;
+
+void atomicLoad_afcc03() {
+ int atomic_result = 0;
+ InterlockedOr(arg_0, 0, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicLoad_afcc03();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl
new file mode 100644
index 0000000..90d483d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicLoad_afcc03(threadgroup atomic_int* const tint_symbol) {
+ int res = atomic_load_explicit(tint_symbol, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicLoad_afcc03(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm
new file mode 100644
index 0000000..b996359
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicLoad_afcc03 "atomicLoad_afcc03"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %18 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicLoad_afcc03 = OpFunction %void None %7
+ %10 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %17
+ %11 = OpAtomicLoad %int %arg_0 %uint_2 %uint_0
+ OpStore %res %11
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %18
+%local_invocation_index = OpFunctionParameter %uint
+ %21 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %17
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %26 = OpFunctionCall %void %atomicLoad_afcc03
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %28 = OpLabel
+ %30 = OpLoad %uint %local_invocation_index_1
+ %29 = OpFunctionCall %void %compute_main_inner %30
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl
new file mode 100644
index 0000000..e39317d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/afcc03.wgsl.expected.wgsl
@@ -0,0 +1,10 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicLoad_afcc03() {
+ var res : i32 = atomicLoad(&(arg_0));
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_afcc03();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl
new file mode 100644
index 0000000..63b1594
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl
@@ -0,0 +1,43 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicLoad(ptr<storage, atomic<u32>, read_write>) -> u32
+fn atomicLoad_fe6cc3() {
+ var res: u32 = atomicLoad(&sb_rw.arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicLoad_fe6cc3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_fe6cc3();
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl
new file mode 100644
index 0000000..b4bd0d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.glsl
@@ -0,0 +1,44 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicLoad_fe6cc3() {
+ uint res = atomicOr(sb_rw.arg_0, 0u);
+}
+
+void fragment_main() {
+ atomicLoad_fe6cc3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicLoad_fe6cc3() {
+ uint res = atomicOr(sb_rw.arg_0, 0u);
+}
+
+void compute_main() {
+ atomicLoad_fe6cc3();
+}
+
+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/atomicLoad/fe6cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.hlsl
new file mode 100644
index 0000000..77edab3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.hlsl
@@ -0,0 +1,23 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) {
+ uint value = 0;
+ buffer.InterlockedOr(offset, 0, value);
+ return value;
+}
+
+
+void atomicLoad_fe6cc3() {
+ uint res = tint_atomicLoad(sb_rw, 0u);
+}
+
+void fragment_main() {
+ atomicLoad_fe6cc3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicLoad_fe6cc3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl
new file mode 100644
index 0000000..e78624d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.msl
@@ -0,0 +1,21 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicLoad_fe6cc3(device SB_RW* const tint_symbol) {
+ uint res = atomic_load_explicit(&((*(tint_symbol)).arg_0), memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicLoad_fe6cc3(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicLoad_fe6cc3(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm
new file mode 100644
index 0000000..776c62c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.spvasm
@@ -0,0 +1,51 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 24
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicLoad_fe6cc3 "atomicLoad_fe6cc3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+%atomicLoad_fe6cc3 = OpFunction %void None %5
+ %8 = OpLabel
+ %res = OpVariable %_ptr_Function_uint Function %17
+ %14 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %9 = OpAtomicLoad %uint %14 %uint_1 %uint_0
+ OpStore %res %9
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %atomicLoad_fe6cc3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %atomicLoad_fe6cc3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl
new file mode 100644
index 0000000..f811ee3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicLoad/fe6cc3.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicLoad_fe6cc3() {
+ var res : u32 = atomicLoad(&(sb_rw.arg_0));
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicLoad_fe6cc3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicLoad_fe6cc3();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl
new file mode 100644
index 0000000..44209ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicMax(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicMax_51b9be() {
+ var arg_1 = 1u;
+ var res: u32 = atomicMax(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMax_51b9be();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_51b9be();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl
new file mode 100644
index 0000000..947c35c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicMax_51b9be() {
+ uint arg_1 = 1u;
+ uint res = atomicMax(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicMax_51b9be();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicMax_51b9be() {
+ uint arg_1 = 1u;
+ uint res = atomicMax(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicMax_51b9be();
+}
+
+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/atomicMax/51b9be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.hlsl
new file mode 100644
index 0000000..174521d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicMax(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedMax(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicMax_51b9be() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicMax(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicMax_51b9be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicMax_51b9be();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl
new file mode 100644
index 0000000..71acd56
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicMax_51b9be(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicMax_51b9be(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicMax_51b9be(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm
new file mode 100644
index 0000000..97bae6a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicMax_51b9be "atomicMax_51b9be"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicMax_51b9be = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicUMax %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicMax_51b9be
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicMax_51b9be
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl
new file mode 100644
index 0000000..758c041
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/51b9be.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMax_51b9be() {
+ var arg_1 = 1u;
+ var res : u32 = atomicMax(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMax_51b9be();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_51b9be();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl
new file mode 100644
index 0000000..3caa15d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicMax(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicMax_92aa72() {
+ var arg_1 = 1;
+ var res: i32 = atomicMax(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMax_92aa72();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_92aa72();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl
new file mode 100644
index 0000000..326e6ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicMax_92aa72() {
+ int arg_1 = 1;
+ int res = atomicMax(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicMax_92aa72();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicMax_92aa72() {
+ int arg_1 = 1;
+ int res = atomicMax(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicMax_92aa72();
+}
+
+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/atomicMax/92aa72.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.hlsl
new file mode 100644
index 0000000..a649f98
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicMax(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedMax(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicMax_92aa72() {
+ int arg_1 = 1;
+ int res = tint_atomicMax(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicMax_92aa72();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicMax_92aa72();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl
new file mode 100644
index 0000000..9fefd97
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicMax_92aa72(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_max_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicMax_92aa72(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicMax_92aa72(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm
new file mode 100644
index 0000000..e6ff30e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicMax_92aa72 "atomicMax_92aa72"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicMax_92aa72 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicSMax %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicMax_92aa72
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicMax_92aa72
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl
new file mode 100644
index 0000000..488bf5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/92aa72.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMax_92aa72() {
+ var arg_1 = 1;
+ var res : i32 = atomicMax(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMax_92aa72();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_92aa72();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl
new file mode 100644
index 0000000..8d3a680
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicMax(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicMax_a89cc3() {
+ var arg_1 = 1;
+ var res: i32 = atomicMax(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_a89cc3();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl
new file mode 100644
index 0000000..cfc9b4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicMax_a89cc3() {
+ int arg_1 = 1;
+ int res = atomicMax(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicMax_a89cc3();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl
new file mode 100644
index 0000000..5f4f6cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicMax_a89cc3() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedMax(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicMax_a89cc3();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl
new file mode 100644
index 0000000..a067fcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicMax_a89cc3(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_max_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicMax_a89cc3(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm
new file mode 100644
index 0000000..2864a14
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicMax_a89cc3 "atomicMax_a89cc3"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicMax_a89cc3 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicSMax %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicMax_a89cc3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl
new file mode 100644
index 0000000..73ba0ba
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/a89cc3.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicMax_a89cc3() {
+ var arg_1 = 1;
+ var res : i32 = atomicMax(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_a89cc3();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl
new file mode 100644
index 0000000..8550e0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicMax(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicMax_beccfc() {
+ var arg_1 = 1u;
+ var res: u32 = atomicMax(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_beccfc();
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl
new file mode 100644
index 0000000..b68a3e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicMax_beccfc() {
+ uint arg_1 = 1u;
+ uint res = atomicMax(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicMax_beccfc();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl
new file mode 100644
index 0000000..acdda2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicMax_beccfc() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedMax(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicMax_beccfc();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl
new file mode 100644
index 0000000..96c5d28
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicMax_beccfc(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_max_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicMax_beccfc(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm
new file mode 100644
index 0000000..03577ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicMax_beccfc "atomicMax_beccfc"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicMax_beccfc = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicUMax %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicMax_beccfc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl
new file mode 100644
index 0000000..8faab2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMax/beccfc.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicMax_beccfc() {
+ var arg_1 = 1u;
+ var res : u32 = atomicMax(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMax_beccfc();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl
new file mode 100644
index 0000000..b3f15cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicMin(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicMin_278235() {
+ var arg_1 = 1;
+ var res: i32 = atomicMin(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_278235();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl
new file mode 100644
index 0000000..e27c1f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicMin_278235() {
+ int arg_1 = 1;
+ int res = atomicMin(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicMin_278235();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl
new file mode 100644
index 0000000..06c49cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicMin_278235() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedMin(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicMin_278235();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl
new file mode 100644
index 0000000..8443629
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicMin_278235(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_min_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicMin_278235(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm
new file mode 100644
index 0000000..ddfa25a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicMin_278235 "atomicMin_278235"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicMin_278235 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicSMin %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicMin_278235
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl
new file mode 100644
index 0000000..b0a24df
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/278235.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicMin_278235() {
+ var arg_1 = 1;
+ var res : i32 = atomicMin(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_278235();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl
new file mode 100644
index 0000000..c225e44
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicMin(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicMin_69d383() {
+ var arg_1 = 1u;
+ var res: u32 = atomicMin(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_69d383();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl
new file mode 100644
index 0000000..c14fbe6
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicMin_69d383() {
+ uint arg_1 = 1u;
+ uint res = atomicMin(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicMin_69d383();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl
new file mode 100644
index 0000000..1c16fc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicMin_69d383() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedMin(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicMin_69d383();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl
new file mode 100644
index 0000000..c04290f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicMin_69d383(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_min_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicMin_69d383(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm
new file mode 100644
index 0000000..784a014
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicMin_69d383 "atomicMin_69d383"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicMin_69d383 = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicUMin %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicMin_69d383
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl
new file mode 100644
index 0000000..319c9cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/69d383.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicMin_69d383() {
+ var arg_1 = 1u;
+ var res : u32 = atomicMin(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_69d383();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl
new file mode 100644
index 0000000..283645a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicMin(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicMin_8e38dc() {
+ var arg_1 = 1;
+ var res: i32 = atomicMin(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMin_8e38dc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_8e38dc();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl
new file mode 100644
index 0000000..215a335
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicMin_8e38dc() {
+ int arg_1 = 1;
+ int res = atomicMin(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicMin_8e38dc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicMin_8e38dc() {
+ int arg_1 = 1;
+ int res = atomicMin(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicMin_8e38dc();
+}
+
+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/atomicMin/8e38dc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.hlsl
new file mode 100644
index 0000000..ff4793b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicMin(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedMin(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicMin_8e38dc() {
+ int arg_1 = 1;
+ int res = tint_atomicMin(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicMin_8e38dc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicMin_8e38dc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl
new file mode 100644
index 0000000..d670f6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicMin_8e38dc(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicMin_8e38dc(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicMin_8e38dc(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm
new file mode 100644
index 0000000..f2ca9b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicMin_8e38dc "atomicMin_8e38dc"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicMin_8e38dc = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicSMin %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicMin_8e38dc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicMin_8e38dc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl
new file mode 100644
index 0000000..20955bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/8e38dc.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_8e38dc() {
+ var arg_1 = 1;
+ var res : i32 = atomicMin(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMin_8e38dc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_8e38dc();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl
new file mode 100644
index 0000000..6975d3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicMin(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicMin_c67a74() {
+ var arg_1 = 1u;
+ var res: u32 = atomicMin(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMin_c67a74();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_c67a74();
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl
new file mode 100644
index 0000000..4d5b79b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicMin_c67a74() {
+ uint arg_1 = 1u;
+ uint res = atomicMin(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicMin_c67a74();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicMin_c67a74() {
+ uint arg_1 = 1u;
+ uint res = atomicMin(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicMin_c67a74();
+}
+
+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/atomicMin/c67a74.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.hlsl
new file mode 100644
index 0000000..ae974e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicMin(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedMin(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicMin_c67a74() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicMin(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicMin_c67a74();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicMin_c67a74();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl
new file mode 100644
index 0000000..86f2cf2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicMin_c67a74(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_min_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicMin_c67a74(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicMin_c67a74(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm
new file mode 100644
index 0000000..f3cc67b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicMin_c67a74 "atomicMin_c67a74"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicMin_c67a74 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicUMin %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicMin_c67a74
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicMin_c67a74
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl
new file mode 100644
index 0000000..eeb2d0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicMin/c67a74.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_c67a74() {
+ var arg_1 = 1u;
+ var res : u32 = atomicMin(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicMin_c67a74();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicMin_c67a74();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl
new file mode 100644
index 0000000..e6ca7e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicOr(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicOr_5e3d61() {
+ var arg_1 = 1u;
+ var res: u32 = atomicOr(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_5e3d61();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl
new file mode 100644
index 0000000..23ddd2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicOr_5e3d61() {
+ uint arg_1 = 1u;
+ uint res = atomicOr(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicOr_5e3d61();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl
new file mode 100644
index 0000000..80cf20e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicOr_5e3d61() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedOr(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicOr_5e3d61();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl
new file mode 100644
index 0000000..0801fc9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicOr_5e3d61(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_or_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicOr_5e3d61(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm
new file mode 100644
index 0000000..9db7191
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicOr_5e3d61 "atomicOr_5e3d61"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicOr_5e3d61 = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicOr %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicOr_5e3d61
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl
new file mode 100644
index 0000000..e1b1d1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e3d61.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicOr_5e3d61() {
+ var arg_1 = 1u;
+ var res : u32 = atomicOr(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_5e3d61();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl
new file mode 100644
index 0000000..874d94a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicOr(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicOr_5e95d4() {
+ var arg_1 = 1u;
+ var res: u32 = atomicOr(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicOr_5e95d4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_5e95d4();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl
new file mode 100644
index 0000000..ddd41fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicOr_5e95d4() {
+ uint arg_1 = 1u;
+ uint res = atomicOr(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicOr_5e95d4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicOr_5e95d4() {
+ uint arg_1 = 1u;
+ uint res = atomicOr(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicOr_5e95d4();
+}
+
+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/atomicOr/5e95d4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.hlsl
new file mode 100644
index 0000000..2df87d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicOr(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedOr(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicOr_5e95d4() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicOr(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicOr_5e95d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicOr_5e95d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl
new file mode 100644
index 0000000..f6a899e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicOr_5e95d4(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicOr_5e95d4(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicOr_5e95d4(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm
new file mode 100644
index 0000000..c38fc52
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicOr_5e95d4 "atomicOr_5e95d4"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicOr_5e95d4 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicOr %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicOr_5e95d4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicOr_5e95d4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl
new file mode 100644
index 0000000..c4407a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/5e95d4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicOr_5e95d4() {
+ var arg_1 = 1u;
+ var res : u32 = atomicOr(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicOr_5e95d4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_5e95d4();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl
new file mode 100644
index 0000000..80c6328
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicOr(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicOr_8d96a0() {
+ var arg_1 = 1;
+ var res: i32 = atomicOr(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicOr_8d96a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_8d96a0();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl
new file mode 100644
index 0000000..237e6b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicOr_8d96a0() {
+ int arg_1 = 1;
+ int res = atomicOr(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicOr_8d96a0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicOr_8d96a0() {
+ int arg_1 = 1;
+ int res = atomicOr(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicOr_8d96a0();
+}
+
+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/atomicOr/8d96a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.hlsl
new file mode 100644
index 0000000..b3d4bb9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicOr(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedOr(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicOr_8d96a0() {
+ int arg_1 = 1;
+ int res = tint_atomicOr(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicOr_8d96a0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicOr_8d96a0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl
new file mode 100644
index 0000000..e21e22d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicOr_8d96a0(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_or_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicOr_8d96a0(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicOr_8d96a0(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm
new file mode 100644
index 0000000..978e4ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicOr_8d96a0 "atomicOr_8d96a0"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicOr_8d96a0 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicOr %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicOr_8d96a0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicOr_8d96a0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl
new file mode 100644
index 0000000..44a5caa
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/8d96a0.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicOr_8d96a0() {
+ var arg_1 = 1;
+ var res : i32 = atomicOr(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicOr_8d96a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_8d96a0();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl
new file mode 100644
index 0000000..08cbf89
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicOr(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicOr_d09248() {
+ var arg_1 = 1;
+ var res: i32 = atomicOr(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_d09248();
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl
new file mode 100644
index 0000000..d601550
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicOr_d09248() {
+ int arg_1 = 1;
+ int res = atomicOr(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicOr_d09248();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl
new file mode 100644
index 0000000..04e7f92
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicOr_d09248() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedOr(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicOr_d09248();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl
new file mode 100644
index 0000000..7569a48
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicOr_d09248(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_or_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicOr_d09248(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm
new file mode 100644
index 0000000..6a5541c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicOr_d09248 "atomicOr_d09248"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicOr_d09248 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicOr %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicOr_d09248
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl
new file mode 100644
index 0000000..e5d8f51
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicOr/d09248.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicOr_d09248() {
+ var arg_1 = 1;
+ var res : i32 = atomicOr(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicOr_d09248();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl
new file mode 100644
index 0000000..64735cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicStore(ptr<workgroup, atomic<u32>, read_write>, u32)
+fn atomicStore_726882() {
+ var arg_1 = 1u;
+ atomicStore(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_726882();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl
new file mode 100644
index 0000000..96fecad
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicStore_726882() {
+ uint arg_1 = 1u;
+ atomicExchange(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicStore_726882();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl
new file mode 100644
index 0000000..4bff909
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.hlsl
@@ -0,0 +1,26 @@
+groupshared uint arg_0;
+
+void atomicStore_726882() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedExchange(arg_0, arg_1, atomic_result);
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicStore_726882();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl
new file mode 100644
index 0000000..a6a35a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicStore_726882(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ atomic_store_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicStore_726882(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm
new file mode 100644
index 0000000..72d2c5f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicStore_726882 "atomicStore_726882"
+ OpName %arg_1 "arg_1"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %19 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicStore_726882 = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %18
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %19
+%local_invocation_index = OpFunctionParameter %uint
+ %22 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %27 = OpFunctionCall %void %atomicStore_726882
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %29 = OpLabel
+ %31 = OpLoad %uint %local_invocation_index_1
+ %30 = OpFunctionCall %void %compute_main_inner %31
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl
new file mode 100644
index 0000000..178d798
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/726882.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicStore_726882() {
+ var arg_1 = 1u;
+ atomicStore(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_726882();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl
new file mode 100644
index 0000000..38caf4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicStore(ptr<workgroup, atomic<i32>, read_write>, i32)
+fn atomicStore_8bea94() {
+ var arg_1 = 1;
+ atomicStore(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_8bea94();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl
new file mode 100644
index 0000000..c0d2497
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicStore_8bea94() {
+ int arg_1 = 1;
+ atomicExchange(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicStore_8bea94();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl
new file mode 100644
index 0000000..35781ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.hlsl
@@ -0,0 +1,26 @@
+groupshared int arg_0;
+
+void atomicStore_8bea94() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedExchange(arg_0, arg_1, atomic_result);
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicStore_8bea94();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl
new file mode 100644
index 0000000..7a984c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicStore_8bea94(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ atomic_store_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicStore_8bea94(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm
new file mode 100644
index 0000000..a0c7fb7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicStore_8bea94 "atomicStore_8bea94"
+ OpName %arg_1 "arg_1"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicStore_8bea94 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %19
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicStore_8bea94
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl
new file mode 100644
index 0000000..d68247e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/8bea94.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicStore_8bea94() {
+ var arg_1 = 1;
+ atomicStore(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_8bea94();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl
new file mode 100644
index 0000000..51e7e1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicStore(ptr<storage, atomic<u32>, read_write>, u32)
+fn atomicStore_cdc29e() {
+ var arg_1 = 1u;
+ atomicStore(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicStore_cdc29e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_cdc29e();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl
new file mode 100644
index 0000000..22fd7a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicStore_cdc29e() {
+ uint arg_1 = 1u;
+ atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicStore_cdc29e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicStore_cdc29e() {
+ uint arg_1 = 1u;
+ atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicStore_cdc29e();
+}
+
+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/atomicStore/cdc29e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.hlsl
new file mode 100644
index 0000000..253ad31
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.hlsl
@@ -0,0 +1,23 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint ignored;
+ buffer.InterlockedExchange(offset, value, ignored);
+}
+
+
+void atomicStore_cdc29e() {
+ uint arg_1 = 1u;
+ tint_atomicStore(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicStore_cdc29e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicStore_cdc29e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl
new file mode 100644
index 0000000..be5057e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicStore_cdc29e(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ atomic_store_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicStore_cdc29e(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicStore_cdc29e(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm
new file mode 100644
index 0000000..f0d74fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.spvasm
@@ -0,0 +1,52 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 25
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicStore_cdc29e "atomicStore_cdc29e"
+ OpName %arg_1 "arg_1"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicStore_cdc29e = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ OpAtomicStore %17 %uint_1 %uint_0 %18
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %atomicStore_cdc29e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicStore_cdc29e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl
new file mode 100644
index 0000000..32a546b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/cdc29e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicStore_cdc29e() {
+ var arg_1 = 1u;
+ atomicStore(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicStore_cdc29e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_cdc29e();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl
new file mode 100644
index 0000000..80db896
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicStore(ptr<storage, atomic<i32>, read_write>, i32)
+fn atomicStore_d1e9a6() {
+ var arg_1 = 1;
+ atomicStore(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicStore_d1e9a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_d1e9a6();
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl
new file mode 100644
index 0000000..f5e52e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicStore_d1e9a6() {
+ int arg_1 = 1;
+ atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicStore_d1e9a6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicStore_d1e9a6() {
+ int arg_1 = 1;
+ atomicExchange(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicStore_d1e9a6();
+}
+
+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/atomicStore/d1e9a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.hlsl
new file mode 100644
index 0000000..bb02128
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.hlsl
@@ -0,0 +1,23 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) {
+ int ignored;
+ buffer.InterlockedExchange(offset, value, ignored);
+}
+
+
+void atomicStore_d1e9a6() {
+ int arg_1 = 1;
+ tint_atomicStore(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicStore_d1e9a6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicStore_d1e9a6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl
new file mode 100644
index 0000000..9ef1a4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicStore_d1e9a6(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ atomic_store_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicStore_d1e9a6(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicStore_d1e9a6(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm
new file mode 100644
index 0000000..5d03e4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 27
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicStore_d1e9a6 "atomicStore_d1e9a6"
+ OpName %arg_1 "arg_1"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicStore_d1e9a6 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ OpAtomicStore %19 %uint_1 %uint_0 %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %atomicStore_d1e9a6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %atomicStore_d1e9a6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl
new file mode 100644
index 0000000..cd1a3a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicStore/d1e9a6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicStore_d1e9a6() {
+ var arg_1 = 1;
+ atomicStore(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicStore_d1e9a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicStore_d1e9a6();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl
new file mode 100644
index 0000000..71c5560
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicSub(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicSub_051100() {
+ var arg_1 = 1;
+ var res: i32 = atomicSub(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicSub_051100();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_051100();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl
new file mode 100644
index 0000000..25f8eba
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicSub_051100() {
+ int arg_1 = 1;
+ int res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicSub_051100();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicSub_051100() {
+ int arg_1 = 1;
+ int res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicSub_051100();
+}
+
+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/atomicSub/051100.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.hlsl
new file mode 100644
index 0000000..eac50d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicSub(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedAdd(offset, -value, original_value);
+ return original_value;
+}
+
+
+void atomicSub_051100() {
+ int arg_1 = 1;
+ int res = tint_atomicSub(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicSub_051100();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicSub_051100();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl
new file mode 100644
index 0000000..695c085
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicSub_051100(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicSub_051100(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicSub_051100(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm
new file mode 100644
index 0000000..3bbf26a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicSub_051100 "atomicSub_051100"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicSub_051100 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicISub %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicSub_051100
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicSub_051100
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl
new file mode 100644
index 0000000..eb49648
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/051100.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicSub_051100() {
+ var arg_1 = 1;
+ var res : i32 = atomicSub(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicSub_051100();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_051100();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl
new file mode 100644
index 0000000..09c7895
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicSub(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicSub_0d26c2() {
+ var arg_1 = 1u;
+ var res: u32 = atomicSub(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_0d26c2();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl
new file mode 100644
index 0000000..739fc9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicSub_0d26c2() {
+ uint arg_1 = 1u;
+ uint res = atomicAdd(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicSub_0d26c2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl
new file mode 100644
index 0000000..abced13
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicSub_0d26c2() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedAdd(arg_0, -arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicSub_0d26c2();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl
new file mode 100644
index 0000000..2f510de
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicSub_0d26c2(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_sub_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicSub_0d26c2(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm
new file mode 100644
index 0000000..2c6b98e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicSub_0d26c2 "atomicSub_0d26c2"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicSub_0d26c2 = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicISub %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicSub_0d26c2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl
new file mode 100644
index 0000000..d907bfb
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/0d26c2.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicSub_0d26c2() {
+ var arg_1 = 1u;
+ var res : u32 = atomicSub(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_0d26c2();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl
new file mode 100644
index 0000000..9caf71e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicSub(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicSub_15bfc9() {
+ var arg_1 = 1u;
+ var res: u32 = atomicSub(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicSub_15bfc9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_15bfc9();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl
new file mode 100644
index 0000000..c21f8f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicSub_15bfc9() {
+ uint arg_1 = 1u;
+ uint res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicSub_15bfc9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicSub_15bfc9() {
+ uint arg_1 = 1u;
+ uint res = atomicAdd(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicSub_15bfc9();
+}
+
+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/atomicSub/15bfc9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.hlsl
new file mode 100644
index 0000000..166f709
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicSub(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedAdd(offset, -value, original_value);
+ return original_value;
+}
+
+
+void atomicSub_15bfc9() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicSub(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicSub_15bfc9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicSub_15bfc9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl
new file mode 100644
index 0000000..c664e5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicSub_15bfc9(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_sub_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicSub_15bfc9(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicSub_15bfc9(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm
new file mode 100644
index 0000000..4d20c6d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicSub_15bfc9 "atomicSub_15bfc9"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicSub_15bfc9 = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicISub %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicSub_15bfc9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicSub_15bfc9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl
new file mode 100644
index 0000000..a48de07
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/15bfc9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicSub_15bfc9() {
+ var arg_1 = 1u;
+ var res : u32 = atomicSub(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicSub_15bfc9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_15bfc9();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl
new file mode 100644
index 0000000..685ed0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicSub(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicSub_77883a() {
+ var arg_1 = 1;
+ var res: i32 = atomicSub(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_77883a();
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl
new file mode 100644
index 0000000..02de7e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicSub_77883a() {
+ int arg_1 = 1;
+ int res = atomicAdd(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicSub_77883a();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl
new file mode 100644
index 0000000..dcc2e25
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicSub_77883a() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedAdd(arg_0, -arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicSub_77883a();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl
new file mode 100644
index 0000000..2e54b64
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicSub_77883a(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_sub_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicSub_77883a(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm
new file mode 100644
index 0000000..d96432d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicSub_77883a "atomicSub_77883a"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicSub_77883a = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicISub %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicSub_77883a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl
new file mode 100644
index 0000000..8603aab
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicSub/77883a.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicSub_77883a() {
+ var arg_1 = 1;
+ var res : i32 = atomicSub(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicSub_77883a();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl
new file mode 100644
index 0000000..e2285df
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<u32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicXor(ptr<storage, atomic<u32>, read_write>, u32) -> u32
+fn atomicXor_54510e() {
+ var arg_1 = 1u;
+ var res: u32 = atomicXor(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicXor_54510e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_54510e();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl
new file mode 100644
index 0000000..7ac4420
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicXor_54510e() {
+ uint arg_1 = 1u;
+ uint res = atomicXor(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicXor_54510e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ uint arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ uint arg_0;
+} sb_rw;
+void atomicXor_54510e() {
+ uint arg_1 = 1u;
+ uint res = atomicXor(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicXor_54510e();
+}
+
+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/atomicXor/54510e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.hlsl
new file mode 100644
index 0000000..d745f12
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+uint tint_atomicXor(RWByteAddressBuffer buffer, uint offset, uint value) {
+ uint original_value = 0;
+ buffer.InterlockedXor(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicXor_54510e() {
+ uint arg_1 = 1u;
+ uint res = tint_atomicXor(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicXor_54510e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicXor_54510e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl
new file mode 100644
index 0000000..fc578f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_uint arg_0;
+};
+
+void atomicXor_54510e(device SB_RW* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicXor_54510e(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicXor_54510e(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm
new file mode 100644
index 0000000..a16daff
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.spvasm
@@ -0,0 +1,55 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 26
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicXor_54510e "atomicXor_54510e"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %uint = OpTypeInt 32 0
+ %SB_RW = OpTypeStruct %uint
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %12 = OpConstantNull %uint
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
+%atomicXor_54510e = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %12
+ %res = OpVariable %_ptr_Function_uint Function %12
+ OpStore %arg_1 %uint_1
+ %17 = OpAccessChain %_ptr_StorageBuffer_uint %sb_rw %uint_0
+ %18 = OpLoad %uint %arg_1
+ %13 = OpAtomicXor %uint %17 %uint_1 %uint_0 %18
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %atomicXor_54510e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %atomicXor_54510e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl
new file mode 100644
index 0000000..fa8ead8
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/54510e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<u32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicXor_54510e() {
+ var arg_1 = 1u;
+ var res : u32 = atomicXor(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicXor_54510e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_54510e();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl
new file mode 100644
index 0000000..55a28e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<i32>;
+
+// fn atomicXor(ptr<workgroup, atomic<i32>, read_write>, i32) -> i32
+fn atomicXor_75dc95() {
+ var arg_1 = 1;
+ var res: i32 = atomicXor(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_75dc95();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl
new file mode 100644
index 0000000..207bfd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared int arg_0;
+void atomicXor_75dc95() {
+ int arg_1 = 1;
+ int res = atomicXor(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0);
+ }
+ barrier();
+ atomicXor_75dc95();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl
new file mode 100644
index 0000000..a93c5dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared int arg_0;
+
+void atomicXor_75dc95() {
+ int arg_1 = 1;
+ int atomic_result = 0;
+ InterlockedXor(arg_0, arg_1, atomic_result);
+ int res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ int atomic_result_1 = 0;
+ InterlockedExchange(arg_0, 0, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicXor_75dc95();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl
new file mode 100644
index 0000000..afad14b
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicXor_75dc95(threadgroup atomic_int* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_xor_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_int* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicXor_75dc95(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_int tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm
new file mode 100644
index 0000000..62e0351
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicXor_75dc95 "atomicXor_75dc95"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+ %int = OpTypeInt 32 1
+%_ptr_Workgroup_int = OpTypePointer Workgroup %int
+ %arg_0 = OpVariable %_ptr_Workgroup_int Workgroup
+ %void = OpTypeVoid
+ %7 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %14 = OpConstantNull %int
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %21 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicXor_75dc95 = OpFunction %void None %7
+ %10 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %14
+ %res = OpVariable %_ptr_Function_int Function %14
+ OpStore %arg_1 %int_1
+ %19 = OpLoad %int %arg_1
+ %15 = OpAtomicXor %int %arg_0 %uint_2 %uint_0 %19
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %21
+%local_invocation_index = OpFunctionParameter %uint
+ %24 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %14
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %29 = OpFunctionCall %void %atomicXor_75dc95
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %7
+ %31 = OpLabel
+ %33 = OpLoad %uint %local_invocation_index_1
+ %32 = OpFunctionCall %void %compute_main_inner %33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl
new file mode 100644
index 0000000..cdba5ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/75dc95.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicXor_75dc95() {
+ var arg_1 = 1;
+ var res : i32 = atomicXor(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_75dc95();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl
new file mode 100644
index 0000000..05bd6f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+struct SB_RW {
+ arg_0: atomic<i32>,
+};
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+// fn atomicXor(ptr<storage, atomic<i32>, read_write>, i32) -> i32
+fn atomicXor_c1b78c() {
+ var arg_1 = 1;
+ var res: i32 = atomicXor(&sb_rw.arg_0, arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicXor_c1b78c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_c1b78c();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl
new file mode 100644
index 0000000..3f8236c
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.glsl
@@ -0,0 +1,46 @@
+#version 310 es
+precision mediump float;
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicXor_c1b78c() {
+ int arg_1 = 1;
+ int res = atomicXor(sb_rw.arg_0, arg_1);
+}
+
+void fragment_main() {
+ atomicXor_c1b78c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct SB_RW {
+ int arg_0;
+};
+
+layout(binding = 0, std430) buffer SB_RW_1 {
+ int arg_0;
+} sb_rw;
+void atomicXor_c1b78c() {
+ int arg_1 = 1;
+ int res = atomicXor(sb_rw.arg_0, arg_1);
+}
+
+void compute_main() {
+ atomicXor_c1b78c();
+}
+
+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/atomicXor/c1b78c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.hlsl
new file mode 100644
index 0000000..df83cd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.hlsl
@@ -0,0 +1,24 @@
+RWByteAddressBuffer sb_rw : register(u0, space0);
+
+int tint_atomicXor(RWByteAddressBuffer buffer, uint offset, int value) {
+ int original_value = 0;
+ buffer.InterlockedXor(offset, value, original_value);
+ return original_value;
+}
+
+
+void atomicXor_c1b78c() {
+ int arg_1 = 1;
+ int res = tint_atomicXor(sb_rw, 0u, arg_1);
+}
+
+void fragment_main() {
+ atomicXor_c1b78c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ atomicXor_c1b78c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl
new file mode 100644
index 0000000..1dba501
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct SB_RW {
+ /* 0x0000 */ atomic_int arg_0;
+};
+
+void atomicXor_c1b78c(device SB_RW* const tint_symbol) {
+ int arg_1 = 1;
+ int res = atomic_fetch_xor_explicit(&((*(tint_symbol)).arg_0), arg_1, memory_order_relaxed);
+}
+
+fragment void fragment_main(device SB_RW* tint_symbol_1 [[buffer(0)]]) {
+ atomicXor_c1b78c(tint_symbol_1);
+ return;
+}
+
+kernel void compute_main(device SB_RW* tint_symbol_2 [[buffer(0)]]) {
+ atomicXor_c1b78c(tint_symbol_2);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm
new file mode 100644
index 0000000..cff5564
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 28
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %SB_RW "SB_RW"
+ OpMemberName %SB_RW 0 "arg_0"
+ OpName %sb_rw "sb_rw"
+ OpName %atomicXor_c1b78c "atomicXor_c1b78c"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %SB_RW Block
+ OpMemberDecorate %SB_RW 0 Offset 0
+ OpDecorate %sb_rw DescriptorSet 0
+ OpDecorate %sb_rw Binding 0
+ %int = OpTypeInt 32 1
+ %SB_RW = OpTypeStruct %int
+%_ptr_StorageBuffer_SB_RW = OpTypePointer StorageBuffer %SB_RW
+ %sb_rw = OpVariable %_ptr_StorageBuffer_SB_RW StorageBuffer
+ %void = OpTypeVoid
+ %5 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %12 = OpConstantNull %int
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
+%atomicXor_c1b78c = OpFunction %void None %5
+ %8 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %12
+ %res = OpVariable %_ptr_Function_int Function %12
+ OpStore %arg_1 %int_1
+ %19 = OpAccessChain %_ptr_StorageBuffer_int %sb_rw %uint_0
+ %20 = OpLoad %int %arg_1
+ %13 = OpAtomicXor %int %19 %uint_1 %uint_0 %20
+ OpStore %res %13
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %5
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %atomicXor_c1b78c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %5
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %atomicXor_c1b78c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl
new file mode 100644
index 0000000..af253ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c1b78c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+struct SB_RW {
+ arg_0 : atomic<i32>,
+}
+
+@group(0) @binding(0) var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicXor_c1b78c() {
+ var arg_1 = 1;
+ var res : i32 = atomicXor(&(sb_rw.arg_0), arg_1);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ atomicXor_c1b78c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_c1b78c();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl
new file mode 100644
index 0000000..14a7921
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl
@@ -0,0 +1,36 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+var<workgroup> arg_0: atomic<u32>;
+
+// fn atomicXor(ptr<workgroup, atomic<u32>, read_write>, u32) -> u32
+fn atomicXor_c8e6be() {
+ var arg_1 = 1u;
+ var res: u32 = atomicXor(&arg_0, arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_c8e6be();
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl
new file mode 100644
index 0000000..36660a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.glsl
@@ -0,0 +1,21 @@
+#version 310 es
+
+shared uint arg_0;
+void atomicXor_c8e6be() {
+ uint arg_1 = 1u;
+ uint res = atomicXor(arg_0, arg_1);
+}
+
+void compute_main(uint local_invocation_index) {
+ {
+ atomicExchange(arg_0, 0u);
+ }
+ barrier();
+ atomicXor_c8e6be();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main(gl_LocalInvocationIndex);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl
new file mode 100644
index 0000000..18b6de7
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.hlsl
@@ -0,0 +1,27 @@
+groupshared uint arg_0;
+
+void atomicXor_c8e6be() {
+ uint arg_1 = 1u;
+ uint atomic_result = 0u;
+ InterlockedXor(arg_0, arg_1, atomic_result);
+ uint res = atomic_result;
+}
+
+struct tint_symbol_1 {
+ uint local_invocation_index : SV_GroupIndex;
+};
+
+void compute_main_inner(uint local_invocation_index) {
+ {
+ uint atomic_result_1 = 0u;
+ InterlockedExchange(arg_0, 0u, atomic_result_1);
+ }
+ GroupMemoryBarrierWithGroupSync();
+ atomicXor_c8e6be();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main(tint_symbol_1 tint_symbol) {
+ compute_main_inner(tint_symbol.local_invocation_index);
+ return;
+}
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl
new file mode 100644
index 0000000..0f81e1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.msl
@@ -0,0 +1,22 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void atomicXor_c8e6be(threadgroup atomic_uint* const tint_symbol) {
+ uint arg_1 = 1u;
+ uint res = atomic_fetch_xor_explicit(tint_symbol, arg_1, memory_order_relaxed);
+}
+
+void compute_main_inner(uint local_invocation_index, threadgroup atomic_uint* const tint_symbol_1) {
+ {
+ atomic_store_explicit(tint_symbol_1, 0u, memory_order_relaxed);
+ }
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+ atomicXor_c8e6be(tint_symbol_1);
+}
+
+kernel void compute_main(uint local_invocation_index [[thread_index_in_threadgroup]]) {
+ threadgroup atomic_uint tint_symbol_2;
+ compute_main_inner(local_invocation_index, &(tint_symbol_2));
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm
new file mode 100644
index 0000000..ba98e8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %local_invocation_index_1 "local_invocation_index_1"
+ OpName %arg_0 "arg_0"
+ OpName %atomicXor_c8e6be "atomicXor_c8e6be"
+ OpName %arg_1 "arg_1"
+ OpName %res "res"
+ OpName %compute_main_inner "compute_main_inner"
+ OpName %local_invocation_index "local_invocation_index"
+ OpName %compute_main "compute_main"
+ OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
+ %uint = OpTypeInt 32 0
+%_ptr_Input_uint = OpTypePointer Input %uint
+%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
+%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
+ %arg_0 = OpVariable %_ptr_Workgroup_uint Workgroup
+ %void = OpTypeVoid
+ %6 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %13 = OpConstantNull %uint
+ %uint_2 = OpConstant %uint 2
+ %uint_0 = OpConstant %uint 0
+ %20 = OpTypeFunction %void %uint
+ %uint_264 = OpConstant %uint 264
+%atomicXor_c8e6be = OpFunction %void None %6
+ %9 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_uint Function %13
+ %res = OpVariable %_ptr_Function_uint Function %13
+ OpStore %arg_1 %uint_1
+ %18 = OpLoad %uint %arg_1
+ %14 = OpAtomicXor %uint %arg_0 %uint_2 %uint_0 %18
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%compute_main_inner = OpFunction %void None %20
+%local_invocation_index = OpFunctionParameter %uint
+ %23 = OpLabel
+ OpAtomicStore %arg_0 %uint_2 %uint_0 %13
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ %28 = OpFunctionCall %void %atomicXor_c8e6be
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %6
+ %30 = OpLabel
+ %32 = OpLoad %uint %local_invocation_index_1
+ %31 = OpFunctionCall %void %compute_main_inner %32
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl
new file mode 100644
index 0000000..7474f6a
--- /dev/null
+++ b/test/tint/builtins/gen/var/atomicXor/c8e6be.wgsl.expected.wgsl
@@ -0,0 +1,11 @@
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicXor_c8e6be() {
+ var arg_1 = 1u;
+ var res : u32 = atomicXor(&(arg_0), arg_1);
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ atomicXor_c8e6be();
+}
diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl
new file mode 100644
index 0000000..3c62e98
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ceil(vec<3, f32>) -> vec<3, f32>
+fn ceil_34064b() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_34064b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_34064b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_34064b();
+}
diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl
new file mode 100644
index 0000000..0ec90da
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void ceil_34064b() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = ceil(arg_0);
+}
+
+vec4 vertex_main() {
+ ceil_34064b();
+ 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;
+
+void ceil_34064b() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = ceil(arg_0);
+}
+
+void fragment_main() {
+ ceil_34064b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ceil_34064b() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = ceil(arg_0);
+}
+
+void compute_main() {
+ ceil_34064b();
+}
+
+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/ceil/34064b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.hlsl
new file mode 100644
index 0000000..3e070fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void ceil_34064b() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ceil_34064b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ceil_34064b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ceil_34064b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl
new file mode 100644
index 0000000..4861263
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ceil_34064b() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ceil_34064b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ceil_34064b();
+ return;
+}
+
+kernel void compute_main() {
+ ceil_34064b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm
new file mode 100644
index 0000000..c66ed70
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %ceil_34064b "ceil_34064b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%ceil_34064b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Ceil %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %ceil_34064b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %ceil_34064b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %ceil_34064b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl
new file mode 100644
index 0000000..39d0fee
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/34064b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn ceil_34064b() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_34064b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_34064b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_34064b();
+}
diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl b/test/tint/builtins/gen/var/ceil/678655.wgsl
new file mode 100644
index 0000000..33d78f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/678655.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ceil(f32) -> f32
+fn ceil_678655() {
+ var arg_0 = 1.0;
+ var res: f32 = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_678655();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_678655();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_678655();
+}
diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl
new file mode 100644
index 0000000..56f09a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void ceil_678655() {
+ float arg_0 = 1.0f;
+ float res = ceil(arg_0);
+}
+
+vec4 vertex_main() {
+ ceil_678655();
+ 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;
+
+void ceil_678655() {
+ float arg_0 = 1.0f;
+ float res = ceil(arg_0);
+}
+
+void fragment_main() {
+ ceil_678655();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ceil_678655() {
+ float arg_0 = 1.0f;
+ float res = ceil(arg_0);
+}
+
+void compute_main() {
+ ceil_678655();
+}
+
+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/ceil/678655.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.hlsl
new file mode 100644
index 0000000..61f3dc0
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void ceil_678655() {
+ float arg_0 = 1.0f;
+ float res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ceil_678655();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ceil_678655();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ceil_678655();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl
new file mode 100644
index 0000000..8714a88
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ceil_678655() {
+ float arg_0 = 1.0f;
+ float res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ceil_678655();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ceil_678655();
+ return;
+}
+
+kernel void compute_main() {
+ ceil_678655();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm
new file mode 100644
index 0000000..465ddd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %ceil_678655 "ceil_678655"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%ceil_678655 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Ceil %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %ceil_678655
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %ceil_678655
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %ceil_678655
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl
new file mode 100644
index 0000000..5a86a32
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/678655.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn ceil_678655() {
+ var arg_0 = 1.0;
+ var res : f32 = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_678655();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_678655();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_678655();
+}
diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl
new file mode 100644
index 0000000..71d5cab
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ceil(vec<2, f32>) -> vec<2, f32>
+fn ceil_96f597() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_96f597();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_96f597();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_96f597();
+}
diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl
new file mode 100644
index 0000000..391c9e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void ceil_96f597() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = ceil(arg_0);
+}
+
+vec4 vertex_main() {
+ ceil_96f597();
+ 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;
+
+void ceil_96f597() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = ceil(arg_0);
+}
+
+void fragment_main() {
+ ceil_96f597();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ceil_96f597() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = ceil(arg_0);
+}
+
+void compute_main() {
+ ceil_96f597();
+}
+
+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/ceil/96f597.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.hlsl
new file mode 100644
index 0000000..828c98a
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void ceil_96f597() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ceil_96f597();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ceil_96f597();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ceil_96f597();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl
new file mode 100644
index 0000000..c7c0200
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ceil_96f597() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ceil_96f597();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ceil_96f597();
+ return;
+}
+
+kernel void compute_main() {
+ ceil_96f597();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm
new file mode 100644
index 0000000..e78d1d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %ceil_96f597 "ceil_96f597"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%ceil_96f597 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Ceil %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %ceil_96f597
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %ceil_96f597
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %ceil_96f597
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7a79c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/96f597.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn ceil_96f597() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_96f597();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_96f597();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_96f597();
+}
diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl
new file mode 100644
index 0000000..7b74614
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ceil(vec<4, f32>) -> vec<4, f32>
+fn ceil_b74c16() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_b74c16();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_b74c16();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_b74c16();
+}
diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl
new file mode 100644
index 0000000..3d4f524
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void ceil_b74c16() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = ceil(arg_0);
+}
+
+vec4 vertex_main() {
+ ceil_b74c16();
+ 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;
+
+void ceil_b74c16() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = ceil(arg_0);
+}
+
+void fragment_main() {
+ ceil_b74c16();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ceil_b74c16() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = ceil(arg_0);
+}
+
+void compute_main() {
+ ceil_b74c16();
+}
+
+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/ceil/b74c16.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.hlsl
new file mode 100644
index 0000000..f660b33
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void ceil_b74c16() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ceil_b74c16();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ceil_b74c16();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ceil_b74c16();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl
new file mode 100644
index 0000000..cb59b28
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ceil_b74c16() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = ceil(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ceil_b74c16();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ceil_b74c16();
+ return;
+}
+
+kernel void compute_main() {
+ ceil_b74c16();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm
new file mode 100644
index 0000000..745b300
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %ceil_b74c16 "ceil_b74c16"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%ceil_b74c16 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Ceil %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %ceil_b74c16
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %ceil_b74c16
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %ceil_b74c16
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl
new file mode 100644
index 0000000..2b573f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/ceil/b74c16.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn ceil_b74c16() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = ceil(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ceil_b74c16();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ceil_b74c16();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ceil_b74c16();
+}
diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl
new file mode 100644
index 0000000..314ca1a
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn clamp_0acf8f() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res: vec2<f32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_0acf8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_0acf8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_0acf8f();
+}
diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl
new file mode 100644
index 0000000..c2877d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_0acf8f() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_0acf8f();
+ 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;
+
+void clamp_0acf8f() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_0acf8f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_0acf8f() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_0acf8f();
+}
+
+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/clamp/0acf8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.hlsl
new file mode 100644
index 0000000..439c442
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_0acf8f() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 arg_2 = (0.0f).xx;
+ float2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_0acf8f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_0acf8f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_0acf8f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl
new file mode 100644
index 0000000..99108a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_0acf8f() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 arg_2 = float2(0.0f);
+ float2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_0acf8f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_0acf8f();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_0acf8f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm
new file mode 100644
index 0000000..0b65aa7
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_0acf8f "clamp_0acf8f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_0acf8f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v2float %arg_0
+ %22 = OpLoad %v2float %arg_1
+ %23 = OpLoad %v2float %arg_2
+ %19 = OpExtInst %v2float %20 NClamp %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %clamp_0acf8f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %clamp_0acf8f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %clamp_0acf8f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl
new file mode 100644
index 0000000..9f954b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/0acf8f.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_0acf8f() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res : vec2<f32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_0acf8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_0acf8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_0acf8f();
+}
diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl
new file mode 100644
index 0000000..52ae09c
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<4, i32>, vec<4, i32>, vec<4, i32>) -> vec<4, i32>
+fn clamp_1a32e3() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = vec4<i32>();
+ var res: vec4<i32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_1a32e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_1a32e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_1a32e3();
+}
diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl
new file mode 100644
index 0000000..72345f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_1a32e3() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 arg_2 = ivec4(0);
+ ivec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_1a32e3();
+ 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;
+
+void clamp_1a32e3() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 arg_2 = ivec4(0);
+ ivec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_1a32e3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_1a32e3() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 arg_2 = ivec4(0);
+ ivec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_1a32e3();
+}
+
+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/clamp/1a32e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.hlsl
new file mode 100644
index 0000000..824f7f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_1a32e3() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ int4 arg_2 = (0).xxxx;
+ int4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_1a32e3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_1a32e3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_1a32e3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl
new file mode 100644
index 0000000..1804666
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_1a32e3() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ int4 arg_2 = int4(0);
+ int4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_1a32e3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_1a32e3();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_1a32e3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm
new file mode 100644
index 0000000..576948f
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_1a32e3 "clamp_1a32e3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_1a32e3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %22 = OpLoad %v4int %arg_0
+ %23 = OpLoad %v4int %arg_1
+ %24 = OpLoad %v4int %arg_2
+ %20 = OpExtInst %v4int %21 SClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_1a32e3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_1a32e3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_1a32e3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl
new file mode 100644
index 0000000..6c2345e
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/1a32e3.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_1a32e3() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = vec4<i32>();
+ var res : vec4<i32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_1a32e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_1a32e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_1a32e3();
+}
diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl
new file mode 100644
index 0000000..8c1abc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(f32, f32, f32) -> f32
+fn clamp_2bd567() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res: f32 = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_2bd567();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_2bd567();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_2bd567();
+}
diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl
new file mode 100644
index 0000000..a152ab2
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_2bd567() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_2bd567();
+ 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;
+
+void clamp_2bd567() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_2bd567();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_2bd567() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_2bd567();
+}
+
+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/clamp/2bd567.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.hlsl
new file mode 100644
index 0000000..6584447
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_2bd567() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_2bd567();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_2bd567();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_2bd567();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl
new file mode 100644
index 0000000..033fc2a
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_2bd567() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_2bd567();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_2bd567();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_2bd567();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm
new file mode 100644
index 0000000..0319b1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_2bd567 "clamp_2bd567"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpTypeFunction %v4float
+%clamp_2bd567 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ OpStore %arg_2 %float_1
+ %20 = OpLoad %float %arg_0
+ %21 = OpLoad %float %arg_1
+ %22 = OpLoad %float %arg_2
+ %18 = OpExtInst %float %19 NClamp %20 %21 %22
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %clamp_2bd567
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %clamp_2bd567
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_2bd567
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl
new file mode 100644
index 0000000..44a3ecd
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bd567.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_2bd567() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res : f32 = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_2bd567();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_2bd567();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_2bd567();
+}
diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl
new file mode 100644
index 0000000..f542172
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn clamp_2bde41() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res: vec4<f32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_2bde41();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_2bde41();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_2bde41();
+}
diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl
new file mode 100644
index 0000000..d8b0d40
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_2bde41() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_2bde41();
+ 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;
+
+void clamp_2bde41() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_2bde41();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_2bde41() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_2bde41();
+}
+
+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/clamp/2bde41.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.hlsl
new file mode 100644
index 0000000..d7d8d54
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_2bde41() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 arg_2 = (0.0f).xxxx;
+ float4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_2bde41();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_2bde41();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_2bde41();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl
new file mode 100644
index 0000000..c116dd7
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_2bde41() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 arg_2 = float4(0.0f);
+ float4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_2bde41();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_2bde41();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_2bde41();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm
new file mode 100644
index 0000000..f8b46a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_2bde41 "clamp_2bde41"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_2bde41 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %5
+ %19 = OpLoad %v4float %arg_0
+ %20 = OpLoad %v4float %arg_1
+ %21 = OpLoad %v4float %arg_2
+ %17 = OpExtInst %v4float %18 NClamp %19 %20 %21
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %clamp_2bde41
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %clamp_2bde41
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_2bde41
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl
new file mode 100644
index 0000000..2a3dcf5
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/2bde41.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_2bde41() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res : vec4<f32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_2bde41();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_2bde41();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_2bde41();
+}
diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl
new file mode 100644
index 0000000..9ea35b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<3, u32>, vec<3, u32>, vec<3, u32>) -> vec<3, u32>
+fn clamp_548fc7() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = vec3<u32>();
+ var res: vec3<u32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_548fc7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_548fc7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_548fc7();
+}
diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl
new file mode 100644
index 0000000..9668757
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_548fc7() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 arg_2 = uvec3(0u);
+ uvec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_548fc7();
+ 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;
+
+void clamp_548fc7() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 arg_2 = uvec3(0u);
+ uvec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_548fc7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_548fc7() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 arg_2 = uvec3(0u);
+ uvec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_548fc7();
+}
+
+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/clamp/548fc7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.hlsl
new file mode 100644
index 0000000..e74913b
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_548fc7() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ uint3 arg_2 = (0u).xxx;
+ uint3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_548fc7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_548fc7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_548fc7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl
new file mode 100644
index 0000000..b1b6736
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_548fc7() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ uint3 arg_2 = uint3(0u);
+ uint3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_548fc7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_548fc7();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_548fc7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm
new file mode 100644
index 0000000..80218b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_548fc7 "clamp_548fc7"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_548fc7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %22 = OpLoad %v3uint %arg_0
+ %23 = OpLoad %v3uint %arg_1
+ %24 = OpLoad %v3uint %arg_2
+ %20 = OpExtInst %v3uint %21 UClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_548fc7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_548fc7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_548fc7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl
new file mode 100644
index 0000000..bf9f086
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/548fc7.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_548fc7() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = vec3<u32>();
+ var res : vec3<u32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_548fc7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_548fc7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_548fc7();
+}
diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl
new file mode 100644
index 0000000..96b23a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<3, i32>, vec<3, i32>, vec<3, i32>) -> vec<3, i32>
+fn clamp_5f0819() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec3<i32>();
+ var res: vec3<i32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_5f0819();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_5f0819();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_5f0819();
+}
diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl
new file mode 100644
index 0000000..c33d7f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_5f0819() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 arg_2 = ivec3(0);
+ ivec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_5f0819();
+ 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;
+
+void clamp_5f0819() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 arg_2 = ivec3(0);
+ ivec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_5f0819();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_5f0819() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 arg_2 = ivec3(0);
+ ivec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_5f0819();
+}
+
+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/clamp/5f0819.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.hlsl
new file mode 100644
index 0000000..b09cac0
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_5f0819() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ int3 arg_2 = (0).xxx;
+ int3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_5f0819();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_5f0819();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_5f0819();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl
new file mode 100644
index 0000000..dee705b
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_5f0819() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ int3 arg_2 = int3(0);
+ int3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_5f0819();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_5f0819();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_5f0819();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm
new file mode 100644
index 0000000..9006081
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_5f0819 "clamp_5f0819"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_5f0819 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_2 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %22 = OpLoad %v3int %arg_0
+ %23 = OpLoad %v3int %arg_1
+ %24 = OpLoad %v3int %arg_2
+ %20 = OpExtInst %v3int %21 SClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_5f0819
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_5f0819
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_5f0819
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl
new file mode 100644
index 0000000..8a70766
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/5f0819.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_5f0819() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec3<i32>();
+ var res : vec3<i32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_5f0819();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_5f0819();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_5f0819();
+}
diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl
new file mode 100644
index 0000000..fdb16e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<2, i32>, vec<2, i32>, vec<2, i32>) -> vec<2, i32>
+fn clamp_6c1749() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec2<i32>();
+ var res: vec2<i32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_6c1749();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_6c1749();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_6c1749();
+}
diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl
new file mode 100644
index 0000000..f1d0fbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_6c1749() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 arg_2 = ivec2(0);
+ ivec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_6c1749();
+ 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;
+
+void clamp_6c1749() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 arg_2 = ivec2(0);
+ ivec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_6c1749();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_6c1749() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 arg_2 = ivec2(0);
+ ivec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_6c1749();
+}
+
+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/clamp/6c1749.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.hlsl
new file mode 100644
index 0000000..934e1d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_6c1749() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ int2 arg_2 = (0).xx;
+ int2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_6c1749();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_6c1749();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_6c1749();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl
new file mode 100644
index 0000000..0faacb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_6c1749() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ int2 arg_2 = int2(0);
+ int2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_6c1749();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_6c1749();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_6c1749();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm
new file mode 100644
index 0000000..643fab2
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_6c1749 "clamp_6c1749"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_6c1749 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_2 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %22 = OpLoad %v2int %arg_0
+ %23 = OpLoad %v2int %arg_1
+ %24 = OpLoad %v2int %arg_2
+ %20 = OpExtInst %v2int %21 SClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_6c1749
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_6c1749
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_6c1749
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl
new file mode 100644
index 0000000..f2882ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/6c1749.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_6c1749() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec2<i32>();
+ var res : vec2<i32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_6c1749();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_6c1749();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_6c1749();
+}
diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl
new file mode 100644
index 0000000..c708aeb
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<2, u32>, vec<2, u32>, vec<2, u32>) -> vec<2, u32>
+fn clamp_7706d7() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = vec2<u32>();
+ var res: vec2<u32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_7706d7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_7706d7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_7706d7();
+}
diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl
new file mode 100644
index 0000000..643a553
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_7706d7() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 arg_2 = uvec2(0u);
+ uvec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_7706d7();
+ 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;
+
+void clamp_7706d7() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 arg_2 = uvec2(0u);
+ uvec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_7706d7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_7706d7() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 arg_2 = uvec2(0u);
+ uvec2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_7706d7();
+}
+
+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/clamp/7706d7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.hlsl
new file mode 100644
index 0000000..89aea9d
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_7706d7() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ uint2 arg_2 = (0u).xx;
+ uint2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_7706d7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_7706d7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_7706d7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl
new file mode 100644
index 0000000..1655a2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_7706d7() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ uint2 arg_2 = uint2(0u);
+ uint2 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_7706d7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_7706d7();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_7706d7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm
new file mode 100644
index 0000000..8f20cea
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_7706d7 "clamp_7706d7"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_7706d7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %22 = OpLoad %v2uint %arg_0
+ %23 = OpLoad %v2uint %arg_1
+ %24 = OpLoad %v2uint %arg_2
+ %20 = OpExtInst %v2uint %21 UClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_7706d7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_7706d7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_7706d7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl
new file mode 100644
index 0000000..cde513d
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/7706d7.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_7706d7() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = vec2<u32>();
+ var res : vec2<u32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_7706d7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_7706d7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_7706d7();
+}
diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl b/test/tint/builtins/gen/var/clamp/867397.wgsl
new file mode 100644
index 0000000..8b545a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/867397.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn clamp_867397() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res: vec3<f32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_867397();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_867397();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_867397();
+}
diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl
new file mode 100644
index 0000000..73c0f82
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_867397() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_867397();
+ 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;
+
+void clamp_867397() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_867397();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_867397() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_867397();
+}
+
+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/clamp/867397.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.hlsl
new file mode 100644
index 0000000..5a3607e
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_867397() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 arg_2 = (0.0f).xxx;
+ float3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_867397();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_867397();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_867397();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl
new file mode 100644
index 0000000..b722368
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_867397() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 arg_2 = float3(0.0f);
+ float3 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_867397();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_867397();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_867397();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm
new file mode 100644
index 0000000..a27fcf4
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_867397 "clamp_867397"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_867397 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v3float %arg_0
+ %22 = OpLoad %v3float %arg_1
+ %23 = OpLoad %v3float %arg_2
+ %19 = OpExtInst %v3float %20 NClamp %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %clamp_867397
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %clamp_867397
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %clamp_867397
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl
new file mode 100644
index 0000000..a175b66
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/867397.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_867397() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res : vec3<f32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_867397();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_867397();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_867397();
+}
diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl
new file mode 100644
index 0000000..76d9689
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(u32, u32, u32) -> u32
+fn clamp_a2de25() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: u32 = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_a2de25();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_a2de25();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_a2de25();
+}
diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl
new file mode 100644
index 0000000..93c876b
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_a2de25() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_a2de25();
+ 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;
+
+void clamp_a2de25() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_a2de25();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_a2de25() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_a2de25();
+}
+
+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/clamp/a2de25.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.hlsl
new file mode 100644
index 0000000..ec730da
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_a2de25() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_a2de25();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_a2de25();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_a2de25();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl
new file mode 100644
index 0000000..e22ed1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_a2de25() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_a2de25();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_a2de25();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_a2de25();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm
new file mode 100644
index 0000000..3e53f30
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_a2de25 "clamp_a2de25"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_a2de25 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %arg_1 = OpVariable %_ptr_Function_uint Function %17
+ %arg_2 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %22 = OpLoad %uint %arg_0
+ %23 = OpLoad %uint %arg_1
+ %24 = OpLoad %uint %arg_2
+ %20 = OpExtInst %uint %21 UClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_a2de25
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_a2de25
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_a2de25
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl
new file mode 100644
index 0000000..33b39e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/a2de25.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_a2de25() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : u32 = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_a2de25();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_a2de25();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_a2de25();
+}
diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl
new file mode 100644
index 0000000..be73d24
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(i32, i32, i32) -> i32
+fn clamp_b07c65() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res: i32 = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_b07c65();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_b07c65();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_b07c65();
+}
diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl
new file mode 100644
index 0000000..4e79afe
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_b07c65() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int arg_2 = 1;
+ int res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_b07c65();
+ 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;
+
+void clamp_b07c65() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int arg_2 = 1;
+ int res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_b07c65();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_b07c65() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int arg_2 = 1;
+ int res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_b07c65();
+}
+
+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/clamp/b07c65.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.hlsl
new file mode 100644
index 0000000..42208eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_b07c65() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int arg_2 = 1;
+ int res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_b07c65();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_b07c65();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_b07c65();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl
new file mode 100644
index 0000000..90b191c
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_b07c65() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int arg_2 = 1;
+ int res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_b07c65();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_b07c65();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_b07c65();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm
new file mode 100644
index 0000000..e593502
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_b07c65 "clamp_b07c65"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_b07c65 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %arg_2 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %int_1
+ %22 = OpLoad %int %arg_0
+ %23 = OpLoad %int %arg_1
+ %24 = OpLoad %int %arg_2
+ %20 = OpExtInst %int %21 SClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_b07c65
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_b07c65
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_b07c65
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl
new file mode 100644
index 0000000..7e9b627
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/b07c65.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_b07c65() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var arg_2 = 1;
+ var res : i32 = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_b07c65();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_b07c65();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_b07c65();
+}
diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl
new file mode 100644
index 0000000..1c3d300
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn clamp(vec<4, u32>, vec<4, u32>, vec<4, u32>) -> vec<4, u32>
+fn clamp_bd43ce() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = vec4<u32>();
+ var res: vec4<u32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_bd43ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_bd43ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_bd43ce();
+}
diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl
new file mode 100644
index 0000000..37aca59
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void clamp_bd43ce() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 arg_2 = uvec4(0u);
+ uvec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ clamp_bd43ce();
+ 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;
+
+void clamp_bd43ce() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 arg_2 = uvec4(0u);
+ uvec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ clamp_bd43ce();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void clamp_bd43ce() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 arg_2 = uvec4(0u);
+ uvec4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ clamp_bd43ce();
+}
+
+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/clamp/bd43ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.hlsl
new file mode 100644
index 0000000..44a9592
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void clamp_bd43ce() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ uint4 arg_2 = (0u).xxxx;
+ uint4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ clamp_bd43ce();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ clamp_bd43ce();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ clamp_bd43ce();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl
new file mode 100644
index 0000000..a20ab6d
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void clamp_bd43ce() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ uint4 arg_2 = uint4(0u);
+ uint4 res = clamp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ clamp_bd43ce();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ clamp_bd43ce();
+ return;
+}
+
+kernel void compute_main() {
+ clamp_bd43ce();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm
new file mode 100644
index 0000000..c4c81a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %clamp_bd43ce "clamp_bd43ce"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%clamp_bd43ce = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %22 = OpLoad %v4uint %arg_0
+ %23 = OpLoad %v4uint %arg_1
+ %24 = OpLoad %v4uint %arg_2
+ %20 = OpExtInst %v4uint %21 UClamp %22 %23 %24
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %clamp_bd43ce
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %clamp_bd43ce
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %clamp_bd43ce
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl
new file mode 100644
index 0000000..e3cd79c
--- /dev/null
+++ b/test/tint/builtins/gen/var/clamp/bd43ce.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn clamp_bd43ce() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = vec4<u32>();
+ var res : vec4<u32> = clamp(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ clamp_bd43ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ clamp_bd43ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ clamp_bd43ce();
+}
diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl
new file mode 100644
index 0000000..05cfa56
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cos(vec<3, f32>) -> vec<3, f32>
+fn cos_16dc15() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_16dc15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_16dc15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_16dc15();
+}
diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl
new file mode 100644
index 0000000..21b1448
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cos_16dc15() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = cos(arg_0);
+}
+
+vec4 vertex_main() {
+ cos_16dc15();
+ 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;
+
+void cos_16dc15() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = cos(arg_0);
+}
+
+void fragment_main() {
+ cos_16dc15();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cos_16dc15() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = cos(arg_0);
+}
+
+void compute_main() {
+ cos_16dc15();
+}
+
+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/cos/16dc15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.hlsl
new file mode 100644
index 0000000..73f5a2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cos_16dc15() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cos_16dc15();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cos_16dc15();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cos_16dc15();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl
new file mode 100644
index 0000000..a93875e
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cos_16dc15() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cos_16dc15();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cos_16dc15();
+ return;
+}
+
+kernel void compute_main() {
+ cos_16dc15();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm
new file mode 100644
index 0000000..d230830
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %cos_16dc15 "cos_16dc15"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %cos_16dc15 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Cos %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %cos_16dc15
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %cos_16dc15
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %cos_16dc15
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl
new file mode 100644
index 0000000..9c71b86
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/16dc15.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cos_16dc15() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_16dc15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_16dc15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_16dc15();
+}
diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl
new file mode 100644
index 0000000..9490acc
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cos(vec<4, f32>) -> vec<4, f32>
+fn cos_29d66d() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_29d66d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_29d66d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_29d66d();
+}
diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl
new file mode 100644
index 0000000..65c8035
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cos_29d66d() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = cos(arg_0);
+}
+
+vec4 vertex_main() {
+ cos_29d66d();
+ 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;
+
+void cos_29d66d() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = cos(arg_0);
+}
+
+void fragment_main() {
+ cos_29d66d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cos_29d66d() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = cos(arg_0);
+}
+
+void compute_main() {
+ cos_29d66d();
+}
+
+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/cos/29d66d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.hlsl
new file mode 100644
index 0000000..9a9e05e
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cos_29d66d() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cos_29d66d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cos_29d66d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cos_29d66d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl
new file mode 100644
index 0000000..6f3ca2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cos_29d66d() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cos_29d66d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cos_29d66d();
+ return;
+}
+
+kernel void compute_main() {
+ cos_29d66d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm
new file mode 100644
index 0000000..8c921e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %cos_29d66d "cos_29d66d"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %cos_29d66d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Cos %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %cos_29d66d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %cos_29d66d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %cos_29d66d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl
new file mode 100644
index 0000000..7d9b60e
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/29d66d.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cos_29d66d() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_29d66d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_29d66d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_29d66d();
+}
diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl
new file mode 100644
index 0000000..263bdec
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cos(vec<2, f32>) -> vec<2, f32>
+fn cos_c3b486() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_c3b486();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_c3b486();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_c3b486();
+}
diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl
new file mode 100644
index 0000000..03fb395
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cos_c3b486() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = cos(arg_0);
+}
+
+vec4 vertex_main() {
+ cos_c3b486();
+ 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;
+
+void cos_c3b486() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = cos(arg_0);
+}
+
+void fragment_main() {
+ cos_c3b486();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cos_c3b486() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = cos(arg_0);
+}
+
+void compute_main() {
+ cos_c3b486();
+}
+
+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/cos/c3b486.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.hlsl
new file mode 100644
index 0000000..cd82afc
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cos_c3b486() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cos_c3b486();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cos_c3b486();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cos_c3b486();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl
new file mode 100644
index 0000000..4e0e3b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cos_c3b486() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cos_c3b486();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cos_c3b486();
+ return;
+}
+
+kernel void compute_main() {
+ cos_c3b486();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm
new file mode 100644
index 0000000..a4bb57f
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %cos_c3b486 "cos_c3b486"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %cos_c3b486 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Cos %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %cos_c3b486
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %cos_c3b486
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %cos_c3b486
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl
new file mode 100644
index 0000000..fab94da
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c3b486.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cos_c3b486() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_c3b486();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_c3b486();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_c3b486();
+}
diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl
new file mode 100644
index 0000000..b94af03
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cos(f32) -> f32
+fn cos_c5c28e() {
+ var arg_0 = 1.0;
+ var res: f32 = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_c5c28e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_c5c28e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_c5c28e();
+}
diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl
new file mode 100644
index 0000000..cb5df10
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cos_c5c28e() {
+ float arg_0 = 1.0f;
+ float res = cos(arg_0);
+}
+
+vec4 vertex_main() {
+ cos_c5c28e();
+ 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;
+
+void cos_c5c28e() {
+ float arg_0 = 1.0f;
+ float res = cos(arg_0);
+}
+
+void fragment_main() {
+ cos_c5c28e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cos_c5c28e() {
+ float arg_0 = 1.0f;
+ float res = cos(arg_0);
+}
+
+void compute_main() {
+ cos_c5c28e();
+}
+
+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/cos/c5c28e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.hlsl
new file mode 100644
index 0000000..d5e81f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cos_c5c28e() {
+ float arg_0 = 1.0f;
+ float res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cos_c5c28e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cos_c5c28e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cos_c5c28e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl
new file mode 100644
index 0000000..2eeca23
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cos_c5c28e() {
+ float arg_0 = 1.0f;
+ float res = cos(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cos_c5c28e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cos_c5c28e();
+ return;
+}
+
+kernel void compute_main() {
+ cos_c5c28e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm
new file mode 100644
index 0000000..e109113
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %cos_c5c28e "cos_c5c28e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %cos_c5c28e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Cos %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %cos_c5c28e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %cos_c5c28e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %cos_c5c28e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl
new file mode 100644
index 0000000..c6854ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/cos/c5c28e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cos_c5c28e() {
+ var arg_0 = 1.0;
+ var res : f32 = cos(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cos_c5c28e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cos_c5c28e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cos_c5c28e();
+}
diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl
new file mode 100644
index 0000000..b6fdb2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/377652.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cosh(vec<3, f32>) -> vec<3, f32>
+fn cosh_377652() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_377652();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_377652();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_377652();
+}
diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl
new file mode 100644
index 0000000..bd306d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cosh_377652() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = cosh(arg_0);
+}
+
+vec4 vertex_main() {
+ cosh_377652();
+ 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;
+
+void cosh_377652() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = cosh(arg_0);
+}
+
+void fragment_main() {
+ cosh_377652();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cosh_377652() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = cosh(arg_0);
+}
+
+void compute_main() {
+ cosh_377652();
+}
+
+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/cosh/377652.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.hlsl
new file mode 100644
index 0000000..4b6ec3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cosh_377652() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cosh_377652();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cosh_377652();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cosh_377652();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl
new file mode 100644
index 0000000..e177d54
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cosh_377652() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cosh_377652();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cosh_377652();
+ return;
+}
+
+kernel void compute_main() {
+ cosh_377652();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm
new file mode 100644
index 0000000..4007fb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %cosh_377652 "cosh_377652"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%cosh_377652 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Cosh %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %cosh_377652
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %cosh_377652
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %cosh_377652
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl
new file mode 100644
index 0000000..308581e
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/377652.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cosh_377652() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_377652();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_377652();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_377652();
+}
diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl
new file mode 100644
index 0000000..898d074
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cosh(vec<2, f32>) -> vec<2, f32>
+fn cosh_c13756() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_c13756();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_c13756();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_c13756();
+}
diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl
new file mode 100644
index 0000000..4d9ef69
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cosh_c13756() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = cosh(arg_0);
+}
+
+vec4 vertex_main() {
+ cosh_c13756();
+ 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;
+
+void cosh_c13756() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = cosh(arg_0);
+}
+
+void fragment_main() {
+ cosh_c13756();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cosh_c13756() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = cosh(arg_0);
+}
+
+void compute_main() {
+ cosh_c13756();
+}
+
+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/cosh/c13756.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.hlsl
new file mode 100644
index 0000000..1c53a74
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cosh_c13756() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cosh_c13756();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cosh_c13756();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cosh_c13756();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl
new file mode 100644
index 0000000..4ce9fd6
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cosh_c13756() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cosh_c13756();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cosh_c13756();
+ return;
+}
+
+kernel void compute_main() {
+ cosh_c13756();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm
new file mode 100644
index 0000000..faad534
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %cosh_c13756 "cosh_c13756"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%cosh_c13756 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Cosh %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %cosh_c13756
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %cosh_c13756
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %cosh_c13756
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl
new file mode 100644
index 0000000..41a6061
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/c13756.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cosh_c13756() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_c13756();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_c13756();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_c13756();
+}
diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl
new file mode 100644
index 0000000..fc2f3a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cosh(f32) -> f32
+fn cosh_da92dd() {
+ var arg_0 = 1.0;
+ var res: f32 = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_da92dd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_da92dd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_da92dd();
+}
diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl
new file mode 100644
index 0000000..f87144f
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cosh_da92dd() {
+ float arg_0 = 1.0f;
+ float res = cosh(arg_0);
+}
+
+vec4 vertex_main() {
+ cosh_da92dd();
+ 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;
+
+void cosh_da92dd() {
+ float arg_0 = 1.0f;
+ float res = cosh(arg_0);
+}
+
+void fragment_main() {
+ cosh_da92dd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cosh_da92dd() {
+ float arg_0 = 1.0f;
+ float res = cosh(arg_0);
+}
+
+void compute_main() {
+ cosh_da92dd();
+}
+
+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/cosh/da92dd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.hlsl
new file mode 100644
index 0000000..657c3dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cosh_da92dd() {
+ float arg_0 = 1.0f;
+ float res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cosh_da92dd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cosh_da92dd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cosh_da92dd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl
new file mode 100644
index 0000000..ed4cc47
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cosh_da92dd() {
+ float arg_0 = 1.0f;
+ float res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cosh_da92dd();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cosh_da92dd();
+ return;
+}
+
+kernel void compute_main() {
+ cosh_da92dd();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm
new file mode 100644
index 0000000..c82b34f
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %cosh_da92dd "cosh_da92dd"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%cosh_da92dd = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Cosh %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %cosh_da92dd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %cosh_da92dd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %cosh_da92dd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl
new file mode 100644
index 0000000..5a09829
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/da92dd.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cosh_da92dd() {
+ var arg_0 = 1.0;
+ var res : f32 = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_da92dd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_da92dd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_da92dd();
+}
diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl
new file mode 100644
index 0000000..926fd67
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cosh(vec<4, f32>) -> vec<4, f32>
+fn cosh_e0c1de() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_e0c1de();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_e0c1de();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_e0c1de();
+}
diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl
new file mode 100644
index 0000000..713d23d
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void cosh_e0c1de() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = cosh(arg_0);
+}
+
+vec4 vertex_main() {
+ cosh_e0c1de();
+ 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;
+
+void cosh_e0c1de() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = cosh(arg_0);
+}
+
+void fragment_main() {
+ cosh_e0c1de();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cosh_e0c1de() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = cosh(arg_0);
+}
+
+void compute_main() {
+ cosh_e0c1de();
+}
+
+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/cosh/e0c1de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.hlsl
new file mode 100644
index 0000000..57edfcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void cosh_e0c1de() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cosh_e0c1de();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cosh_e0c1de();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cosh_e0c1de();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl
new file mode 100644
index 0000000..dba84b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cosh_e0c1de() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = cosh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cosh_e0c1de();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cosh_e0c1de();
+ return;
+}
+
+kernel void compute_main() {
+ cosh_e0c1de();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm
new file mode 100644
index 0000000..b788bac
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %cosh_e0c1de "cosh_e0c1de"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%cosh_e0c1de = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Cosh %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %cosh_e0c1de
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %cosh_e0c1de
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %cosh_e0c1de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl
new file mode 100644
index 0000000..51b4fd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/cosh/e0c1de.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn cosh_e0c1de() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = cosh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cosh_e0c1de();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cosh_e0c1de();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cosh_e0c1de();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl
new file mode 100644
index 0000000..40b1848
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(u32) -> u32
+fn countLeadingZeros_208d46() {
+ var arg_0 = 1u;
+ var res: u32 = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_208d46();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_208d46();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_208d46();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl
new file mode 100644
index 0000000..d416594
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uint tint_count_leading_zeros(uint v) {
+ uint x = uint(v);
+ uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_208d46() {
+ uint arg_0 = 1u;
+ uint res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_208d46();
+ 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;
+
+uint tint_count_leading_zeros(uint v) {
+ uint x = uint(v);
+ uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_208d46() {
+ uint arg_0 = 1u;
+ uint res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_208d46();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_count_leading_zeros(uint v) {
+ uint x = uint(v);
+ uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_208d46() {
+ uint arg_0 = 1u;
+ uint res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_208d46();
+}
+
+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/countLeadingZeros/208d46.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.hlsl
new file mode 100644
index 0000000..65bbec9
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint tint_count_leading_zeros(uint v) {
+ uint x = uint(v);
+ const uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ const uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ const uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ const uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ const uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ const uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_208d46() {
+ uint arg_0 = 1u;
+ uint res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_208d46();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_208d46();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_208d46();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl
new file mode 100644
index 0000000..545a925
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_208d46() {
+ uint arg_0 = 1u;
+ uint res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_208d46();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_208d46();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_208d46();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm
new file mode 100644
index 0000000..8fb26d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.spvasm
@@ -0,0 +1,127 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 83
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_208d46 "countLeadingZeros_208d46"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %uint %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %uint_65535 = OpConstant %uint 65535
+ %bool = OpTypeBool
+ %uint_16 = OpConstant %uint 16
+%uint_16777215 = OpConstant %uint 16777215
+ %uint_8 = OpConstant %uint 8
+%uint_268435455 = OpConstant %uint 268435455
+ %uint_4 = OpConstant %uint 4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %uint_2 = OpConstant %uint 2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %uint_1 = OpConstant %uint 1
+ %void = OpTypeVoid
+ %61 = OpTypeFunction %void
+ %69 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %uint None %9
+ %v = OpFunctionParameter %uint
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %17
+ OpStore %x %v
+ %19 = OpLoad %uint %x
+ %21 = OpULessThanEqual %bool %19 %uint_65535
+ %18 = OpSelect %uint %21 %uint_16 %17
+ %24 = OpLoad %uint %x
+ %25 = OpShiftLeftLogical %uint %24 %18
+ OpStore %x %25
+ %27 = OpLoad %uint %x
+ %29 = OpULessThanEqual %bool %27 %uint_16777215
+ %26 = OpSelect %uint %29 %uint_8 %17
+ %31 = OpLoad %uint %x
+ %32 = OpShiftLeftLogical %uint %31 %26
+ OpStore %x %32
+ %34 = OpLoad %uint %x
+ %36 = OpULessThanEqual %bool %34 %uint_268435455
+ %33 = OpSelect %uint %36 %uint_4 %17
+ %38 = OpLoad %uint %x
+ %39 = OpShiftLeftLogical %uint %38 %33
+ OpStore %x %39
+ %41 = OpLoad %uint %x
+ %43 = OpULessThanEqual %bool %41 %uint_1073741823
+ %40 = OpSelect %uint %43 %uint_2 %17
+ %45 = OpLoad %uint %x
+ %46 = OpShiftLeftLogical %uint %45 %40
+ OpStore %x %46
+ %48 = OpLoad %uint %x
+ %50 = OpULessThanEqual %bool %48 %uint_2147483647
+ %47 = OpSelect %uint %50 %uint_1 %17
+ %53 = OpLoad %uint %x
+ %54 = OpIEqual %bool %53 %17
+ %52 = OpSelect %uint %54 %uint_1 %17
+ %56 = OpBitwiseOr %uint %18 %26
+ %57 = OpBitwiseOr %uint %56 %33
+ %58 = OpBitwiseOr %uint %57 %40
+ %59 = OpBitwiseOr %uint %58 %47
+ %60 = OpIAdd %uint %59 %52
+ OpReturnValue %60
+ OpFunctionEnd
+%countLeadingZeros_208d46 = OpFunction %void None %61
+ %64 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ %67 = OpLoad %uint %arg_0
+ %66 = OpFunctionCall %uint %tint_count_leading_zeros %67
+ OpStore %res %66
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %69
+ %71 = OpLabel
+ %72 = OpFunctionCall %void %countLeadingZeros_208d46
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %61
+ %74 = OpLabel
+ %75 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %75
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %61
+ %78 = OpLabel
+ %79 = OpFunctionCall %void %countLeadingZeros_208d46
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %61
+ %81 = OpLabel
+ %82 = OpFunctionCall %void %countLeadingZeros_208d46
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl
new file mode 100644
index 0000000..052dd97
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/208d46.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_208d46() {
+ var arg_0 = 1u;
+ var res : u32 = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_208d46();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_208d46();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_208d46();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl
new file mode 100644
index 0000000..db877ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(i32) -> i32
+fn countLeadingZeros_6d4656() {
+ var arg_0 = 1;
+ var res: i32 = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_6d4656();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_6d4656();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_6d4656();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl
new file mode 100644
index 0000000..4e140af
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+int tint_count_leading_zeros(int v) {
+ uint x = uint(v);
+ uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_6d4656() {
+ int arg_0 = 1;
+ int res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_6d4656();
+ 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;
+
+int tint_count_leading_zeros(int v) {
+ uint x = uint(v);
+ uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_6d4656() {
+ int arg_0 = 1;
+ int res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_6d4656();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_count_leading_zeros(int v) {
+ uint x = uint(v);
+ uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_6d4656() {
+ int arg_0 = 1;
+ int res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_6d4656();
+}
+
+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/countLeadingZeros/6d4656.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.hlsl
new file mode 100644
index 0000000..ddf54fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int tint_count_leading_zeros(int v) {
+ uint x = uint(v);
+ const uint b16 = ((x <= 65535u) ? 16u : 0u);
+ x = (x << b16);
+ const uint b8 = ((x <= 16777215u) ? 8u : 0u);
+ x = (x << b8);
+ const uint b4 = ((x <= 268435455u) ? 4u : 0u);
+ x = (x << b4);
+ const uint b2 = ((x <= 1073741823u) ? 2u : 0u);
+ x = (x << b2);
+ const uint b1 = ((x <= 2147483647u) ? 1u : 0u);
+ const uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_6d4656() {
+ int arg_0 = 1;
+ int res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_6d4656();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_6d4656();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_6d4656();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl
new file mode 100644
index 0000000..260714f
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_6d4656() {
+ int arg_0 = 1;
+ int res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_6d4656();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_6d4656();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_6d4656();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm
new file mode 100644
index 0000000..558ca73
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.spvasm
@@ -0,0 +1,133 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 87
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_6d4656 "countLeadingZeros_6d4656"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %int %int
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %18 = OpConstantNull %uint
+ %uint_65535 = OpConstant %uint 65535
+ %bool = OpTypeBool
+ %uint_16 = OpConstant %uint 16
+%uint_16777215 = OpConstant %uint 16777215
+ %uint_8 = OpConstant %uint 8
+%uint_268435455 = OpConstant %uint 268435455
+ %uint_4 = OpConstant %uint 4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %uint_2 = OpConstant %uint 2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %uint_1 = OpConstant %uint 1
+ %void = OpTypeVoid
+ %62 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %69 = OpConstantNull %int
+ %73 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %int None %9
+ %v = OpFunctionParameter %int
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %18
+ %14 = OpBitcast %uint %v
+ OpStore %x %14
+ %20 = OpLoad %uint %x
+ %22 = OpULessThanEqual %bool %20 %uint_65535
+ %19 = OpSelect %uint %22 %uint_16 %18
+ %25 = OpLoad %uint %x
+ %26 = OpShiftLeftLogical %uint %25 %19
+ OpStore %x %26
+ %28 = OpLoad %uint %x
+ %30 = OpULessThanEqual %bool %28 %uint_16777215
+ %27 = OpSelect %uint %30 %uint_8 %18
+ %32 = OpLoad %uint %x
+ %33 = OpShiftLeftLogical %uint %32 %27
+ OpStore %x %33
+ %35 = OpLoad %uint %x
+ %37 = OpULessThanEqual %bool %35 %uint_268435455
+ %34 = OpSelect %uint %37 %uint_4 %18
+ %39 = OpLoad %uint %x
+ %40 = OpShiftLeftLogical %uint %39 %34
+ OpStore %x %40
+ %42 = OpLoad %uint %x
+ %44 = OpULessThanEqual %bool %42 %uint_1073741823
+ %41 = OpSelect %uint %44 %uint_2 %18
+ %46 = OpLoad %uint %x
+ %47 = OpShiftLeftLogical %uint %46 %41
+ OpStore %x %47
+ %49 = OpLoad %uint %x
+ %51 = OpULessThanEqual %bool %49 %uint_2147483647
+ %48 = OpSelect %uint %51 %uint_1 %18
+ %54 = OpLoad %uint %x
+ %55 = OpIEqual %bool %54 %18
+ %53 = OpSelect %uint %55 %uint_1 %18
+ %57 = OpBitwiseOr %uint %19 %27
+ %58 = OpBitwiseOr %uint %57 %34
+ %59 = OpBitwiseOr %uint %58 %41
+ %60 = OpBitwiseOr %uint %59 %48
+ %61 = OpIAdd %uint %60 %53
+ %56 = OpBitcast %int %61
+ OpReturnValue %56
+ OpFunctionEnd
+%countLeadingZeros_6d4656 = OpFunction %void None %62
+ %65 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %69
+ %res = OpVariable %_ptr_Function_int Function %69
+ OpStore %arg_0 %int_1
+ %71 = OpLoad %int %arg_0
+ %70 = OpFunctionCall %int %tint_count_leading_zeros %71
+ OpStore %res %70
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %73
+ %75 = OpLabel
+ %76 = OpFunctionCall %void %countLeadingZeros_6d4656
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %62
+ %78 = OpLabel
+ %79 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %79
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %62
+ %82 = OpLabel
+ %83 = OpFunctionCall %void %countLeadingZeros_6d4656
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %62
+ %85 = OpLabel
+ %86 = OpFunctionCall %void %countLeadingZeros_6d4656
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl
new file mode 100644
index 0000000..8e14227
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/6d4656.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_6d4656() {
+ var arg_0 = 1;
+ var res : i32 = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_6d4656();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_6d4656();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_6d4656();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl
new file mode 100644
index 0000000..0c22c57
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(vec<2, u32>) -> vec<2, u32>
+fn countLeadingZeros_70783f() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_70783f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_70783f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_70783f();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl
new file mode 100644
index 0000000..c7763c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec2 tint_count_leading_zeros(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ x = (x << b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ x = (x << b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ x = (x << b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ x = (x << b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_70783f() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_70783f();
+ 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;
+
+uvec2 tint_count_leading_zeros(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ x = (x << b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ x = (x << b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ x = (x << b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ x = (x << b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_70783f() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_70783f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec2 tint_count_leading_zeros(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ x = (x << b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ x = (x << b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ x = (x << b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ x = (x << b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_70783f() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_70783f();
+}
+
+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/countLeadingZeros/70783f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.hlsl
new file mode 100644
index 0000000..90d4b5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint2 tint_count_leading_zeros(uint2 v) {
+ uint2 x = uint2(v);
+ const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx);
+ x = (x << b16);
+ const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx);
+ x = (x << b8);
+ const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx);
+ x = (x << b4);
+ const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx);
+ x = (x << b2);
+ const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx);
+ return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_70783f() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_70783f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_70783f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_70783f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl
new file mode 100644
index 0000000..eb39a9f
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_70783f() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_70783f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_70783f();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_70783f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm
new file mode 100644
index 0000000..6bf8e61
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.spvasm
@@ -0,0 +1,139 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 95
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_70783f "countLeadingZeros_70783f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2uint = OpTypeVector %uint 2
+ %9 = OpTypeFunction %v2uint %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %18 = OpConstantNull %v2uint
+ %uint_65535 = OpConstant %uint 65535
+ %22 = OpConstantComposite %v2uint %uint_65535 %uint_65535
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %uint_16 = OpConstant %uint 16
+ %27 = OpConstantComposite %v2uint %uint_16 %uint_16
+%uint_16777215 = OpConstant %uint 16777215
+ %33 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215
+ %uint_8 = OpConstant %uint 8
+ %36 = OpConstantComposite %v2uint %uint_8 %uint_8
+%uint_268435455 = OpConstant %uint 268435455
+ %42 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v2uint %uint_4 %uint_4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %51 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823
+ %uint_2 = OpConstant %uint 2
+ %54 = OpConstantComposite %v2uint %uint_2 %uint_2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %60 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647
+ %uint_1 = OpConstant %uint 1
+ %63 = OpConstantComposite %v2uint %uint_1 %uint_1
+ %void = OpTypeVoid
+ %73 = OpTypeFunction %void
+ %81 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %v2uint None %9
+ %v = OpFunctionParameter %v2uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %18
+ OpStore %x %v
+ %20 = OpLoad %v2uint %x
+ %23 = OpULessThanEqual %v2bool %20 %22
+ %19 = OpSelect %v2uint %23 %27 %18
+ %28 = OpLoad %v2uint %x
+ %29 = OpShiftLeftLogical %v2uint %28 %19
+ OpStore %x %29
+ %31 = OpLoad %v2uint %x
+ %34 = OpULessThanEqual %v2bool %31 %33
+ %30 = OpSelect %v2uint %34 %36 %18
+ %37 = OpLoad %v2uint %x
+ %38 = OpShiftLeftLogical %v2uint %37 %30
+ OpStore %x %38
+ %40 = OpLoad %v2uint %x
+ %43 = OpULessThanEqual %v2bool %40 %42
+ %39 = OpSelect %v2uint %43 %45 %18
+ %46 = OpLoad %v2uint %x
+ %47 = OpShiftLeftLogical %v2uint %46 %39
+ OpStore %x %47
+ %49 = OpLoad %v2uint %x
+ %52 = OpULessThanEqual %v2bool %49 %51
+ %48 = OpSelect %v2uint %52 %54 %18
+ %55 = OpLoad %v2uint %x
+ %56 = OpShiftLeftLogical %v2uint %55 %48
+ OpStore %x %56
+ %58 = OpLoad %v2uint %x
+ %61 = OpULessThanEqual %v2bool %58 %60
+ %57 = OpSelect %v2uint %61 %63 %18
+ %65 = OpLoad %v2uint %x
+ %66 = OpIEqual %v2bool %65 %18
+ %64 = OpSelect %v2uint %66 %63 %18
+ %68 = OpBitwiseOr %v2uint %19 %30
+ %69 = OpBitwiseOr %v2uint %68 %39
+ %70 = OpBitwiseOr %v2uint %69 %48
+ %71 = OpBitwiseOr %v2uint %70 %57
+ %72 = OpIAdd %v2uint %71 %64
+ OpReturnValue %72
+ OpFunctionEnd
+%countLeadingZeros_70783f = OpFunction %void None %73
+ %76 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %18
+ %res = OpVariable %_ptr_Function_v2uint Function %18
+ OpStore %arg_0 %18
+ %79 = OpLoad %v2uint %arg_0
+ %78 = OpFunctionCall %v2uint %tint_count_leading_zeros %79
+ OpStore %res %78
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %81
+ %83 = OpLabel
+ %84 = OpFunctionCall %void %countLeadingZeros_70783f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %73
+ %86 = OpLabel
+ %87 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %87
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %73
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %countLeadingZeros_70783f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %73
+ %93 = OpLabel
+ %94 = OpFunctionCall %void %countLeadingZeros_70783f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl
new file mode 100644
index 0000000..f005d35
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/70783f.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_70783f() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_70783f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_70783f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_70783f();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl
new file mode 100644
index 0000000..597fb8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(vec<3, i32>) -> vec<3, i32>
+fn countLeadingZeros_7c38a6() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_7c38a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_7c38a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_7c38a6();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl
new file mode 100644
index 0000000..5637859
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec3 tint_count_leading_zeros(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ x = (x << b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ x = (x << b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ x = (x << b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ x = (x << b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_7c38a6() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_7c38a6();
+ 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;
+
+ivec3 tint_count_leading_zeros(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ x = (x << b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ x = (x << b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ x = (x << b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ x = (x << b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_7c38a6() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_7c38a6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec3 tint_count_leading_zeros(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ x = (x << b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ x = (x << b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ x = (x << b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ x = (x << b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_7c38a6() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_7c38a6();
+}
+
+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/countLeadingZeros/7c38a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.hlsl
new file mode 100644
index 0000000..a222162
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int3 tint_count_leading_zeros(int3 v) {
+ uint3 x = uint3(v);
+ const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx);
+ x = (x << b16);
+ const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx);
+ x = (x << b8);
+ const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx);
+ x = (x << b4);
+ const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx);
+ x = (x << b2);
+ const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx);
+ return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_7c38a6() {
+ int3 arg_0 = (0).xxx;
+ int3 res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_7c38a6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_7c38a6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_7c38a6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl
new file mode 100644
index 0000000..d6a5cf6
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_7c38a6() {
+ int3 arg_0 = int3(0);
+ int3 res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_7c38a6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_7c38a6();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_7c38a6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm
new file mode 100644
index 0000000..13be646
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.spvasm
@@ -0,0 +1,145 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 99
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_7c38a6 "countLeadingZeros_7c38a6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %9 = OpTypeFunction %v3int %v3int
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %20 = OpConstantNull %v3uint
+ %uint_65535 = OpConstant %uint 65535
+ %24 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %uint_16 = OpConstant %uint 16
+ %29 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+%uint_16777215 = OpConstant %uint 16777215
+ %35 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+%uint_268435455 = OpConstant %uint 268435455
+ %44 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455
+ %uint_4 = OpConstant %uint 4
+ %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %53 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823
+ %uint_2 = OpConstant %uint 2
+ %56 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %62 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %75 = OpTypeFunction %void
+ %79 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %85 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %v3int None %9
+ %v = OpFunctionParameter %v3int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %20
+ %15 = OpBitcast %v3uint %v
+ OpStore %x %15
+ %22 = OpLoad %v3uint %x
+ %25 = OpULessThanEqual %v3bool %22 %24
+ %21 = OpSelect %v3uint %25 %29 %20
+ %30 = OpLoad %v3uint %x
+ %31 = OpShiftLeftLogical %v3uint %30 %21
+ OpStore %x %31
+ %33 = OpLoad %v3uint %x
+ %36 = OpULessThanEqual %v3bool %33 %35
+ %32 = OpSelect %v3uint %36 %38 %20
+ %39 = OpLoad %v3uint %x
+ %40 = OpShiftLeftLogical %v3uint %39 %32
+ OpStore %x %40
+ %42 = OpLoad %v3uint %x
+ %45 = OpULessThanEqual %v3bool %42 %44
+ %41 = OpSelect %v3uint %45 %47 %20
+ %48 = OpLoad %v3uint %x
+ %49 = OpShiftLeftLogical %v3uint %48 %41
+ OpStore %x %49
+ %51 = OpLoad %v3uint %x
+ %54 = OpULessThanEqual %v3bool %51 %53
+ %50 = OpSelect %v3uint %54 %56 %20
+ %57 = OpLoad %v3uint %x
+ %58 = OpShiftLeftLogical %v3uint %57 %50
+ OpStore %x %58
+ %60 = OpLoad %v3uint %x
+ %63 = OpULessThanEqual %v3bool %60 %62
+ %59 = OpSelect %v3uint %63 %65 %20
+ %67 = OpLoad %v3uint %x
+ %68 = OpIEqual %v3bool %67 %20
+ %66 = OpSelect %v3uint %68 %65 %20
+ %70 = OpBitwiseOr %v3uint %21 %32
+ %71 = OpBitwiseOr %v3uint %70 %41
+ %72 = OpBitwiseOr %v3uint %71 %50
+ %73 = OpBitwiseOr %v3uint %72 %59
+ %74 = OpIAdd %v3uint %73 %66
+ %69 = OpBitcast %v3int %74
+ OpReturnValue %69
+ OpFunctionEnd
+%countLeadingZeros_7c38a6 = OpFunction %void None %75
+ %78 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %79
+ %res = OpVariable %_ptr_Function_v3int Function %79
+ OpStore %arg_0 %79
+ %83 = OpLoad %v3int %arg_0
+ %82 = OpFunctionCall %v3int %tint_count_leading_zeros %83
+ OpStore %res %82
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %85
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %countLeadingZeros_7c38a6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %75
+ %90 = OpLabel
+ %91 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %91
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %75
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %countLeadingZeros_7c38a6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %75
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %countLeadingZeros_7c38a6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl
new file mode 100644
index 0000000..b4f5e0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/7c38a6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_7c38a6() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_7c38a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_7c38a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_7c38a6();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl
new file mode 100644
index 0000000..cdc1846
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(vec<2, i32>) -> vec<2, i32>
+fn countLeadingZeros_858d40() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_858d40();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_858d40();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_858d40();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl
new file mode 100644
index 0000000..37ad0cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec2 tint_count_leading_zeros(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ x = (x << b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ x = (x << b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ x = (x << b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ x = (x << b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_858d40() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_858d40();
+ 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;
+
+ivec2 tint_count_leading_zeros(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ x = (x << b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ x = (x << b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ x = (x << b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ x = (x << b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_858d40() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_858d40();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec2 tint_count_leading_zeros(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), lessThanEqual(x, uvec2(65535u)));
+ x = (x << b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), lessThanEqual(x, uvec2(16777215u)));
+ x = (x << b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), lessThanEqual(x, uvec2(268435455u)));
+ x = (x << b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), lessThanEqual(x, uvec2(1073741823u)));
+ x = (x << b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), lessThanEqual(x, uvec2(2147483647u)));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_858d40() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_858d40();
+}
+
+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/countLeadingZeros/858d40.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.hlsl
new file mode 100644
index 0000000..554c876
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int2 tint_count_leading_zeros(int2 v) {
+ uint2 x = uint2(v);
+ const uint2 b16 = ((x <= (65535u).xx) ? (16u).xx : (0u).xx);
+ x = (x << b16);
+ const uint2 b8 = ((x <= (16777215u).xx) ? (8u).xx : (0u).xx);
+ x = (x << b8);
+ const uint2 b4 = ((x <= (268435455u).xx) ? (4u).xx : (0u).xx);
+ x = (x << b4);
+ const uint2 b2 = ((x <= (1073741823u).xx) ? (2u).xx : (0u).xx);
+ x = (x << b2);
+ const uint2 b1 = ((x <= (2147483647u).xx) ? (1u).xx : (0u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx);
+ return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_858d40() {
+ int2 arg_0 = (0).xx;
+ int2 res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_858d40();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_858d40();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_858d40();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl
new file mode 100644
index 0000000..936cead
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_858d40() {
+ int2 arg_0 = int2(0);
+ int2 res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_858d40();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_858d40();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_858d40();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm
new file mode 100644
index 0000000..9713d96
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.spvasm
@@ -0,0 +1,145 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 99
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_858d40 "countLeadingZeros_858d40"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2int = OpTypeVector %int 2
+ %9 = OpTypeFunction %v2int %v2int
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %20 = OpConstantNull %v2uint
+ %uint_65535 = OpConstant %uint 65535
+ %24 = OpConstantComposite %v2uint %uint_65535 %uint_65535
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %uint_16 = OpConstant %uint 16
+ %29 = OpConstantComposite %v2uint %uint_16 %uint_16
+%uint_16777215 = OpConstant %uint 16777215
+ %35 = OpConstantComposite %v2uint %uint_16777215 %uint_16777215
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v2uint %uint_8 %uint_8
+%uint_268435455 = OpConstant %uint 268435455
+ %44 = OpConstantComposite %v2uint %uint_268435455 %uint_268435455
+ %uint_4 = OpConstant %uint 4
+ %47 = OpConstantComposite %v2uint %uint_4 %uint_4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %53 = OpConstantComposite %v2uint %uint_1073741823 %uint_1073741823
+ %uint_2 = OpConstant %uint 2
+ %56 = OpConstantComposite %v2uint %uint_2 %uint_2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %62 = OpConstantComposite %v2uint %uint_2147483647 %uint_2147483647
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v2uint %uint_1 %uint_1
+ %void = OpTypeVoid
+ %75 = OpTypeFunction %void
+ %79 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %85 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %v2int None %9
+ %v = OpFunctionParameter %v2int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %20
+ %15 = OpBitcast %v2uint %v
+ OpStore %x %15
+ %22 = OpLoad %v2uint %x
+ %25 = OpULessThanEqual %v2bool %22 %24
+ %21 = OpSelect %v2uint %25 %29 %20
+ %30 = OpLoad %v2uint %x
+ %31 = OpShiftLeftLogical %v2uint %30 %21
+ OpStore %x %31
+ %33 = OpLoad %v2uint %x
+ %36 = OpULessThanEqual %v2bool %33 %35
+ %32 = OpSelect %v2uint %36 %38 %20
+ %39 = OpLoad %v2uint %x
+ %40 = OpShiftLeftLogical %v2uint %39 %32
+ OpStore %x %40
+ %42 = OpLoad %v2uint %x
+ %45 = OpULessThanEqual %v2bool %42 %44
+ %41 = OpSelect %v2uint %45 %47 %20
+ %48 = OpLoad %v2uint %x
+ %49 = OpShiftLeftLogical %v2uint %48 %41
+ OpStore %x %49
+ %51 = OpLoad %v2uint %x
+ %54 = OpULessThanEqual %v2bool %51 %53
+ %50 = OpSelect %v2uint %54 %56 %20
+ %57 = OpLoad %v2uint %x
+ %58 = OpShiftLeftLogical %v2uint %57 %50
+ OpStore %x %58
+ %60 = OpLoad %v2uint %x
+ %63 = OpULessThanEqual %v2bool %60 %62
+ %59 = OpSelect %v2uint %63 %65 %20
+ %67 = OpLoad %v2uint %x
+ %68 = OpIEqual %v2bool %67 %20
+ %66 = OpSelect %v2uint %68 %65 %20
+ %70 = OpBitwiseOr %v2uint %21 %32
+ %71 = OpBitwiseOr %v2uint %70 %41
+ %72 = OpBitwiseOr %v2uint %71 %50
+ %73 = OpBitwiseOr %v2uint %72 %59
+ %74 = OpIAdd %v2uint %73 %66
+ %69 = OpBitcast %v2int %74
+ OpReturnValue %69
+ OpFunctionEnd
+%countLeadingZeros_858d40 = OpFunction %void None %75
+ %78 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %79
+ %res = OpVariable %_ptr_Function_v2int Function %79
+ OpStore %arg_0 %79
+ %83 = OpLoad %v2int %arg_0
+ %82 = OpFunctionCall %v2int %tint_count_leading_zeros %83
+ OpStore %res %82
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %85
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %countLeadingZeros_858d40
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %75
+ %90 = OpLabel
+ %91 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %91
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %75
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %countLeadingZeros_858d40
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %75
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %countLeadingZeros_858d40
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl
new file mode 100644
index 0000000..7636a6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/858d40.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_858d40() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_858d40();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_858d40();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_858d40();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl
new file mode 100644
index 0000000..f27d250
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(vec<3, u32>) -> vec<3, u32>
+fn countLeadingZeros_ab6345() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_ab6345();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_ab6345();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_ab6345();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl
new file mode 100644
index 0000000..9718304
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec3 tint_count_leading_zeros(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ x = (x << b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ x = (x << b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ x = (x << b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ x = (x << b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_ab6345() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_ab6345();
+ 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;
+
+uvec3 tint_count_leading_zeros(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ x = (x << b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ x = (x << b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ x = (x << b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ x = (x << b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_ab6345() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_ab6345();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec3 tint_count_leading_zeros(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), lessThanEqual(x, uvec3(65535u)));
+ x = (x << b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), lessThanEqual(x, uvec3(16777215u)));
+ x = (x << b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), lessThanEqual(x, uvec3(268435455u)));
+ x = (x << b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), lessThanEqual(x, uvec3(1073741823u)));
+ x = (x << b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), lessThanEqual(x, uvec3(2147483647u)));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_ab6345() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_ab6345();
+}
+
+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/countLeadingZeros/ab6345.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.hlsl
new file mode 100644
index 0000000..8ce7db4
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint3 tint_count_leading_zeros(uint3 v) {
+ uint3 x = uint3(v);
+ const uint3 b16 = ((x <= (65535u).xxx) ? (16u).xxx : (0u).xxx);
+ x = (x << b16);
+ const uint3 b8 = ((x <= (16777215u).xxx) ? (8u).xxx : (0u).xxx);
+ x = (x << b8);
+ const uint3 b4 = ((x <= (268435455u).xxx) ? (4u).xxx : (0u).xxx);
+ x = (x << b4);
+ const uint3 b2 = ((x <= (1073741823u).xxx) ? (2u).xxx : (0u).xxx);
+ x = (x << b2);
+ const uint3 b1 = ((x <= (2147483647u).xxx) ? (1u).xxx : (0u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx);
+ return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_ab6345() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_ab6345();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_ab6345();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_ab6345();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl
new file mode 100644
index 0000000..da91869
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_ab6345() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_ab6345();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_ab6345();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_ab6345();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm
new file mode 100644
index 0000000..fbe6e6a
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.spvasm
@@ -0,0 +1,139 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 95
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_ab6345 "countLeadingZeros_ab6345"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3uint = OpTypeVector %uint 3
+ %9 = OpTypeFunction %v3uint %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %18 = OpConstantNull %v3uint
+ %uint_65535 = OpConstant %uint 65535
+ %22 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %uint_16 = OpConstant %uint 16
+ %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+%uint_16777215 = OpConstant %uint 16777215
+ %33 = OpConstantComposite %v3uint %uint_16777215 %uint_16777215 %uint_16777215
+ %uint_8 = OpConstant %uint 8
+ %36 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+%uint_268435455 = OpConstant %uint 268435455
+ %42 = OpConstantComposite %v3uint %uint_268435455 %uint_268435455 %uint_268435455
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %51 = OpConstantComposite %v3uint %uint_1073741823 %uint_1073741823 %uint_1073741823
+ %uint_2 = OpConstant %uint 2
+ %54 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %60 = OpConstantComposite %v3uint %uint_2147483647 %uint_2147483647 %uint_2147483647
+ %uint_1 = OpConstant %uint 1
+ %63 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %73 = OpTypeFunction %void
+ %81 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %v3uint None %9
+ %v = OpFunctionParameter %v3uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %18
+ OpStore %x %v
+ %20 = OpLoad %v3uint %x
+ %23 = OpULessThanEqual %v3bool %20 %22
+ %19 = OpSelect %v3uint %23 %27 %18
+ %28 = OpLoad %v3uint %x
+ %29 = OpShiftLeftLogical %v3uint %28 %19
+ OpStore %x %29
+ %31 = OpLoad %v3uint %x
+ %34 = OpULessThanEqual %v3bool %31 %33
+ %30 = OpSelect %v3uint %34 %36 %18
+ %37 = OpLoad %v3uint %x
+ %38 = OpShiftLeftLogical %v3uint %37 %30
+ OpStore %x %38
+ %40 = OpLoad %v3uint %x
+ %43 = OpULessThanEqual %v3bool %40 %42
+ %39 = OpSelect %v3uint %43 %45 %18
+ %46 = OpLoad %v3uint %x
+ %47 = OpShiftLeftLogical %v3uint %46 %39
+ OpStore %x %47
+ %49 = OpLoad %v3uint %x
+ %52 = OpULessThanEqual %v3bool %49 %51
+ %48 = OpSelect %v3uint %52 %54 %18
+ %55 = OpLoad %v3uint %x
+ %56 = OpShiftLeftLogical %v3uint %55 %48
+ OpStore %x %56
+ %58 = OpLoad %v3uint %x
+ %61 = OpULessThanEqual %v3bool %58 %60
+ %57 = OpSelect %v3uint %61 %63 %18
+ %65 = OpLoad %v3uint %x
+ %66 = OpIEqual %v3bool %65 %18
+ %64 = OpSelect %v3uint %66 %63 %18
+ %68 = OpBitwiseOr %v3uint %19 %30
+ %69 = OpBitwiseOr %v3uint %68 %39
+ %70 = OpBitwiseOr %v3uint %69 %48
+ %71 = OpBitwiseOr %v3uint %70 %57
+ %72 = OpIAdd %v3uint %71 %64
+ OpReturnValue %72
+ OpFunctionEnd
+%countLeadingZeros_ab6345 = OpFunction %void None %73
+ %76 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %18
+ %res = OpVariable %_ptr_Function_v3uint Function %18
+ OpStore %arg_0 %18
+ %79 = OpLoad %v3uint %arg_0
+ %78 = OpFunctionCall %v3uint %tint_count_leading_zeros %79
+ OpStore %res %78
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %81
+ %83 = OpLabel
+ %84 = OpFunctionCall %void %countLeadingZeros_ab6345
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %73
+ %86 = OpLabel
+ %87 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %87
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %73
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %countLeadingZeros_ab6345
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %73
+ %93 = OpLabel
+ %94 = OpFunctionCall %void %countLeadingZeros_ab6345
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl
new file mode 100644
index 0000000..a9936e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/ab6345.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_ab6345() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_ab6345();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_ab6345();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_ab6345();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl
new file mode 100644
index 0000000..c3a1e88
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(vec<4, i32>) -> vec<4, i32>
+fn countLeadingZeros_eab32b() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_eab32b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_eab32b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_eab32b();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl
new file mode 100644
index 0000000..54da7b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec4 tint_count_leading_zeros(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ x = (x << b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ x = (x << b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ x = (x << b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ x = (x << b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_eab32b() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_eab32b();
+ 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;
+
+ivec4 tint_count_leading_zeros(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ x = (x << b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ x = (x << b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ x = (x << b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ x = (x << b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_eab32b() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_eab32b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec4 tint_count_leading_zeros(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ x = (x << b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ x = (x << b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ x = (x << b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ x = (x << b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_eab32b() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_eab32b();
+}
+
+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/countLeadingZeros/eab32b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.hlsl
new file mode 100644
index 0000000..0c0038e
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int4 tint_count_leading_zeros(int4 v) {
+ uint4 x = uint4(v);
+ const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx);
+ x = (x << b16);
+ const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx);
+ x = (x << b8);
+ const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx);
+ x = (x << b4);
+ const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx);
+ x = (x << b2);
+ const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx);
+ return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_eab32b() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_eab32b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_eab32b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_eab32b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl
new file mode 100644
index 0000000..e057ee9
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_eab32b() {
+ int4 arg_0 = int4(0);
+ int4 res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_eab32b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_eab32b();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_eab32b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm
new file mode 100644
index 0000000..e5abbcf
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.spvasm
@@ -0,0 +1,145 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 99
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_eab32b "countLeadingZeros_eab32b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4int = OpTypeVector %int 4
+ %9 = OpTypeFunction %v4int %v4int
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %20 = OpConstantNull %v4uint
+ %uint_65535 = OpConstant %uint 65535
+ %24 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %uint_16 = OpConstant %uint 16
+ %29 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+%uint_16777215 = OpConstant %uint 16777215
+ %35 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+%uint_268435455 = OpConstant %uint 268435455
+ %44 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455
+ %uint_4 = OpConstant %uint 4
+ %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %53 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823
+ %uint_2 = OpConstant %uint 2
+ %56 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %62 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %75 = OpTypeFunction %void
+ %79 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %85 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %v4int None %9
+ %v = OpFunctionParameter %v4int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %20
+ %15 = OpBitcast %v4uint %v
+ OpStore %x %15
+ %22 = OpLoad %v4uint %x
+ %25 = OpULessThanEqual %v4bool %22 %24
+ %21 = OpSelect %v4uint %25 %29 %20
+ %30 = OpLoad %v4uint %x
+ %31 = OpShiftLeftLogical %v4uint %30 %21
+ OpStore %x %31
+ %33 = OpLoad %v4uint %x
+ %36 = OpULessThanEqual %v4bool %33 %35
+ %32 = OpSelect %v4uint %36 %38 %20
+ %39 = OpLoad %v4uint %x
+ %40 = OpShiftLeftLogical %v4uint %39 %32
+ OpStore %x %40
+ %42 = OpLoad %v4uint %x
+ %45 = OpULessThanEqual %v4bool %42 %44
+ %41 = OpSelect %v4uint %45 %47 %20
+ %48 = OpLoad %v4uint %x
+ %49 = OpShiftLeftLogical %v4uint %48 %41
+ OpStore %x %49
+ %51 = OpLoad %v4uint %x
+ %54 = OpULessThanEqual %v4bool %51 %53
+ %50 = OpSelect %v4uint %54 %56 %20
+ %57 = OpLoad %v4uint %x
+ %58 = OpShiftLeftLogical %v4uint %57 %50
+ OpStore %x %58
+ %60 = OpLoad %v4uint %x
+ %63 = OpULessThanEqual %v4bool %60 %62
+ %59 = OpSelect %v4uint %63 %65 %20
+ %67 = OpLoad %v4uint %x
+ %68 = OpIEqual %v4bool %67 %20
+ %66 = OpSelect %v4uint %68 %65 %20
+ %70 = OpBitwiseOr %v4uint %21 %32
+ %71 = OpBitwiseOr %v4uint %70 %41
+ %72 = OpBitwiseOr %v4uint %71 %50
+ %73 = OpBitwiseOr %v4uint %72 %59
+ %74 = OpIAdd %v4uint %73 %66
+ %69 = OpBitcast %v4int %74
+ OpReturnValue %69
+ OpFunctionEnd
+%countLeadingZeros_eab32b = OpFunction %void None %75
+ %78 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %79
+ %res = OpVariable %_ptr_Function_v4int Function %79
+ OpStore %arg_0 %79
+ %83 = OpLoad %v4int %arg_0
+ %82 = OpFunctionCall %v4int %tint_count_leading_zeros %83
+ OpStore %res %82
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %85
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %countLeadingZeros_eab32b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %75
+ %90 = OpLabel
+ %91 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %91
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %75
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %countLeadingZeros_eab32b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %75
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %countLeadingZeros_eab32b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl
new file mode 100644
index 0000000..2cfb1ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/eab32b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_eab32b() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_eab32b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_eab32b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_eab32b();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl
new file mode 100644
index 0000000..ca3af73
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countLeadingZeros(vec<4, u32>) -> vec<4, u32>
+fn countLeadingZeros_f70103() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_f70103();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_f70103();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_f70103();
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl
new file mode 100644
index 0000000..3f589ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec4 tint_count_leading_zeros(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ x = (x << b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ x = (x << b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ x = (x << b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ x = (x << b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_f70103() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_count_leading_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countLeadingZeros_f70103();
+ 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;
+
+uvec4 tint_count_leading_zeros(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ x = (x << b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ x = (x << b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ x = (x << b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ x = (x << b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_f70103() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_count_leading_zeros(arg_0);
+}
+
+void fragment_main() {
+ countLeadingZeros_f70103();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec4 tint_count_leading_zeros(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), lessThanEqual(x, uvec4(65535u)));
+ x = (x << b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), lessThanEqual(x, uvec4(16777215u)));
+ x = (x << b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), lessThanEqual(x, uvec4(268435455u)));
+ x = (x << b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), lessThanEqual(x, uvec4(1073741823u)));
+ x = (x << b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), lessThanEqual(x, uvec4(2147483647u)));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_f70103() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_count_leading_zeros(arg_0);
+}
+
+void compute_main() {
+ countLeadingZeros_f70103();
+}
+
+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/countLeadingZeros/f70103.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.hlsl
new file mode 100644
index 0000000..073158b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint4 tint_count_leading_zeros(uint4 v) {
+ uint4 x = uint4(v);
+ const uint4 b16 = ((x <= (65535u).xxxx) ? (16u).xxxx : (0u).xxxx);
+ x = (x << b16);
+ const uint4 b8 = ((x <= (16777215u).xxxx) ? (8u).xxxx : (0u).xxxx);
+ x = (x << b8);
+ const uint4 b4 = ((x <= (268435455u).xxxx) ? (4u).xxxx : (0u).xxxx);
+ x = (x << b4);
+ const uint4 b2 = ((x <= (1073741823u).xxxx) ? (2u).xxxx : (0u).xxxx);
+ x = (x << b2);
+ const uint4 b1 = ((x <= (2147483647u).xxxx) ? (1u).xxxx : (0u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx);
+ return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countLeadingZeros_f70103() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = tint_count_leading_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_f70103();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countLeadingZeros_f70103();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countLeadingZeros_f70103();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl
new file mode 100644
index 0000000..ff67225
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countLeadingZeros_f70103() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = clz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countLeadingZeros_f70103();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countLeadingZeros_f70103();
+ return;
+}
+
+kernel void compute_main() {
+ countLeadingZeros_f70103();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm
new file mode 100644
index 0000000..a28fd9c
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.spvasm
@@ -0,0 +1,139 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 95
+; 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 %tint_count_leading_zeros "tint_count_leading_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countLeadingZeros_f70103 "countLeadingZeros_f70103"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4uint = OpTypeVector %uint 4
+ %9 = OpTypeFunction %v4uint %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %18 = OpConstantNull %v4uint
+ %uint_65535 = OpConstant %uint 65535
+ %22 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %uint_16 = OpConstant %uint 16
+ %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+%uint_16777215 = OpConstant %uint 16777215
+ %33 = OpConstantComposite %v4uint %uint_16777215 %uint_16777215 %uint_16777215 %uint_16777215
+ %uint_8 = OpConstant %uint 8
+ %36 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+%uint_268435455 = OpConstant %uint 268435455
+ %42 = OpConstantComposite %v4uint %uint_268435455 %uint_268435455 %uint_268435455 %uint_268435455
+ %uint_4 = OpConstant %uint 4
+ %45 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+%uint_1073741823 = OpConstant %uint 1073741823
+ %51 = OpConstantComposite %v4uint %uint_1073741823 %uint_1073741823 %uint_1073741823 %uint_1073741823
+ %uint_2 = OpConstant %uint 2
+ %54 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+%uint_2147483647 = OpConstant %uint 2147483647
+ %60 = OpConstantComposite %v4uint %uint_2147483647 %uint_2147483647 %uint_2147483647 %uint_2147483647
+ %uint_1 = OpConstant %uint 1
+ %63 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %73 = OpTypeFunction %void
+ %81 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_leading_zeros = OpFunction %v4uint None %9
+ %v = OpFunctionParameter %v4uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %18
+ OpStore %x %v
+ %20 = OpLoad %v4uint %x
+ %23 = OpULessThanEqual %v4bool %20 %22
+ %19 = OpSelect %v4uint %23 %27 %18
+ %28 = OpLoad %v4uint %x
+ %29 = OpShiftLeftLogical %v4uint %28 %19
+ OpStore %x %29
+ %31 = OpLoad %v4uint %x
+ %34 = OpULessThanEqual %v4bool %31 %33
+ %30 = OpSelect %v4uint %34 %36 %18
+ %37 = OpLoad %v4uint %x
+ %38 = OpShiftLeftLogical %v4uint %37 %30
+ OpStore %x %38
+ %40 = OpLoad %v4uint %x
+ %43 = OpULessThanEqual %v4bool %40 %42
+ %39 = OpSelect %v4uint %43 %45 %18
+ %46 = OpLoad %v4uint %x
+ %47 = OpShiftLeftLogical %v4uint %46 %39
+ OpStore %x %47
+ %49 = OpLoad %v4uint %x
+ %52 = OpULessThanEqual %v4bool %49 %51
+ %48 = OpSelect %v4uint %52 %54 %18
+ %55 = OpLoad %v4uint %x
+ %56 = OpShiftLeftLogical %v4uint %55 %48
+ OpStore %x %56
+ %58 = OpLoad %v4uint %x
+ %61 = OpULessThanEqual %v4bool %58 %60
+ %57 = OpSelect %v4uint %61 %63 %18
+ %65 = OpLoad %v4uint %x
+ %66 = OpIEqual %v4bool %65 %18
+ %64 = OpSelect %v4uint %66 %63 %18
+ %68 = OpBitwiseOr %v4uint %19 %30
+ %69 = OpBitwiseOr %v4uint %68 %39
+ %70 = OpBitwiseOr %v4uint %69 %48
+ %71 = OpBitwiseOr %v4uint %70 %57
+ %72 = OpIAdd %v4uint %71 %64
+ OpReturnValue %72
+ OpFunctionEnd
+%countLeadingZeros_f70103 = OpFunction %void None %73
+ %76 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %18
+ %res = OpVariable %_ptr_Function_v4uint Function %18
+ OpStore %arg_0 %18
+ %79 = OpLoad %v4uint %arg_0
+ %78 = OpFunctionCall %v4uint %tint_count_leading_zeros %79
+ OpStore %res %78
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %81
+ %83 = OpLabel
+ %84 = OpFunctionCall %void %countLeadingZeros_f70103
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %73
+ %86 = OpLabel
+ %87 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %87
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %73
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %countLeadingZeros_f70103
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %73
+ %93 = OpLabel
+ %94 = OpFunctionCall %void %countLeadingZeros_f70103
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl
new file mode 100644
index 0000000..62fbfc6
--- /dev/null
+++ b/test/tint/builtins/gen/var/countLeadingZeros/f70103.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countLeadingZeros_f70103() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = countLeadingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countLeadingZeros_f70103();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countLeadingZeros_f70103();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countLeadingZeros_f70103();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl
new file mode 100644
index 0000000..61a57d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(vec<4, u32>) -> vec<4, u32>
+fn countOneBits_0d0e46() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_0d0e46();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_0d0e46();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_0d0e46();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl
new file mode 100644
index 0000000..a5c7b97
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_0d0e46() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = uvec4(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_0d0e46();
+ 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;
+
+void countOneBits_0d0e46() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = uvec4(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_0d0e46();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_0d0e46() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = uvec4(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_0d0e46();
+}
+
+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/countOneBits/0d0e46.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.hlsl
new file mode 100644
index 0000000..65d9518
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_0d0e46() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = countbits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_0d0e46();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_0d0e46();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_0d0e46();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl
new file mode 100644
index 0000000..a08898f
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_0d0e46() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_0d0e46();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_0d0e46();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_0d0e46();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm
new file mode 100644
index 0000000..d80bfd7
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_0d0e46 "countOneBits_0d0e46"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_0d0e46 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4uint %arg_0
+ %18 = OpBitCount %v4uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_0d0e46
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_0d0e46
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_0d0e46
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl
new file mode 100644
index 0000000..fd7c556
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0d0e46.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_0d0e46() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_0d0e46();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_0d0e46();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_0d0e46();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl
new file mode 100644
index 0000000..0e27caa
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(vec<4, i32>) -> vec<4, i32>
+fn countOneBits_0f7980() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_0f7980();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_0f7980();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_0f7980();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl
new file mode 100644
index 0000000..627bd2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_0f7980() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = ivec4(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_0f7980();
+ 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;
+
+void countOneBits_0f7980() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = ivec4(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_0f7980();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_0f7980() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = ivec4(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_0f7980();
+}
+
+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/countOneBits/0f7980.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.hlsl
new file mode 100644
index 0000000..0fd2b2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_0f7980() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = asint(countbits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_0f7980();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_0f7980();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_0f7980();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl
new file mode 100644
index 0000000..39c833d
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_0f7980() {
+ int4 arg_0 = int4(0);
+ int4 res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_0f7980();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_0f7980();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_0f7980();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm
new file mode 100644
index 0000000..31f4f89
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_0f7980 "countOneBits_0f7980"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_0f7980 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4int %arg_0
+ %18 = OpBitCount %v4int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_0f7980
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_0f7980
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_0f7980
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl
new file mode 100644
index 0000000..200c35e
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/0f7980.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_0f7980() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_0f7980();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_0f7980();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_0f7980();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl
new file mode 100644
index 0000000..5b4d0a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(vec<3, i32>) -> vec<3, i32>
+fn countOneBits_65d2ae() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_65d2ae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_65d2ae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_65d2ae();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl
new file mode 100644
index 0000000..f7f55d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_65d2ae() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = ivec3(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_65d2ae();
+ 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;
+
+void countOneBits_65d2ae() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = ivec3(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_65d2ae();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_65d2ae() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = ivec3(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_65d2ae();
+}
+
+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/countOneBits/65d2ae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.hlsl
new file mode 100644
index 0000000..d93901e
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_65d2ae() {
+ int3 arg_0 = (0).xxx;
+ int3 res = asint(countbits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_65d2ae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_65d2ae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_65d2ae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl
new file mode 100644
index 0000000..862de76
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_65d2ae() {
+ int3 arg_0 = int3(0);
+ int3 res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_65d2ae();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_65d2ae();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_65d2ae();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm
new file mode 100644
index 0000000..c0d6318
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_65d2ae "countOneBits_65d2ae"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_65d2ae = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3int %arg_0
+ %18 = OpBitCount %v3int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_65d2ae
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_65d2ae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_65d2ae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl
new file mode 100644
index 0000000..f5a9823
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/65d2ae.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_65d2ae() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_65d2ae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_65d2ae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_65d2ae();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl
new file mode 100644
index 0000000..737f276
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(vec<3, u32>) -> vec<3, u32>
+fn countOneBits_690cfc() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_690cfc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_690cfc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_690cfc();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl
new file mode 100644
index 0000000..038c4a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_690cfc() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = uvec3(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_690cfc();
+ 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;
+
+void countOneBits_690cfc() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = uvec3(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_690cfc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_690cfc() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = uvec3(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_690cfc();
+}
+
+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/countOneBits/690cfc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.hlsl
new file mode 100644
index 0000000..4184945
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_690cfc() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = countbits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_690cfc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_690cfc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_690cfc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl
new file mode 100644
index 0000000..d0460a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_690cfc() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_690cfc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_690cfc();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_690cfc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm
new file mode 100644
index 0000000..b6ddf63
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_690cfc "countOneBits_690cfc"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_690cfc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3uint %arg_0
+ %18 = OpBitCount %v3uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_690cfc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_690cfc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_690cfc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl
new file mode 100644
index 0000000..4c33e51
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/690cfc.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_690cfc() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_690cfc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_690cfc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_690cfc();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl
new file mode 100644
index 0000000..6832818
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(vec<2, u32>) -> vec<2, u32>
+fn countOneBits_94fd81() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_94fd81();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_94fd81();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_94fd81();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl
new file mode 100644
index 0000000..abbdc4c
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_94fd81() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = uvec2(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_94fd81();
+ 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;
+
+void countOneBits_94fd81() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = uvec2(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_94fd81();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_94fd81() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = uvec2(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_94fd81();
+}
+
+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/countOneBits/94fd81.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.hlsl
new file mode 100644
index 0000000..962e447
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_94fd81() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = countbits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_94fd81();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_94fd81();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_94fd81();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl
new file mode 100644
index 0000000..f41704e
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_94fd81() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_94fd81();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_94fd81();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_94fd81();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm
new file mode 100644
index 0000000..d099bc2
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_94fd81 "countOneBits_94fd81"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_94fd81 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2uint %arg_0
+ %18 = OpBitCount %v2uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_94fd81
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_94fd81
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_94fd81
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl
new file mode 100644
index 0000000..5048e6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/94fd81.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_94fd81() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_94fd81();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_94fd81();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_94fd81();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl
new file mode 100644
index 0000000..3e6f59a
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(u32) -> u32
+fn countOneBits_ae44f9() {
+ var arg_0 = 1u;
+ var res: u32 = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_ae44f9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_ae44f9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_ae44f9();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl
new file mode 100644
index 0000000..c47d7d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_ae44f9() {
+ uint arg_0 = 1u;
+ uint res = uint(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_ae44f9();
+ 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;
+
+void countOneBits_ae44f9() {
+ uint arg_0 = 1u;
+ uint res = uint(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_ae44f9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_ae44f9() {
+ uint arg_0 = 1u;
+ uint res = uint(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_ae44f9();
+}
+
+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/countOneBits/ae44f9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.hlsl
new file mode 100644
index 0000000..5c19408
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_ae44f9() {
+ uint arg_0 = 1u;
+ uint res = countbits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_ae44f9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_ae44f9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_ae44f9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl
new file mode 100644
index 0000000..a04bb18
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_ae44f9() {
+ uint arg_0 = 1u;
+ uint res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_ae44f9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_ae44f9();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_ae44f9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm
new file mode 100644
index 0000000..5879bf3
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_ae44f9 "countOneBits_ae44f9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_ae44f9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ %19 = OpLoad %uint %arg_0
+ %18 = OpBitCount %uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_ae44f9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_ae44f9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_ae44f9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl
new file mode 100644
index 0000000..3c536e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/ae44f9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_ae44f9() {
+ var arg_0 = 1u;
+ var res : u32 = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_ae44f9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_ae44f9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_ae44f9();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl
new file mode 100644
index 0000000..c9d9775
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(vec<2, i32>) -> vec<2, i32>
+fn countOneBits_af90e2() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_af90e2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_af90e2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_af90e2();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl
new file mode 100644
index 0000000..9ce908d
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_af90e2() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = ivec2(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_af90e2();
+ 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;
+
+void countOneBits_af90e2() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = ivec2(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_af90e2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_af90e2() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = ivec2(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_af90e2();
+}
+
+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/countOneBits/af90e2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.hlsl
new file mode 100644
index 0000000..c68afc7
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_af90e2() {
+ int2 arg_0 = (0).xx;
+ int2 res = asint(countbits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_af90e2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_af90e2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_af90e2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl
new file mode 100644
index 0000000..8239226
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_af90e2() {
+ int2 arg_0 = int2(0);
+ int2 res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_af90e2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_af90e2();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_af90e2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b30596
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_af90e2 "countOneBits_af90e2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_af90e2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2int %arg_0
+ %18 = OpBitCount %v2int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_af90e2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_af90e2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_af90e2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl
new file mode 100644
index 0000000..259a107
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/af90e2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_af90e2() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_af90e2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_af90e2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_af90e2();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl
new file mode 100644
index 0000000..e96dd99
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countOneBits(i32) -> i32
+fn countOneBits_fd88b2() {
+ var arg_0 = 1;
+ var res: i32 = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_fd88b2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_fd88b2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_fd88b2();
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl
new file mode 100644
index 0000000..7ef846b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void countOneBits_fd88b2() {
+ int arg_0 = 1;
+ int res = int(bitCount(arg_0));
+}
+
+vec4 vertex_main() {
+ countOneBits_fd88b2();
+ 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;
+
+void countOneBits_fd88b2() {
+ int arg_0 = 1;
+ int res = int(bitCount(arg_0));
+}
+
+void fragment_main() {
+ countOneBits_fd88b2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void countOneBits_fd88b2() {
+ int arg_0 = 1;
+ int res = int(bitCount(arg_0));
+}
+
+void compute_main() {
+ countOneBits_fd88b2();
+}
+
+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/countOneBits/fd88b2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.hlsl
new file mode 100644
index 0000000..7801d95
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void countOneBits_fd88b2() {
+ int arg_0 = 1;
+ int res = asint(countbits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countOneBits_fd88b2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countOneBits_fd88b2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countOneBits_fd88b2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl
new file mode 100644
index 0000000..5077121
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countOneBits_fd88b2() {
+ int arg_0 = 1;
+ int res = popcount(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countOneBits_fd88b2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countOneBits_fd88b2();
+ return;
+}
+
+kernel void compute_main() {
+ countOneBits_fd88b2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm
new file mode 100644
index 0000000..e3733f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %countOneBits_fd88b2 "countOneBits_fd88b2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%countOneBits_fd88b2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ %19 = OpLoad %int %arg_0
+ %18 = OpBitCount %int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %countOneBits_fd88b2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %countOneBits_fd88b2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %countOneBits_fd88b2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl
new file mode 100644
index 0000000..b3e1453
--- /dev/null
+++ b/test/tint/builtins/gen/var/countOneBits/fd88b2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countOneBits_fd88b2() {
+ var arg_0 = 1;
+ var res : i32 = countOneBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countOneBits_fd88b2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countOneBits_fd88b2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countOneBits_fd88b2();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl
new file mode 100644
index 0000000..70140f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(vec<2, u32>) -> vec<2, u32>
+fn countTrailingZeros_1ad138() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_1ad138();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_1ad138();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_1ad138();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl
new file mode 100644
index 0000000..1c3447b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec2 tint_count_trailing_zeros(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1ad138() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_1ad138();
+ 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;
+
+uvec2 tint_count_trailing_zeros(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1ad138() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_1ad138();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec2 tint_count_trailing_zeros(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1ad138() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_1ad138();
+}
+
+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/countTrailingZeros/1ad138.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.hlsl
new file mode 100644
index 0000000..789f233
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint2 tint_count_trailing_zeros(uint2 v) {
+ uint2 x = uint2(v);
+ const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx);
+ x = (x >> b16);
+ const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx);
+ x = (x >> b8);
+ const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx);
+ x = (x >> b4);
+ const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx);
+ x = (x >> b2);
+ const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx);
+ return uint2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1ad138() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_1ad138();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_1ad138();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_1ad138();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl
new file mode 100644
index 0000000..c9a3f49
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_1ad138() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_1ad138();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_1ad138();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_1ad138();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm
new file mode 100644
index 0000000..e782aa6
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.spvasm
@@ -0,0 +1,142 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 98
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_1ad138 "countTrailingZeros_1ad138"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2uint = OpTypeVector %uint 2
+ %9 = OpTypeFunction %v2uint %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %18 = OpConstantNull %v2uint
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %uint_65535 = OpConstant %uint 65535
+ %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %28 = OpConstantComposite %v2uint %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %35 = OpConstantComposite %v2uint %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v2uint %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %45 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %48 = OpConstantComposite %v2uint %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %55 = OpConstantComposite %v2uint %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %58 = OpConstantComposite %v2uint %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v2uint %uint_1 %uint_1
+ %void = OpTypeVoid
+ %76 = OpTypeFunction %void
+ %84 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %v2uint None %9
+ %v = OpFunctionParameter %v2uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %18
+ OpStore %x %v
+ %23 = OpLoad %v2uint %x
+ %26 = OpBitwiseAnd %v2uint %23 %25
+ %20 = OpINotEqual %v2bool %26 %18
+ %19 = OpSelect %v2uint %20 %18 %28
+ %29 = OpLoad %v2uint %x
+ %30 = OpShiftRightLogical %v2uint %29 %19
+ OpStore %x %30
+ %33 = OpLoad %v2uint %x
+ %36 = OpBitwiseAnd %v2uint %33 %35
+ %32 = OpINotEqual %v2bool %36 %18
+ %31 = OpSelect %v2uint %32 %18 %38
+ %39 = OpLoad %v2uint %x
+ %40 = OpShiftRightLogical %v2uint %39 %31
+ OpStore %x %40
+ %43 = OpLoad %v2uint %x
+ %46 = OpBitwiseAnd %v2uint %43 %45
+ %42 = OpINotEqual %v2bool %46 %18
+ %41 = OpSelect %v2uint %42 %18 %48
+ %49 = OpLoad %v2uint %x
+ %50 = OpShiftRightLogical %v2uint %49 %41
+ OpStore %x %50
+ %53 = OpLoad %v2uint %x
+ %56 = OpBitwiseAnd %v2uint %53 %55
+ %52 = OpINotEqual %v2bool %56 %18
+ %51 = OpSelect %v2uint %52 %18 %58
+ %59 = OpLoad %v2uint %x
+ %60 = OpShiftRightLogical %v2uint %59 %51
+ OpStore %x %60
+ %63 = OpLoad %v2uint %x
+ %66 = OpBitwiseAnd %v2uint %63 %65
+ %62 = OpINotEqual %v2bool %66 %18
+ %61 = OpSelect %v2uint %62 %18 %65
+ %68 = OpLoad %v2uint %x
+ %69 = OpIEqual %v2bool %68 %18
+ %67 = OpSelect %v2uint %69 %65 %18
+ %71 = OpBitwiseOr %v2uint %19 %31
+ %72 = OpBitwiseOr %v2uint %71 %41
+ %73 = OpBitwiseOr %v2uint %72 %51
+ %74 = OpBitwiseOr %v2uint %73 %61
+ %75 = OpIAdd %v2uint %74 %67
+ OpReturnValue %75
+ OpFunctionEnd
+%countTrailingZeros_1ad138 = OpFunction %void None %76
+ %79 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %18
+ %res = OpVariable %_ptr_Function_v2uint Function %18
+ OpStore %arg_0 %18
+ %82 = OpLoad %v2uint %arg_0
+ %81 = OpFunctionCall %v2uint %tint_count_trailing_zeros %82
+ OpStore %res %81
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %84
+ %86 = OpLabel
+ %87 = OpFunctionCall %void %countTrailingZeros_1ad138
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %76
+ %89 = OpLabel
+ %90 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %90
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %76
+ %93 = OpLabel
+ %94 = OpFunctionCall %void %countTrailingZeros_1ad138
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %76
+ %96 = OpLabel
+ %97 = OpFunctionCall %void %countTrailingZeros_1ad138
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl
new file mode 100644
index 0000000..a4169f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1ad138.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_1ad138() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_1ad138();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_1ad138();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_1ad138();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl
new file mode 100644
index 0000000..0834908
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(vec<4, i32>) -> vec<4, i32>
+fn countTrailingZeros_1dc84a() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_1dc84a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_1dc84a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_1dc84a();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl
new file mode 100644
index 0000000..5868bbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec4 tint_count_trailing_zeros(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1dc84a() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_1dc84a();
+ 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;
+
+ivec4 tint_count_trailing_zeros(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1dc84a() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_1dc84a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec4 tint_count_trailing_zeros(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1dc84a() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_1dc84a();
+}
+
+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/countTrailingZeros/1dc84a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.hlsl
new file mode 100644
index 0000000..54f1937
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int4 tint_count_trailing_zeros(int4 v) {
+ uint4 x = uint4(v);
+ const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx);
+ x = (x >> b16);
+ const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx);
+ x = (x >> b8);
+ const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx);
+ x = (x >> b4);
+ const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx);
+ x = (x >> b2);
+ const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx);
+ return int4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_1dc84a() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_1dc84a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_1dc84a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_1dc84a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl
new file mode 100644
index 0000000..0d8f6ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_1dc84a() {
+ int4 arg_0 = int4(0);
+ int4 res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_1dc84a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_1dc84a();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_1dc84a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm
new file mode 100644
index 0000000..e4f2586
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.spvasm
@@ -0,0 +1,148 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 102
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_1dc84a "countTrailingZeros_1dc84a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4int = OpTypeVector %int 4
+ %9 = OpTypeFunction %v4int %v4int
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %20 = OpConstantNull %v4uint
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %uint_65535 = OpConstant %uint 65535
+ %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %78 = OpTypeFunction %void
+ %82 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %88 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %v4int None %9
+ %v = OpFunctionParameter %v4int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %20
+ %15 = OpBitcast %v4uint %v
+ OpStore %x %15
+ %25 = OpLoad %v4uint %x
+ %28 = OpBitwiseAnd %v4uint %25 %27
+ %22 = OpINotEqual %v4bool %28 %20
+ %21 = OpSelect %v4uint %22 %20 %30
+ %31 = OpLoad %v4uint %x
+ %32 = OpShiftRightLogical %v4uint %31 %21
+ OpStore %x %32
+ %35 = OpLoad %v4uint %x
+ %38 = OpBitwiseAnd %v4uint %35 %37
+ %34 = OpINotEqual %v4bool %38 %20
+ %33 = OpSelect %v4uint %34 %20 %40
+ %41 = OpLoad %v4uint %x
+ %42 = OpShiftRightLogical %v4uint %41 %33
+ OpStore %x %42
+ %45 = OpLoad %v4uint %x
+ %48 = OpBitwiseAnd %v4uint %45 %47
+ %44 = OpINotEqual %v4bool %48 %20
+ %43 = OpSelect %v4uint %44 %20 %50
+ %51 = OpLoad %v4uint %x
+ %52 = OpShiftRightLogical %v4uint %51 %43
+ OpStore %x %52
+ %55 = OpLoad %v4uint %x
+ %58 = OpBitwiseAnd %v4uint %55 %57
+ %54 = OpINotEqual %v4bool %58 %20
+ %53 = OpSelect %v4uint %54 %20 %60
+ %61 = OpLoad %v4uint %x
+ %62 = OpShiftRightLogical %v4uint %61 %53
+ OpStore %x %62
+ %65 = OpLoad %v4uint %x
+ %68 = OpBitwiseAnd %v4uint %65 %67
+ %64 = OpINotEqual %v4bool %68 %20
+ %63 = OpSelect %v4uint %64 %20 %67
+ %70 = OpLoad %v4uint %x
+ %71 = OpIEqual %v4bool %70 %20
+ %69 = OpSelect %v4uint %71 %67 %20
+ %73 = OpBitwiseOr %v4uint %21 %33
+ %74 = OpBitwiseOr %v4uint %73 %43
+ %75 = OpBitwiseOr %v4uint %74 %53
+ %76 = OpBitwiseOr %v4uint %75 %63
+ %77 = OpIAdd %v4uint %76 %69
+ %72 = OpBitcast %v4int %77
+ OpReturnValue %72
+ OpFunctionEnd
+%countTrailingZeros_1dc84a = OpFunction %void None %78
+ %81 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %82
+ %res = OpVariable %_ptr_Function_v4int Function %82
+ OpStore %arg_0 %82
+ %86 = OpLoad %v4int %arg_0
+ %85 = OpFunctionCall %v4int %tint_count_trailing_zeros %86
+ OpStore %res %85
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %88
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %countTrailingZeros_1dc84a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %78
+ %93 = OpLabel
+ %94 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %94
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %78
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %countTrailingZeros_1dc84a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %78
+ %100 = OpLabel
+ %101 = OpFunctionCall %void %countTrailingZeros_1dc84a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl
new file mode 100644
index 0000000..e3d95b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/1dc84a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_1dc84a() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_1dc84a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_1dc84a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_1dc84a();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl
new file mode 100644
index 0000000..9259500
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(u32) -> u32
+fn countTrailingZeros_21e394() {
+ var arg_0 = 1u;
+ var res: u32 = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_21e394();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_21e394();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_21e394();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl
new file mode 100644
index 0000000..8995ab5
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uint tint_count_trailing_zeros(uint v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_21e394() {
+ uint arg_0 = 1u;
+ uint res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_21e394();
+ 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;
+
+uint tint_count_trailing_zeros(uint v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_21e394() {
+ uint arg_0 = 1u;
+ uint res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_21e394();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_count_trailing_zeros(uint v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_21e394() {
+ uint arg_0 = 1u;
+ uint res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_21e394();
+}
+
+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/countTrailingZeros/21e394.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.hlsl
new file mode 100644
index 0000000..4581899
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint tint_count_trailing_zeros(uint v) {
+ uint x = uint(v);
+ const uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ const uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ const uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ const uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ const uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ const uint is_zero = ((x == 0u) ? 1u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_21e394() {
+ uint arg_0 = 1u;
+ uint res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_21e394();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_21e394();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_21e394();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl
new file mode 100644
index 0000000..6c9c987
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_21e394() {
+ uint arg_0 = 1u;
+ uint res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_21e394();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_21e394();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_21e394();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm
new file mode 100644
index 0000000..afa8fca
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.spvasm
@@ -0,0 +1,131 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 87
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_21e394 "countTrailingZeros_21e394"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %uint %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %bool = OpTypeBool
+ %uint_65535 = OpConstant %uint 65535
+ %uint_16 = OpConstant %uint 16
+ %uint_255 = OpConstant %uint 255
+ %uint_8 = OpConstant %uint 8
+ %uint_15 = OpConstant %uint 15
+ %uint_4 = OpConstant %uint 4
+ %uint_3 = OpConstant %uint 3
+ %uint_2 = OpConstant %uint 2
+ %uint_1 = OpConstant %uint 1
+ %void = OpTypeVoid
+ %65 = OpTypeFunction %void
+ %73 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %uint None %9
+ %v = OpFunctionParameter %uint
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %17
+ OpStore %x %v
+ %21 = OpLoad %uint %x
+ %23 = OpBitwiseAnd %uint %21 %uint_65535
+ %19 = OpINotEqual %bool %23 %17
+ %18 = OpSelect %uint %19 %17 %uint_16
+ %25 = OpLoad %uint %x
+ %26 = OpShiftRightLogical %uint %25 %18
+ OpStore %x %26
+ %29 = OpLoad %uint %x
+ %31 = OpBitwiseAnd %uint %29 %uint_255
+ %28 = OpINotEqual %bool %31 %17
+ %27 = OpSelect %uint %28 %17 %uint_8
+ %33 = OpLoad %uint %x
+ %34 = OpShiftRightLogical %uint %33 %27
+ OpStore %x %34
+ %37 = OpLoad %uint %x
+ %39 = OpBitwiseAnd %uint %37 %uint_15
+ %36 = OpINotEqual %bool %39 %17
+ %35 = OpSelect %uint %36 %17 %uint_4
+ %41 = OpLoad %uint %x
+ %42 = OpShiftRightLogical %uint %41 %35
+ OpStore %x %42
+ %45 = OpLoad %uint %x
+ %47 = OpBitwiseAnd %uint %45 %uint_3
+ %44 = OpINotEqual %bool %47 %17
+ %43 = OpSelect %uint %44 %17 %uint_2
+ %49 = OpLoad %uint %x
+ %50 = OpShiftRightLogical %uint %49 %43
+ OpStore %x %50
+ %53 = OpLoad %uint %x
+ %55 = OpBitwiseAnd %uint %53 %uint_1
+ %52 = OpINotEqual %bool %55 %17
+ %51 = OpSelect %uint %52 %17 %uint_1
+ %57 = OpLoad %uint %x
+ %58 = OpIEqual %bool %57 %17
+ %56 = OpSelect %uint %58 %uint_1 %17
+ %60 = OpBitwiseOr %uint %18 %27
+ %61 = OpBitwiseOr %uint %60 %35
+ %62 = OpBitwiseOr %uint %61 %43
+ %63 = OpBitwiseOr %uint %62 %51
+ %64 = OpIAdd %uint %63 %56
+ OpReturnValue %64
+ OpFunctionEnd
+%countTrailingZeros_21e394 = OpFunction %void None %65
+ %68 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ %71 = OpLoad %uint %arg_0
+ %70 = OpFunctionCall %uint %tint_count_trailing_zeros %71
+ OpStore %res %70
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %73
+ %75 = OpLabel
+ %76 = OpFunctionCall %void %countTrailingZeros_21e394
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %65
+ %78 = OpLabel
+ %79 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %79
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %65
+ %82 = OpLabel
+ %83 = OpFunctionCall %void %countTrailingZeros_21e394
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %65
+ %85 = OpLabel
+ %86 = OpFunctionCall %void %countTrailingZeros_21e394
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl
new file mode 100644
index 0000000..3756bcf
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/21e394.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_21e394() {
+ var arg_0 = 1u;
+ var res : u32 = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_21e394();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_21e394();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_21e394();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl
new file mode 100644
index 0000000..f4a72e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(vec<2, i32>) -> vec<2, i32>
+fn countTrailingZeros_327c37() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_327c37();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_327c37();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_327c37();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl
new file mode 100644
index 0000000..192df07
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec2 tint_count_trailing_zeros(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_327c37() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_327c37();
+ 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;
+
+ivec2 tint_count_trailing_zeros(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_327c37() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_327c37();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec2 tint_count_trailing_zeros(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(1u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_327c37() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_327c37();
+}
+
+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/countTrailingZeros/327c37.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.hlsl
new file mode 100644
index 0000000..2be49d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int2 tint_count_trailing_zeros(int2 v) {
+ uint2 x = uint2(v);
+ const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx);
+ x = (x >> b16);
+ const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx);
+ x = (x >> b8);
+ const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx);
+ x = (x >> b4);
+ const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx);
+ x = (x >> b2);
+ const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (1u).xx : (0u).xx);
+ return int2((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_327c37() {
+ int2 arg_0 = (0).xx;
+ int2 res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_327c37();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_327c37();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_327c37();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl
new file mode 100644
index 0000000..c0a88c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_327c37() {
+ int2 arg_0 = int2(0);
+ int2 res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_327c37();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_327c37();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_327c37();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm
new file mode 100644
index 0000000..8c108bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.spvasm
@@ -0,0 +1,148 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 102
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_327c37 "countTrailingZeros_327c37"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2int = OpTypeVector %int 2
+ %9 = OpTypeFunction %v2int %v2int
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %20 = OpConstantNull %v2uint
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %uint_65535 = OpConstant %uint 65535
+ %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %30 = OpConstantComposite %v2uint %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %37 = OpConstantComposite %v2uint %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %40 = OpConstantComposite %v2uint %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %47 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %50 = OpConstantComposite %v2uint %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %57 = OpConstantComposite %v2uint %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %60 = OpConstantComposite %v2uint %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %67 = OpConstantComposite %v2uint %uint_1 %uint_1
+ %void = OpTypeVoid
+ %78 = OpTypeFunction %void
+ %82 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %88 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %v2int None %9
+ %v = OpFunctionParameter %v2int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %20
+ %15 = OpBitcast %v2uint %v
+ OpStore %x %15
+ %25 = OpLoad %v2uint %x
+ %28 = OpBitwiseAnd %v2uint %25 %27
+ %22 = OpINotEqual %v2bool %28 %20
+ %21 = OpSelect %v2uint %22 %20 %30
+ %31 = OpLoad %v2uint %x
+ %32 = OpShiftRightLogical %v2uint %31 %21
+ OpStore %x %32
+ %35 = OpLoad %v2uint %x
+ %38 = OpBitwiseAnd %v2uint %35 %37
+ %34 = OpINotEqual %v2bool %38 %20
+ %33 = OpSelect %v2uint %34 %20 %40
+ %41 = OpLoad %v2uint %x
+ %42 = OpShiftRightLogical %v2uint %41 %33
+ OpStore %x %42
+ %45 = OpLoad %v2uint %x
+ %48 = OpBitwiseAnd %v2uint %45 %47
+ %44 = OpINotEqual %v2bool %48 %20
+ %43 = OpSelect %v2uint %44 %20 %50
+ %51 = OpLoad %v2uint %x
+ %52 = OpShiftRightLogical %v2uint %51 %43
+ OpStore %x %52
+ %55 = OpLoad %v2uint %x
+ %58 = OpBitwiseAnd %v2uint %55 %57
+ %54 = OpINotEqual %v2bool %58 %20
+ %53 = OpSelect %v2uint %54 %20 %60
+ %61 = OpLoad %v2uint %x
+ %62 = OpShiftRightLogical %v2uint %61 %53
+ OpStore %x %62
+ %65 = OpLoad %v2uint %x
+ %68 = OpBitwiseAnd %v2uint %65 %67
+ %64 = OpINotEqual %v2bool %68 %20
+ %63 = OpSelect %v2uint %64 %20 %67
+ %70 = OpLoad %v2uint %x
+ %71 = OpIEqual %v2bool %70 %20
+ %69 = OpSelect %v2uint %71 %67 %20
+ %73 = OpBitwiseOr %v2uint %21 %33
+ %74 = OpBitwiseOr %v2uint %73 %43
+ %75 = OpBitwiseOr %v2uint %74 %53
+ %76 = OpBitwiseOr %v2uint %75 %63
+ %77 = OpIAdd %v2uint %76 %69
+ %72 = OpBitcast %v2int %77
+ OpReturnValue %72
+ OpFunctionEnd
+%countTrailingZeros_327c37 = OpFunction %void None %78
+ %81 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %82
+ %res = OpVariable %_ptr_Function_v2int Function %82
+ OpStore %arg_0 %82
+ %86 = OpLoad %v2int %arg_0
+ %85 = OpFunctionCall %v2int %tint_count_trailing_zeros %86
+ OpStore %res %85
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %88
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %countTrailingZeros_327c37
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %78
+ %93 = OpLabel
+ %94 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %94
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %78
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %countTrailingZeros_327c37
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %78
+ %100 = OpLabel
+ %101 = OpFunctionCall %void %countTrailingZeros_327c37
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl
new file mode 100644
index 0000000..f235ce1
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/327c37.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_327c37() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_327c37();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_327c37();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_327c37();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl
new file mode 100644
index 0000000..9d3a884
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(i32) -> i32
+fn countTrailingZeros_42fed6() {
+ var arg_0 = 1;
+ var res: i32 = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_42fed6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_42fed6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_42fed6();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl
new file mode 100644
index 0000000..80ff533
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+int tint_count_trailing_zeros(int v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_42fed6() {
+ int arg_0 = 1;
+ int res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_42fed6();
+ 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;
+
+int tint_count_trailing_zeros(int v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_42fed6() {
+ int arg_0 = 1;
+ int res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_42fed6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_count_trailing_zeros(int v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_42fed6() {
+ int arg_0 = 1;
+ int res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_42fed6();
+}
+
+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/countTrailingZeros/42fed6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.hlsl
new file mode 100644
index 0000000..464986a
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int tint_count_trailing_zeros(int v) {
+ uint x = uint(v);
+ const uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ const uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ const uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ const uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ const uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ const uint is_zero = ((x == 0u) ? 1u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_42fed6() {
+ int arg_0 = 1;
+ int res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_42fed6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_42fed6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_42fed6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl
new file mode 100644
index 0000000..6811b6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_42fed6() {
+ int arg_0 = 1;
+ int res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_42fed6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_42fed6();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_42fed6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm
new file mode 100644
index 0000000..f727b4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.spvasm
@@ -0,0 +1,137 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 91
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_42fed6 "countTrailingZeros_42fed6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %int %int
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %18 = OpConstantNull %uint
+ %bool = OpTypeBool
+ %uint_65535 = OpConstant %uint 65535
+ %uint_16 = OpConstant %uint 16
+ %uint_255 = OpConstant %uint 255
+ %uint_8 = OpConstant %uint 8
+ %uint_15 = OpConstant %uint 15
+ %uint_4 = OpConstant %uint 4
+ %uint_3 = OpConstant %uint 3
+ %uint_2 = OpConstant %uint 2
+ %uint_1 = OpConstant %uint 1
+ %void = OpTypeVoid
+ %66 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %73 = OpConstantNull %int
+ %77 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %int None %9
+ %v = OpFunctionParameter %int
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %18
+ %14 = OpBitcast %uint %v
+ OpStore %x %14
+ %22 = OpLoad %uint %x
+ %24 = OpBitwiseAnd %uint %22 %uint_65535
+ %20 = OpINotEqual %bool %24 %18
+ %19 = OpSelect %uint %20 %18 %uint_16
+ %26 = OpLoad %uint %x
+ %27 = OpShiftRightLogical %uint %26 %19
+ OpStore %x %27
+ %30 = OpLoad %uint %x
+ %32 = OpBitwiseAnd %uint %30 %uint_255
+ %29 = OpINotEqual %bool %32 %18
+ %28 = OpSelect %uint %29 %18 %uint_8
+ %34 = OpLoad %uint %x
+ %35 = OpShiftRightLogical %uint %34 %28
+ OpStore %x %35
+ %38 = OpLoad %uint %x
+ %40 = OpBitwiseAnd %uint %38 %uint_15
+ %37 = OpINotEqual %bool %40 %18
+ %36 = OpSelect %uint %37 %18 %uint_4
+ %42 = OpLoad %uint %x
+ %43 = OpShiftRightLogical %uint %42 %36
+ OpStore %x %43
+ %46 = OpLoad %uint %x
+ %48 = OpBitwiseAnd %uint %46 %uint_3
+ %45 = OpINotEqual %bool %48 %18
+ %44 = OpSelect %uint %45 %18 %uint_2
+ %50 = OpLoad %uint %x
+ %51 = OpShiftRightLogical %uint %50 %44
+ OpStore %x %51
+ %54 = OpLoad %uint %x
+ %56 = OpBitwiseAnd %uint %54 %uint_1
+ %53 = OpINotEqual %bool %56 %18
+ %52 = OpSelect %uint %53 %18 %uint_1
+ %58 = OpLoad %uint %x
+ %59 = OpIEqual %bool %58 %18
+ %57 = OpSelect %uint %59 %uint_1 %18
+ %61 = OpBitwiseOr %uint %19 %28
+ %62 = OpBitwiseOr %uint %61 %36
+ %63 = OpBitwiseOr %uint %62 %44
+ %64 = OpBitwiseOr %uint %63 %52
+ %65 = OpIAdd %uint %64 %57
+ %60 = OpBitcast %int %65
+ OpReturnValue %60
+ OpFunctionEnd
+%countTrailingZeros_42fed6 = OpFunction %void None %66
+ %69 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %73
+ %res = OpVariable %_ptr_Function_int Function %73
+ OpStore %arg_0 %int_1
+ %75 = OpLoad %int %arg_0
+ %74 = OpFunctionCall %int %tint_count_trailing_zeros %75
+ OpStore %res %74
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %77
+ %79 = OpLabel
+ %80 = OpFunctionCall %void %countTrailingZeros_42fed6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %66
+ %82 = OpLabel
+ %83 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %83
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %66
+ %86 = OpLabel
+ %87 = OpFunctionCall %void %countTrailingZeros_42fed6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %66
+ %89 = OpLabel
+ %90 = OpFunctionCall %void %countTrailingZeros_42fed6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl
new file mode 100644
index 0000000..536a7c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/42fed6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_42fed6() {
+ var arg_0 = 1;
+ var res : i32 = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_42fed6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_42fed6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_42fed6();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl
new file mode 100644
index 0000000..e64b6a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(vec<3, u32>) -> vec<3, u32>
+fn countTrailingZeros_8ed26f() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_8ed26f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_8ed26f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_8ed26f();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl
new file mode 100644
index 0000000..84eee22
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec3 tint_count_trailing_zeros(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_8ed26f() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_8ed26f();
+ 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;
+
+uvec3 tint_count_trailing_zeros(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_8ed26f() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_8ed26f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec3 tint_count_trailing_zeros(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_8ed26f() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_8ed26f();
+}
+
+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/countTrailingZeros/8ed26f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.hlsl
new file mode 100644
index 0000000..8f96543
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint3 tint_count_trailing_zeros(uint3 v) {
+ uint3 x = uint3(v);
+ const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx);
+ x = (x >> b16);
+ const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx);
+ x = (x >> b8);
+ const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx);
+ x = (x >> b4);
+ const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx);
+ x = (x >> b2);
+ const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx);
+ return uint3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_8ed26f() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_8ed26f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_8ed26f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_8ed26f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl
new file mode 100644
index 0000000..04bd4b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_8ed26f() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_8ed26f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_8ed26f();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_8ed26f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm
new file mode 100644
index 0000000..bc80f73
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.spvasm
@@ -0,0 +1,142 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 98
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_8ed26f "countTrailingZeros_8ed26f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3uint = OpTypeVector %uint 3
+ %9 = OpTypeFunction %v3uint %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %18 = OpConstantNull %v3uint
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %uint_65535 = OpConstant %uint 65535
+ %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %76 = OpTypeFunction %void
+ %84 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %v3uint None %9
+ %v = OpFunctionParameter %v3uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %18
+ OpStore %x %v
+ %23 = OpLoad %v3uint %x
+ %26 = OpBitwiseAnd %v3uint %23 %25
+ %20 = OpINotEqual %v3bool %26 %18
+ %19 = OpSelect %v3uint %20 %18 %28
+ %29 = OpLoad %v3uint %x
+ %30 = OpShiftRightLogical %v3uint %29 %19
+ OpStore %x %30
+ %33 = OpLoad %v3uint %x
+ %36 = OpBitwiseAnd %v3uint %33 %35
+ %32 = OpINotEqual %v3bool %36 %18
+ %31 = OpSelect %v3uint %32 %18 %38
+ %39 = OpLoad %v3uint %x
+ %40 = OpShiftRightLogical %v3uint %39 %31
+ OpStore %x %40
+ %43 = OpLoad %v3uint %x
+ %46 = OpBitwiseAnd %v3uint %43 %45
+ %42 = OpINotEqual %v3bool %46 %18
+ %41 = OpSelect %v3uint %42 %18 %48
+ %49 = OpLoad %v3uint %x
+ %50 = OpShiftRightLogical %v3uint %49 %41
+ OpStore %x %50
+ %53 = OpLoad %v3uint %x
+ %56 = OpBitwiseAnd %v3uint %53 %55
+ %52 = OpINotEqual %v3bool %56 %18
+ %51 = OpSelect %v3uint %52 %18 %58
+ %59 = OpLoad %v3uint %x
+ %60 = OpShiftRightLogical %v3uint %59 %51
+ OpStore %x %60
+ %63 = OpLoad %v3uint %x
+ %66 = OpBitwiseAnd %v3uint %63 %65
+ %62 = OpINotEqual %v3bool %66 %18
+ %61 = OpSelect %v3uint %62 %18 %65
+ %68 = OpLoad %v3uint %x
+ %69 = OpIEqual %v3bool %68 %18
+ %67 = OpSelect %v3uint %69 %65 %18
+ %71 = OpBitwiseOr %v3uint %19 %31
+ %72 = OpBitwiseOr %v3uint %71 %41
+ %73 = OpBitwiseOr %v3uint %72 %51
+ %74 = OpBitwiseOr %v3uint %73 %61
+ %75 = OpIAdd %v3uint %74 %67
+ OpReturnValue %75
+ OpFunctionEnd
+%countTrailingZeros_8ed26f = OpFunction %void None %76
+ %79 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %18
+ %res = OpVariable %_ptr_Function_v3uint Function %18
+ OpStore %arg_0 %18
+ %82 = OpLoad %v3uint %arg_0
+ %81 = OpFunctionCall %v3uint %tint_count_trailing_zeros %82
+ OpStore %res %81
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %84
+ %86 = OpLabel
+ %87 = OpFunctionCall %void %countTrailingZeros_8ed26f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %76
+ %89 = OpLabel
+ %90 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %90
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %76
+ %93 = OpLabel
+ %94 = OpFunctionCall %void %countTrailingZeros_8ed26f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %76
+ %96 = OpLabel
+ %97 = OpFunctionCall %void %countTrailingZeros_8ed26f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl
new file mode 100644
index 0000000..61986c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/8ed26f.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_8ed26f() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_8ed26f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_8ed26f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_8ed26f();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl
new file mode 100644
index 0000000..0da23de
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(vec<3, i32>) -> vec<3, i32>
+fn countTrailingZeros_acfacb() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_acfacb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_acfacb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_acfacb();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl
new file mode 100644
index 0000000..01d97fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec3 tint_count_trailing_zeros(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_acfacb() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_acfacb();
+ 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;
+
+ivec3 tint_count_trailing_zeros(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_acfacb() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_acfacb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec3 tint_count_trailing_zeros(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(1u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_acfacb() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_acfacb();
+}
+
+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/countTrailingZeros/acfacb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.hlsl
new file mode 100644
index 0000000..c3f8ccd
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int3 tint_count_trailing_zeros(int3 v) {
+ uint3 x = uint3(v);
+ const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx);
+ x = (x >> b16);
+ const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx);
+ x = (x >> b8);
+ const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx);
+ x = (x >> b4);
+ const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx);
+ x = (x >> b2);
+ const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (1u).xxx : (0u).xxx);
+ return int3((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_acfacb() {
+ int3 arg_0 = (0).xxx;
+ int3 res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_acfacb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_acfacb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_acfacb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl
new file mode 100644
index 0000000..53c17f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_acfacb() {
+ int3 arg_0 = int3(0);
+ int3 res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_acfacb();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_acfacb();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_acfacb();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm
new file mode 100644
index 0000000..b931079
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.spvasm
@@ -0,0 +1,148 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 102
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_acfacb "countTrailingZeros_acfacb"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %9 = OpTypeFunction %v3int %v3int
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %20 = OpConstantNull %v3uint
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %uint_65535 = OpConstant %uint 65535
+ %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %78 = OpTypeFunction %void
+ %82 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %88 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %v3int None %9
+ %v = OpFunctionParameter %v3int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %20
+ %15 = OpBitcast %v3uint %v
+ OpStore %x %15
+ %25 = OpLoad %v3uint %x
+ %28 = OpBitwiseAnd %v3uint %25 %27
+ %22 = OpINotEqual %v3bool %28 %20
+ %21 = OpSelect %v3uint %22 %20 %30
+ %31 = OpLoad %v3uint %x
+ %32 = OpShiftRightLogical %v3uint %31 %21
+ OpStore %x %32
+ %35 = OpLoad %v3uint %x
+ %38 = OpBitwiseAnd %v3uint %35 %37
+ %34 = OpINotEqual %v3bool %38 %20
+ %33 = OpSelect %v3uint %34 %20 %40
+ %41 = OpLoad %v3uint %x
+ %42 = OpShiftRightLogical %v3uint %41 %33
+ OpStore %x %42
+ %45 = OpLoad %v3uint %x
+ %48 = OpBitwiseAnd %v3uint %45 %47
+ %44 = OpINotEqual %v3bool %48 %20
+ %43 = OpSelect %v3uint %44 %20 %50
+ %51 = OpLoad %v3uint %x
+ %52 = OpShiftRightLogical %v3uint %51 %43
+ OpStore %x %52
+ %55 = OpLoad %v3uint %x
+ %58 = OpBitwiseAnd %v3uint %55 %57
+ %54 = OpINotEqual %v3bool %58 %20
+ %53 = OpSelect %v3uint %54 %20 %60
+ %61 = OpLoad %v3uint %x
+ %62 = OpShiftRightLogical %v3uint %61 %53
+ OpStore %x %62
+ %65 = OpLoad %v3uint %x
+ %68 = OpBitwiseAnd %v3uint %65 %67
+ %64 = OpINotEqual %v3bool %68 %20
+ %63 = OpSelect %v3uint %64 %20 %67
+ %70 = OpLoad %v3uint %x
+ %71 = OpIEqual %v3bool %70 %20
+ %69 = OpSelect %v3uint %71 %67 %20
+ %73 = OpBitwiseOr %v3uint %21 %33
+ %74 = OpBitwiseOr %v3uint %73 %43
+ %75 = OpBitwiseOr %v3uint %74 %53
+ %76 = OpBitwiseOr %v3uint %75 %63
+ %77 = OpIAdd %v3uint %76 %69
+ %72 = OpBitcast %v3int %77
+ OpReturnValue %72
+ OpFunctionEnd
+%countTrailingZeros_acfacb = OpFunction %void None %78
+ %81 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %82
+ %res = OpVariable %_ptr_Function_v3int Function %82
+ OpStore %arg_0 %82
+ %86 = OpLoad %v3int %arg_0
+ %85 = OpFunctionCall %v3int %tint_count_trailing_zeros %86
+ OpStore %res %85
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %88
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %countTrailingZeros_acfacb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %78
+ %93 = OpLabel
+ %94 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %94
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %78
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %countTrailingZeros_acfacb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %78
+ %100 = OpLabel
+ %101 = OpFunctionCall %void %countTrailingZeros_acfacb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl
new file mode 100644
index 0000000..e93b279
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/acfacb.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_acfacb() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_acfacb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_acfacb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_acfacb();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl
new file mode 100644
index 0000000..b94c3b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn countTrailingZeros(vec<4, u32>) -> vec<4, u32>
+fn countTrailingZeros_d2b4a0() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_d2b4a0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_d2b4a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_d2b4a0();
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl
new file mode 100644
index 0000000..10c75b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec4 tint_count_trailing_zeros(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_d2b4a0() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_count_trailing_zeros(arg_0);
+}
+
+vec4 vertex_main() {
+ countTrailingZeros_d2b4a0();
+ 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;
+
+uvec4 tint_count_trailing_zeros(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_d2b4a0() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_count_trailing_zeros(arg_0);
+}
+
+void fragment_main() {
+ countTrailingZeros_d2b4a0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec4 tint_count_trailing_zeros(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(1u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_d2b4a0() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_count_trailing_zeros(arg_0);
+}
+
+void compute_main() {
+ countTrailingZeros_d2b4a0();
+}
+
+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/countTrailingZeros/d2b4a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.hlsl
new file mode 100644
index 0000000..0c41a61
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint4 tint_count_trailing_zeros(uint4 v) {
+ uint4 x = uint4(v);
+ const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx);
+ x = (x >> b16);
+ const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx);
+ x = (x >> b8);
+ const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx);
+ x = (x >> b4);
+ const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx);
+ x = (x >> b2);
+ const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (1u).xxxx : (0u).xxxx);
+ return uint4((((((b16 | b8) | b4) | b2) | b1) + is_zero));
+}
+
+void countTrailingZeros_d2b4a0() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = tint_count_trailing_zeros(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_d2b4a0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ countTrailingZeros_d2b4a0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ countTrailingZeros_d2b4a0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl
new file mode 100644
index 0000000..9a23cef
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void countTrailingZeros_d2b4a0() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = ctz(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ countTrailingZeros_d2b4a0();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ countTrailingZeros_d2b4a0();
+ return;
+}
+
+kernel void compute_main() {
+ countTrailingZeros_d2b4a0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm
new file mode 100644
index 0000000..ebce4b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.spvasm
@@ -0,0 +1,142 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 98
+; 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 %tint_count_trailing_zeros "tint_count_trailing_zeros"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %countTrailingZeros_d2b4a0 "countTrailingZeros_d2b4a0"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4uint = OpTypeVector %uint 4
+ %9 = OpTypeFunction %v4uint %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %18 = OpConstantNull %v4uint
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %uint_65535 = OpConstant %uint 65535
+ %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+ %void = OpTypeVoid
+ %76 = OpTypeFunction %void
+ %84 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_count_trailing_zeros = OpFunction %v4uint None %9
+ %v = OpFunctionParameter %v4uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %18
+ OpStore %x %v
+ %23 = OpLoad %v4uint %x
+ %26 = OpBitwiseAnd %v4uint %23 %25
+ %20 = OpINotEqual %v4bool %26 %18
+ %19 = OpSelect %v4uint %20 %18 %28
+ %29 = OpLoad %v4uint %x
+ %30 = OpShiftRightLogical %v4uint %29 %19
+ OpStore %x %30
+ %33 = OpLoad %v4uint %x
+ %36 = OpBitwiseAnd %v4uint %33 %35
+ %32 = OpINotEqual %v4bool %36 %18
+ %31 = OpSelect %v4uint %32 %18 %38
+ %39 = OpLoad %v4uint %x
+ %40 = OpShiftRightLogical %v4uint %39 %31
+ OpStore %x %40
+ %43 = OpLoad %v4uint %x
+ %46 = OpBitwiseAnd %v4uint %43 %45
+ %42 = OpINotEqual %v4bool %46 %18
+ %41 = OpSelect %v4uint %42 %18 %48
+ %49 = OpLoad %v4uint %x
+ %50 = OpShiftRightLogical %v4uint %49 %41
+ OpStore %x %50
+ %53 = OpLoad %v4uint %x
+ %56 = OpBitwiseAnd %v4uint %53 %55
+ %52 = OpINotEqual %v4bool %56 %18
+ %51 = OpSelect %v4uint %52 %18 %58
+ %59 = OpLoad %v4uint %x
+ %60 = OpShiftRightLogical %v4uint %59 %51
+ OpStore %x %60
+ %63 = OpLoad %v4uint %x
+ %66 = OpBitwiseAnd %v4uint %63 %65
+ %62 = OpINotEqual %v4bool %66 %18
+ %61 = OpSelect %v4uint %62 %18 %65
+ %68 = OpLoad %v4uint %x
+ %69 = OpIEqual %v4bool %68 %18
+ %67 = OpSelect %v4uint %69 %65 %18
+ %71 = OpBitwiseOr %v4uint %19 %31
+ %72 = OpBitwiseOr %v4uint %71 %41
+ %73 = OpBitwiseOr %v4uint %72 %51
+ %74 = OpBitwiseOr %v4uint %73 %61
+ %75 = OpIAdd %v4uint %74 %67
+ OpReturnValue %75
+ OpFunctionEnd
+%countTrailingZeros_d2b4a0 = OpFunction %void None %76
+ %79 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %18
+ %res = OpVariable %_ptr_Function_v4uint Function %18
+ OpStore %arg_0 %18
+ %82 = OpLoad %v4uint %arg_0
+ %81 = OpFunctionCall %v4uint %tint_count_trailing_zeros %82
+ OpStore %res %81
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %84
+ %86 = OpLabel
+ %87 = OpFunctionCall %void %countTrailingZeros_d2b4a0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %76
+ %89 = OpLabel
+ %90 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %90
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %76
+ %93 = OpLabel
+ %94 = OpFunctionCall %void %countTrailingZeros_d2b4a0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %76
+ %96 = OpLabel
+ %97 = OpFunctionCall %void %countTrailingZeros_d2b4a0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl
new file mode 100644
index 0000000..8f10ca0
--- /dev/null
+++ b/test/tint/builtins/gen/var/countTrailingZeros/d2b4a0.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn countTrailingZeros_d2b4a0() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = countTrailingZeros(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ countTrailingZeros_d2b4a0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ countTrailingZeros_d2b4a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ countTrailingZeros_d2b4a0();
+}
diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl
new file mode 100644
index 0000000..6bcfcba
--- /dev/null
+++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn cross(vec3<f32>, vec3<f32>) -> vec3<f32>
+fn cross_041cb0() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = cross(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cross_041cb0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cross_041cb0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cross_041cb0();
+}
diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl
new file mode 100644
index 0000000..87cb9a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void cross_041cb0() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = cross(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ cross_041cb0();
+ 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;
+
+void cross_041cb0() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = cross(arg_0, arg_1);
+}
+
+void fragment_main() {
+ cross_041cb0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void cross_041cb0() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = cross(arg_0, arg_1);
+}
+
+void compute_main() {
+ cross_041cb0();
+}
+
+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/cross/041cb0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.hlsl
new file mode 100644
index 0000000..272645f
--- /dev/null
+++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void cross_041cb0() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = cross(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ cross_041cb0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ cross_041cb0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ cross_041cb0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl
new file mode 100644
index 0000000..4966939
--- /dev/null
+++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void cross_041cb0() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = cross(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ cross_041cb0();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ cross_041cb0();
+ return;
+}
+
+kernel void compute_main() {
+ cross_041cb0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm
new file mode 100644
index 0000000..f7a1245
--- /dev/null
+++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %cross_041cb0 "cross_041cb0"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%cross_041cb0 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 Cross %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %cross_041cb0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %cross_041cb0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %cross_041cb0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl
new file mode 100644
index 0000000..9789b37
--- /dev/null
+++ b/test/tint/builtins/gen/var/cross/041cb0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn cross_041cb0() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = cross(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ cross_041cb0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ cross_041cb0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ cross_041cb0();
+}
diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl
new file mode 100644
index 0000000..ca3ab63
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn degrees(vec<4, f32>) -> vec<4, f32>
+fn degrees_0d170c() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_0d170c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_0d170c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_0d170c();
+}
diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl
new file mode 100644
index 0000000..7050d43
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+vec4 tint_degrees(vec4 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_0d170c() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tint_degrees(arg_0);
+}
+
+vec4 vertex_main() {
+ degrees_0d170c();
+ 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;
+
+vec4 tint_degrees(vec4 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_0d170c() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tint_degrees(arg_0);
+}
+
+void fragment_main() {
+ degrees_0d170c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+vec4 tint_degrees(vec4 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_0d170c() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tint_degrees(arg_0);
+}
+
+void compute_main() {
+ degrees_0d170c();
+}
+
+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/degrees/0d170c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.hlsl
new file mode 100644
index 0000000..707abe1
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float4 tint_degrees(float4 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_0d170c() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_0d170c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ degrees_0d170c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_0d170c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl
new file mode 100644
index 0000000..7f80ac7
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float4 tint_degrees(float4 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_0d170c() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_0d170c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ degrees_0d170c();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_0d170c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm
new file mode 100644
index 0000000..b0850ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %degrees_0d170c "degrees_0d170c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_0d170c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Degrees %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %degrees_0d170c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_0d170c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_0d170c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl
new file mode 100644
index 0000000..921b7ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/0d170c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_0d170c() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_0d170c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_0d170c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_0d170c();
+}
diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl
new file mode 100644
index 0000000..7b72b45
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn degrees(vec<2, f32>) -> vec<2, f32>
+fn degrees_1ad5df() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_1ad5df();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_1ad5df();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_1ad5df();
+}
diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl
new file mode 100644
index 0000000..303eb31
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+vec2 tint_degrees(vec2 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_1ad5df() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tint_degrees(arg_0);
+}
+
+vec4 vertex_main() {
+ degrees_1ad5df();
+ 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;
+
+vec2 tint_degrees(vec2 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_1ad5df() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tint_degrees(arg_0);
+}
+
+void fragment_main() {
+ degrees_1ad5df();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+vec2 tint_degrees(vec2 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_1ad5df() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tint_degrees(arg_0);
+}
+
+void compute_main() {
+ degrees_1ad5df();
+}
+
+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/degrees/1ad5df.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.hlsl
new file mode 100644
index 0000000..c2b98c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float2 tint_degrees(float2 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_1ad5df() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_1ad5df();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ degrees_1ad5df();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_1ad5df();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl
new file mode 100644
index 0000000..e53ab1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float2 tint_degrees(float2 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_1ad5df() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_1ad5df();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ degrees_1ad5df();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_1ad5df();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm
new file mode 100644
index 0000000..84f8a46
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %degrees_1ad5df "degrees_1ad5df"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_1ad5df = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Degrees %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %degrees_1ad5df
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %degrees_1ad5df
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %degrees_1ad5df
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl
new file mode 100644
index 0000000..bcec4b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/1ad5df.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_1ad5df() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_1ad5df();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_1ad5df();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_1ad5df();
+}
diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl
new file mode 100644
index 0000000..2aa8c72
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn degrees(vec<3, f32>) -> vec<3, f32>
+fn degrees_2af623() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_2af623();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_2af623();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_2af623();
+}
diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl
new file mode 100644
index 0000000..e8ac3a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+vec3 tint_degrees(vec3 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_2af623() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tint_degrees(arg_0);
+}
+
+vec4 vertex_main() {
+ degrees_2af623();
+ 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;
+
+vec3 tint_degrees(vec3 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_2af623() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tint_degrees(arg_0);
+}
+
+void fragment_main() {
+ degrees_2af623();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+vec3 tint_degrees(vec3 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_2af623() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tint_degrees(arg_0);
+}
+
+void compute_main() {
+ degrees_2af623();
+}
+
+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/degrees/2af623.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.hlsl
new file mode 100644
index 0000000..acc4754
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float3 tint_degrees(float3 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_2af623() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_2af623();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ degrees_2af623();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_2af623();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl
new file mode 100644
index 0000000..122c1a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float3 tint_degrees(float3 param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_2af623() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_2af623();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ degrees_2af623();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_2af623();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm
new file mode 100644
index 0000000..68c45fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %degrees_2af623 "degrees_2af623"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_2af623 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Degrees %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %degrees_2af623
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %degrees_2af623
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %degrees_2af623
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl
new file mode 100644
index 0000000..1406f32
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/2af623.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_2af623() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_2af623();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_2af623();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_2af623();
+}
diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl
new file mode 100644
index 0000000..35c111d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn degrees(f32) -> f32
+fn degrees_51f705() {
+ var arg_0 = 1.0;
+ var res: f32 = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_51f705();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_51f705();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_51f705();
+}
diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl
new file mode 100644
index 0000000..2481605
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+float tint_degrees(float param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_51f705() {
+ float arg_0 = 1.0f;
+ float res = tint_degrees(arg_0);
+}
+
+vec4 vertex_main() {
+ degrees_51f705();
+ 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;
+
+float tint_degrees(float param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_51f705() {
+ float arg_0 = 1.0f;
+ float res = tint_degrees(arg_0);
+}
+
+void fragment_main() {
+ degrees_51f705();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+float tint_degrees(float param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+
+void degrees_51f705() {
+ float arg_0 = 1.0f;
+ float res = tint_degrees(arg_0);
+}
+
+void compute_main() {
+ degrees_51f705();
+}
+
+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/degrees/51f705.wgsl.expected.hlsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.hlsl
new file mode 100644
index 0000000..9821514
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float tint_degrees(float param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_51f705() {
+ float arg_0 = 1.0f;
+ float res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_51f705();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ degrees_51f705();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_51f705();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl
new file mode 100644
index 0000000..4feaad0
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float tint_degrees(float param_0) {
+ return param_0 * 57.295779513082322865;
+}
+
+void degrees_51f705() {
+ float arg_0 = 1.0f;
+ float res = tint_degrees(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_51f705();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ degrees_51f705();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_51f705();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm
new file mode 100644
index 0000000..10bc58e
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %degrees_51f705 "degrees_51f705"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%degrees_51f705 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Degrees %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %degrees_51f705
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_51f705
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_51f705
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl
new file mode 100644
index 0000000..de2a96d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/51f705.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_51f705() {
+ var arg_0 = 1.0;
+ var res : f32 = degrees(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_51f705();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ degrees_51f705();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ degrees_51f705();
+}
diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl
new file mode 100644
index 0000000..0a0a423
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn determinant(mat<3, 3, f32>) -> f32
+fn determinant_2b62ba() {
+ var arg_0 = mat3x3<f32>();
+ var res: f32 = determinant(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ determinant_2b62ba();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ determinant_2b62ba();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ determinant_2b62ba();
+}
diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl
new file mode 100644
index 0000000..97b89e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void determinant_2b62ba() {
+ mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ float res = determinant(arg_0);
+}
+
+vec4 vertex_main() {
+ determinant_2b62ba();
+ 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;
+
+void determinant_2b62ba() {
+ mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ float res = determinant(arg_0);
+}
+
+void fragment_main() {
+ determinant_2b62ba();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void determinant_2b62ba() {
+ mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ float res = determinant(arg_0);
+}
+
+void compute_main() {
+ determinant_2b62ba();
+}
+
+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/determinant/2b62ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.hlsl
new file mode 100644
index 0000000..273a3f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void determinant_2b62ba() {
+ float3x3 arg_0 = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+ float res = determinant(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ determinant_2b62ba();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ determinant_2b62ba();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ determinant_2b62ba();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl
new file mode 100644
index 0000000..e57373d
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void determinant_2b62ba() {
+ float3x3 arg_0 = float3x3(float3(0.0f), float3(0.0f), float3(0.0f));
+ float res = determinant(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ determinant_2b62ba();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ determinant_2b62ba();
+ return;
+}
+
+kernel void compute_main() {
+ determinant_2b62ba();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm
new file mode 100644
index 0000000..cdf2d43
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %determinant_2b62ba "determinant_2b62ba"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+%mat3v3float = OpTypeMatrix %v3float 3
+ %15 = OpConstantNull %mat3v3float
+%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
+%_ptr_Function_float = OpTypePointer Function %float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%determinant_2b62ba = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat3v3float Function %15
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %15
+ %20 = OpLoad %mat3v3float %arg_0
+ %18 = OpExtInst %float %19 Determinant %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %determinant_2b62ba
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %determinant_2b62ba
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %determinant_2b62ba
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl
new file mode 100644
index 0000000..8ac8f81
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/2b62ba.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn determinant_2b62ba() {
+ var arg_0 = mat3x3<f32>();
+ var res : f32 = determinant(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ determinant_2b62ba();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ determinant_2b62ba();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ determinant_2b62ba();
+}
diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl
new file mode 100644
index 0000000..ff3c067
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn determinant(mat<4, 4, f32>) -> f32
+fn determinant_a0a87c() {
+ var arg_0 = mat4x4<f32>();
+ var res: f32 = determinant(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ determinant_a0a87c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ determinant_a0a87c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ determinant_a0a87c();
+}
diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl
new file mode 100644
index 0000000..e3848a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void determinant_a0a87c() {
+ mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ float res = determinant(arg_0);
+}
+
+vec4 vertex_main() {
+ determinant_a0a87c();
+ 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;
+
+void determinant_a0a87c() {
+ mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ float res = determinant(arg_0);
+}
+
+void fragment_main() {
+ determinant_a0a87c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void determinant_a0a87c() {
+ mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ float res = determinant(arg_0);
+}
+
+void compute_main() {
+ determinant_a0a87c();
+}
+
+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/determinant/a0a87c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.hlsl
new file mode 100644
index 0000000..4884250
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void determinant_a0a87c() {
+ float4x4 arg_0 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+ float res = determinant(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ determinant_a0a87c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ determinant_a0a87c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ determinant_a0a87c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl
new file mode 100644
index 0000000..f369381
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void determinant_a0a87c() {
+ float4x4 arg_0 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
+ float res = determinant(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ determinant_a0a87c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ determinant_a0a87c();
+ return;
+}
+
+kernel void compute_main() {
+ determinant_a0a87c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm
new file mode 100644
index 0000000..c05d133
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %determinant_a0a87c "determinant_a0a87c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%mat4v4float = OpTypeMatrix %v4float 4
+ %14 = OpConstantNull %mat4v4float
+%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%determinant_a0a87c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat4v4float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ %19 = OpLoad %mat4v4float %arg_0
+ %17 = OpExtInst %float %18 Determinant %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %determinant_a0a87c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %determinant_a0a87c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %determinant_a0a87c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd9f32c
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/a0a87c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn determinant_a0a87c() {
+ var arg_0 = mat4x4<f32>();
+ var res : f32 = determinant(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ determinant_a0a87c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ determinant_a0a87c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ determinant_a0a87c();
+}
diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl
new file mode 100644
index 0000000..807b446
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn determinant(mat<2, 2, f32>) -> f32
+fn determinant_e19305() {
+ var arg_0 = mat2x2<f32>();
+ var res: f32 = determinant(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ determinant_e19305();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ determinant_e19305();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ determinant_e19305();
+}
diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl
new file mode 100644
index 0000000..6cf0e5d
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void determinant_e19305() {
+ mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f));
+ float res = determinant(arg_0);
+}
+
+vec4 vertex_main() {
+ determinant_e19305();
+ 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;
+
+void determinant_e19305() {
+ mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f));
+ float res = determinant(arg_0);
+}
+
+void fragment_main() {
+ determinant_e19305();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void determinant_e19305() {
+ mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f));
+ float res = determinant(arg_0);
+}
+
+void compute_main() {
+ determinant_e19305();
+}
+
+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/determinant/e19305.wgsl.expected.hlsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.hlsl
new file mode 100644
index 0000000..84a0eda
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void determinant_e19305() {
+ float2x2 arg_0 = float2x2((0.0f).xx, (0.0f).xx);
+ float res = determinant(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ determinant_e19305();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ determinant_e19305();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ determinant_e19305();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl
new file mode 100644
index 0000000..b74f1f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void determinant_e19305() {
+ float2x2 arg_0 = float2x2(float2(0.0f), float2(0.0f));
+ float res = determinant(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ determinant_e19305();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ determinant_e19305();
+ return;
+}
+
+kernel void compute_main() {
+ determinant_e19305();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm
new file mode 100644
index 0000000..2ef5af2
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %determinant_e19305 "determinant_e19305"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %15 = OpConstantNull %mat2v2float
+%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
+%_ptr_Function_float = OpTypePointer Function %float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%determinant_e19305 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat2v2float Function %15
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %15
+ %20 = OpLoad %mat2v2float %arg_0
+ %18 = OpExtInst %float %19 Determinant %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %determinant_e19305
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %determinant_e19305
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %determinant_e19305
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl
new file mode 100644
index 0000000..f01365f
--- /dev/null
+++ b/test/tint/builtins/gen/var/determinant/e19305.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn determinant_e19305() {
+ var arg_0 = mat2x2<f32>();
+ var res : f32 = determinant(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ determinant_e19305();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ determinant_e19305();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ determinant_e19305();
+}
diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl
new file mode 100644
index 0000000..8569c29
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn distance(vec<3, f32>, vec<3, f32>) -> f32
+fn distance_0657d4() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_0657d4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_0657d4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_0657d4();
+}
diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl
new file mode 100644
index 0000000..b040bd0
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void distance_0657d4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ distance_0657d4();
+ 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;
+
+void distance_0657d4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+void fragment_main() {
+ distance_0657d4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void distance_0657d4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+void compute_main() {
+ distance_0657d4();
+}
+
+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/distance/0657d4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.hlsl
new file mode 100644
index 0000000..0155edf
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void distance_0657d4() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ distance_0657d4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ distance_0657d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ distance_0657d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl
new file mode 100644
index 0000000..7821e69
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void distance_0657d4() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ distance_0657d4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ distance_0657d4();
+ return;
+}
+
+kernel void compute_main() {
+ distance_0657d4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm
new file mode 100644
index 0000000..bdb8c3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %distance_0657d4 "distance_0657d4"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%distance_0657d4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %float %19 Distance %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %distance_0657d4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %distance_0657d4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %distance_0657d4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl
new file mode 100644
index 0000000..37716a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/0657d4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn distance_0657d4() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_0657d4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_0657d4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_0657d4();
+}
diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl
new file mode 100644
index 0000000..fdd8827
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn distance(vec<4, f32>, vec<4, f32>) -> f32
+fn distance_9646ea() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_9646ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_9646ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_9646ea();
+}
diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl
new file mode 100644
index 0000000..c13093c
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void distance_9646ea() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ distance_9646ea();
+ 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;
+
+void distance_9646ea() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+void fragment_main() {
+ distance_9646ea();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void distance_9646ea() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+void compute_main() {
+ distance_9646ea();
+}
+
+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/distance/9646ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.hlsl
new file mode 100644
index 0000000..31d25bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void distance_9646ea() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ distance_9646ea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ distance_9646ea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ distance_9646ea();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl
new file mode 100644
index 0000000..640769f
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void distance_9646ea() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ distance_9646ea();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ distance_9646ea();
+ return;
+}
+
+kernel void compute_main() {
+ distance_9646ea();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm
new file mode 100644
index 0000000..3909a97
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %distance_9646ea "distance_9646ea"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%distance_9646ea = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %float %17 Distance %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %distance_9646ea
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %distance_9646ea
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %distance_9646ea
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl
new file mode 100644
index 0000000..e2023ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/9646ea.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn distance_9646ea() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_9646ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_9646ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_9646ea();
+}
diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl
new file mode 100644
index 0000000..192d092
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn distance(vec<2, f32>, vec<2, f32>) -> f32
+fn distance_aa4055() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_aa4055();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_aa4055();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_aa4055();
+}
diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl
new file mode 100644
index 0000000..391ff0d
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void distance_aa4055() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ distance_aa4055();
+ 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;
+
+void distance_aa4055() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+void fragment_main() {
+ distance_aa4055();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void distance_aa4055() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+void compute_main() {
+ distance_aa4055();
+}
+
+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/distance/aa4055.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.hlsl
new file mode 100644
index 0000000..49d49f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void distance_aa4055() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ distance_aa4055();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ distance_aa4055();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ distance_aa4055();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl
new file mode 100644
index 0000000..748f9f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void distance_aa4055() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ distance_aa4055();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ distance_aa4055();
+ return;
+}
+
+kernel void compute_main() {
+ distance_aa4055();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm
new file mode 100644
index 0000000..92c9b13
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %distance_aa4055 "distance_aa4055"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%distance_aa4055 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %float %19 Distance %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %distance_aa4055
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %distance_aa4055
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %distance_aa4055
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl
new file mode 100644
index 0000000..ed6a4db
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/aa4055.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn distance_aa4055() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_aa4055();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_aa4055();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_aa4055();
+}
diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl
new file mode 100644
index 0000000..497731a
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn distance(f32, f32) -> f32
+fn distance_cfed73() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res: f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_cfed73();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_cfed73();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_cfed73();
+}
diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl
new file mode 100644
index 0000000..916a23d
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void distance_cfed73() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = distance(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ distance_cfed73();
+ 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;
+
+void distance_cfed73() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = distance(arg_0, arg_1);
+}
+
+void fragment_main() {
+ distance_cfed73();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void distance_cfed73() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = distance(arg_0, arg_1);
+}
+
+void compute_main() {
+ distance_cfed73();
+}
+
+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/distance/cfed73.wgsl.expected.hlsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.hlsl
new file mode 100644
index 0000000..b2345aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void distance_cfed73() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = distance(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ distance_cfed73();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ distance_cfed73();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ distance_cfed73();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl
new file mode 100644
index 0000000..5f68fe88
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void distance_cfed73() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = fabs(arg_0 - arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ distance_cfed73();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ distance_cfed73();
+ return;
+}
+
+kernel void compute_main() {
+ distance_cfed73();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm
new file mode 100644
index 0000000..49a0f98
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %distance_cfed73 "distance_cfed73"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+%distance_cfed73 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ %19 = OpLoad %float %arg_0
+ %20 = OpLoad %float %arg_1
+ %17 = OpExtInst %float %18 Distance %19 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %distance_cfed73
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %distance_cfed73
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %distance_cfed73
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl
new file mode 100644
index 0000000..6464628
--- /dev/null
+++ b/test/tint/builtins/gen/var/distance/cfed73.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn distance_cfed73() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res : f32 = distance(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ distance_cfed73();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ distance_cfed73();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ distance_cfed73();
+}
diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl
new file mode 100644
index 0000000..2742164
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<4, f32>, vec<4, f32>) -> f32
+fn dot_0c577b() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: f32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_0c577b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_0c577b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_0c577b();
+}
diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl
new file mode 100644
index 0000000..82d5eb9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void dot_0c577b() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_0c577b();
+ 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;
+
+void dot_0c577b() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_0c577b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void dot_0c577b() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_0c577b();
+}
+
+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/dot/0c577b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.hlsl
new file mode 100644
index 0000000..9ffbdc3
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_0c577b() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_0c577b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_0c577b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_0c577b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl
new file mode 100644
index 0000000..5641d75
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dot_0c577b() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_0c577b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_0c577b();
+ return;
+}
+
+kernel void compute_main() {
+ dot_0c577b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm
new file mode 100644
index 0000000..3ab41ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %dot_0c577b "dot_0c577b"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%_ptr_Function_float = OpTypePointer Function %float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_0c577b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %17 = OpLoad %v4float %arg_0
+ %18 = OpLoad %v4float %arg_1
+ %16 = OpDot %float %17 %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %dot_0c577b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %dot_0c577b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %dot_0c577b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl
new file mode 100644
index 0000000..d098148
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/0c577b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_0c577b() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : f32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_0c577b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_0c577b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_0c577b();
+}
diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl
new file mode 100644
index 0000000..c4f4a8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<3, u32>, vec<3, u32>) -> u32
+fn dot_7548a0() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var res: u32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_7548a0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_7548a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_7548a0();
+}
diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl
new file mode 100644
index 0000000..c70297d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+uint tint_int_dot(uvec3 a, uvec3 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+void dot_7548a0() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_7548a0();
+ 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;
+
+uint tint_int_dot(uvec3 a, uvec3 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+void dot_7548a0() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_7548a0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_int_dot(uvec3 a, uvec3 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+void dot_7548a0() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_7548a0();
+}
+
+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/dot/7548a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.hlsl
new file mode 100644
index 0000000..4c889b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_7548a0() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ uint res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_7548a0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_7548a0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_7548a0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl
new file mode 100644
index 0000000..383b56f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T>
+T tint_dot3(vec<T,3> a, vec<T,3> b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+void dot_7548a0() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ uint res = tint_dot3(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_7548a0();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_7548a0();
+ return;
+}
+
+kernel void compute_main() {
+ dot_7548a0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm
new file mode 100644
index 0000000..7212878
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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 %dot_7548a0 "dot_7548a0"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %34 = OpConstantNull %uint
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_7548a0 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_uint Function %34
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %20 = OpLoad %v3uint %arg_0
+ %21 = OpLoad %v3uint %arg_1
+ %22 = OpCompositeExtract %uint %20 0
+ %23 = OpCompositeExtract %uint %21 0
+ %24 = OpIMul %uint %22 %23
+ %25 = OpCompositeExtract %uint %20 1
+ %26 = OpCompositeExtract %uint %21 1
+ %27 = OpIMul %uint %25 %26
+ %28 = OpIAdd %uint %24 %27
+ %29 = OpCompositeExtract %uint %20 2
+ %30 = OpCompositeExtract %uint %21 2
+ %31 = OpIMul %uint %29 %30
+ %19 = OpIAdd %uint %28 %31
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %dot_7548a0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %dot_7548a0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %dot_7548a0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl
new file mode 100644
index 0000000..867b126
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/7548a0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_7548a0() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var res : u32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_7548a0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_7548a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_7548a0();
+}
diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl
new file mode 100644
index 0000000..699bce7
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<2, f32>, vec<2, f32>) -> f32
+fn dot_883f0e() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: f32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_883f0e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_883f0e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_883f0e();
+}
diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl
new file mode 100644
index 0000000..4eec4f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void dot_883f0e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_883f0e();
+ 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;
+
+void dot_883f0e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_883f0e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void dot_883f0e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_883f0e();
+}
+
+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/dot/883f0e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.hlsl
new file mode 100644
index 0000000..f38608a
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_883f0e() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_883f0e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_883f0e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_883f0e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl
new file mode 100644
index 0000000..b039afa
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dot_883f0e() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_883f0e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_883f0e();
+ return;
+}
+
+kernel void compute_main() {
+ dot_883f0e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm
new file mode 100644
index 0000000..0292485
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %dot_883f0e "dot_883f0e"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%_ptr_Function_float = OpTypePointer Function %float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_883f0e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %19 = OpLoad %v2float %arg_0
+ %20 = OpLoad %v2float %arg_1
+ %18 = OpDot %float %19 %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %dot_883f0e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %dot_883f0e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %dot_883f0e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl
new file mode 100644
index 0000000..57a9b6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/883f0e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_883f0e() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : f32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_883f0e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_883f0e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_883f0e();
+}
diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl
new file mode 100644
index 0000000..cc042d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<2, u32>, vec<2, u32>) -> u32
+fn dot_97c7ee() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var res: u32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_97c7ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_97c7ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_97c7ee();
+}
diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl
new file mode 100644
index 0000000..4db4b19
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+uint tint_int_dot(uvec2 a, uvec2 b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+
+void dot_97c7ee() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_97c7ee();
+ 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;
+
+uint tint_int_dot(uvec2 a, uvec2 b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+
+void dot_97c7ee() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_97c7ee();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_int_dot(uvec2 a, uvec2 b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+
+void dot_97c7ee() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_97c7ee();
+}
+
+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/dot/97c7ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.hlsl
new file mode 100644
index 0000000..d3d8cf4
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_97c7ee() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ uint res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_97c7ee();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_97c7ee();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_97c7ee();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl
new file mode 100644
index 0000000..5fa5114
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T>
+T tint_dot2(vec<T,2> a, vec<T,2> b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+void dot_97c7ee() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ uint res = tint_dot2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_97c7ee();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_97c7ee();
+ return;
+}
+
+kernel void compute_main() {
+ dot_97c7ee();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm
new file mode 100644
index 0000000..b3879a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; 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 %dot_97c7ee "dot_97c7ee"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %30 = OpConstantNull %uint
+ %31 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_97c7ee = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_uint Function %30
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %20 = OpLoad %v2uint %arg_0
+ %21 = OpLoad %v2uint %arg_1
+ %22 = OpCompositeExtract %uint %20 0
+ %23 = OpCompositeExtract %uint %21 0
+ %24 = OpIMul %uint %22 %23
+ %25 = OpCompositeExtract %uint %20 1
+ %26 = OpCompositeExtract %uint %21 1
+ %27 = OpIMul %uint %25 %26
+ %19 = OpIAdd %uint %24 %27
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %31
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %dot_97c7ee
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %37
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %dot_97c7ee
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %dot_97c7ee
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl
new file mode 100644
index 0000000..6a750d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/97c7ee.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_97c7ee() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var res : u32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_97c7ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_97c7ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_97c7ee();
+}
diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl
new file mode 100644
index 0000000..f5cedcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<3, f32>, vec<3, f32>) -> f32
+fn dot_ba4246() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: f32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_ba4246();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_ba4246();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_ba4246();
+}
diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl
new file mode 100644
index 0000000..6c29d85
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void dot_ba4246() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_ba4246();
+ 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;
+
+void dot_ba4246() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_ba4246();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void dot_ba4246() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_ba4246();
+}
+
+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/dot/ba4246.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.hlsl
new file mode 100644
index 0000000..426f56d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_ba4246() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_ba4246();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_ba4246();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_ba4246();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl
new file mode 100644
index 0000000..775db06
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dot_ba4246() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_ba4246();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_ba4246();
+ return;
+}
+
+kernel void compute_main() {
+ dot_ba4246();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm
new file mode 100644
index 0000000..2e99e39
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; 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 %dot_ba4246 "dot_ba4246"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%_ptr_Function_float = OpTypePointer Function %float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_ba4246 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %19 = OpLoad %v3float %arg_0
+ %20 = OpLoad %v3float %arg_1
+ %18 = OpDot %float %19 %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %dot_ba4246
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %dot_ba4246
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %dot_ba4246
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl
new file mode 100644
index 0000000..77cdb59
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ba4246.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_ba4246() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : f32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_ba4246();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_ba4246();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_ba4246();
+}
diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl
new file mode 100644
index 0000000..302f0f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<4, u32>, vec<4, u32>) -> u32
+fn dot_e994c7() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var res: u32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_e994c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_e994c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_e994c7();
+}
diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl
new file mode 100644
index 0000000..097eb9f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+uint tint_int_dot(uvec4 a, uvec4 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+
+void dot_e994c7() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_e994c7();
+ 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;
+
+uint tint_int_dot(uvec4 a, uvec4 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+
+void dot_e994c7() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_e994c7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_int_dot(uvec4 a, uvec4 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+
+void dot_e994c7() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uint res = tint_int_dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_e994c7();
+}
+
+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/dot/e994c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.hlsl
new file mode 100644
index 0000000..2e609e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_e994c7() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ uint res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_e994c7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_e994c7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_e994c7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl
new file mode 100644
index 0000000..48c480a
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T>
+T tint_dot4(vec<T,4> a, vec<T,4> b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+void dot_e994c7() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ uint res = tint_dot4(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_e994c7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_e994c7();
+ return;
+}
+
+kernel void compute_main() {
+ dot_e994c7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm
new file mode 100644
index 0000000..0e9a6de
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.spvasm
@@ -0,0 +1,91 @@
+; 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 %dot_e994c7 "dot_e994c7"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %38 = OpConstantNull %uint
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_e994c7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_uint Function %38
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %20 = OpLoad %v4uint %arg_0
+ %21 = OpLoad %v4uint %arg_1
+ %22 = OpCompositeExtract %uint %20 0
+ %23 = OpCompositeExtract %uint %21 0
+ %24 = OpIMul %uint %22 %23
+ %25 = OpCompositeExtract %uint %20 1
+ %26 = OpCompositeExtract %uint %21 1
+ %27 = OpIMul %uint %25 %26
+ %28 = OpIAdd %uint %24 %27
+ %29 = OpCompositeExtract %uint %20 2
+ %30 = OpCompositeExtract %uint %21 2
+ %31 = OpIMul %uint %29 %30
+ %32 = OpIAdd %uint %28 %31
+ %33 = OpCompositeExtract %uint %20 3
+ %34 = OpCompositeExtract %uint %21 3
+ %35 = OpIMul %uint %33 %34
+ %19 = OpIAdd %uint %32 %35
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %dot_e994c7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %dot_e994c7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %dot_e994c7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl
new file mode 100644
index 0000000..67fff9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/e994c7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_e994c7() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var res : u32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_e994c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_e994c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_e994c7();
+}
diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl
new file mode 100644
index 0000000..0aa8cf5
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<4, i32>, vec<4, i32>) -> i32
+fn dot_ef6b1d() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var res: i32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_ef6b1d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_ef6b1d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_ef6b1d();
+}
diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl
new file mode 100644
index 0000000..cb1c1d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+int tint_int_dot(ivec4 a, ivec4 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+
+void dot_ef6b1d() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_ef6b1d();
+ 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;
+
+int tint_int_dot(ivec4 a, ivec4 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+
+void dot_ef6b1d() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_ef6b1d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_int_dot(ivec4 a, ivec4 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+
+void dot_ef6b1d() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_ef6b1d();
+}
+
+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/dot/ef6b1d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.hlsl
new file mode 100644
index 0000000..0889c70
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_ef6b1d() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ int res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_ef6b1d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_ef6b1d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_ef6b1d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl
new file mode 100644
index 0000000..dcbda3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T>
+T tint_dot4(vec<T,4> a, vec<T,4> b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
+}
+void dot_ef6b1d() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ int res = tint_dot4(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_ef6b1d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_ef6b1d();
+ return;
+}
+
+kernel void compute_main() {
+ dot_ef6b1d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm
new file mode 100644
index 0000000..22f397d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.spvasm
@@ -0,0 +1,91 @@
+; 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 %dot_ef6b1d "dot_ef6b1d"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+%_ptr_Function_int = OpTypePointer Function %int
+ %38 = OpConstantNull %int
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_ef6b1d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_int Function %38
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %20 = OpLoad %v4int %arg_0
+ %21 = OpLoad %v4int %arg_1
+ %22 = OpCompositeExtract %int %20 0
+ %23 = OpCompositeExtract %int %21 0
+ %24 = OpIMul %int %22 %23
+ %25 = OpCompositeExtract %int %20 1
+ %26 = OpCompositeExtract %int %21 1
+ %27 = OpIMul %int %25 %26
+ %28 = OpIAdd %int %24 %27
+ %29 = OpCompositeExtract %int %20 2
+ %30 = OpCompositeExtract %int %21 2
+ %31 = OpIMul %int %29 %30
+ %32 = OpIAdd %int %28 %31
+ %33 = OpCompositeExtract %int %20 3
+ %34 = OpCompositeExtract %int %21 3
+ %35 = OpIMul %int %33 %34
+ %19 = OpIAdd %int %32 %35
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %dot_ef6b1d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %dot_ef6b1d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %dot_ef6b1d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl
new file mode 100644
index 0000000..aae5da9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/ef6b1d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_ef6b1d() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var res : i32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_ef6b1d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_ef6b1d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_ef6b1d();
+}
diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl
new file mode 100644
index 0000000..a8ed93f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<3, i32>, vec<3, i32>) -> i32
+fn dot_f1312c() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var res: i32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_f1312c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_f1312c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_f1312c();
+}
diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl
new file mode 100644
index 0000000..9699e6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+int tint_int_dot(ivec3 a, ivec3 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+void dot_f1312c() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_f1312c();
+ 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;
+
+int tint_int_dot(ivec3 a, ivec3 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+void dot_f1312c() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_f1312c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_int_dot(ivec3 a, ivec3 b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+
+void dot_f1312c() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_f1312c();
+}
+
+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/dot/f1312c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.hlsl
new file mode 100644
index 0000000..6562925
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_f1312c() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ int res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_f1312c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_f1312c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_f1312c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl
new file mode 100644
index 0000000..22d6fb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T>
+T tint_dot3(vec<T,3> a, vec<T,3> b) {
+ return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+}
+void dot_f1312c() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ int res = tint_dot3(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_f1312c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_f1312c();
+ return;
+}
+
+kernel void compute_main() {
+ dot_f1312c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm
new file mode 100644
index 0000000..bc03d16
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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 %dot_f1312c "dot_f1312c"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_int = OpTypePointer Function %int
+ %34 = OpConstantNull %int
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_f1312c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_int Function %34
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %20 = OpLoad %v3int %arg_0
+ %21 = OpLoad %v3int %arg_1
+ %22 = OpCompositeExtract %int %20 0
+ %23 = OpCompositeExtract %int %21 0
+ %24 = OpIMul %int %22 %23
+ %25 = OpCompositeExtract %int %20 1
+ %26 = OpCompositeExtract %int %21 1
+ %27 = OpIMul %int %25 %26
+ %28 = OpIAdd %int %24 %27
+ %29 = OpCompositeExtract %int %20 2
+ %30 = OpCompositeExtract %int %21 2
+ %31 = OpIMul %int %29 %30
+ %19 = OpIAdd %int %28 %31
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %dot_f1312c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %41
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %dot_f1312c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %dot_f1312c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl
new file mode 100644
index 0000000..7b402b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/f1312c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_f1312c() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var res : i32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_f1312c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_f1312c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_f1312c();
+}
diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl
new file mode 100644
index 0000000..db70801
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dot(vec<2, i32>, vec<2, i32>) -> i32
+fn dot_fc5f7c() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var res: i32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_fc5f7c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_fc5f7c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_fc5f7c();
+}
diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl
new file mode 100644
index 0000000..64e9e0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+int tint_int_dot(ivec2 a, ivec2 b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+
+void dot_fc5f7c() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ dot_fc5f7c();
+ 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;
+
+int tint_int_dot(ivec2 a, ivec2 b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+
+void dot_fc5f7c() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+void fragment_main() {
+ dot_fc5f7c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_int_dot(ivec2 a, ivec2 b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+
+void dot_fc5f7c() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ int res = tint_int_dot(arg_0, arg_1);
+}
+
+void compute_main() {
+ dot_fc5f7c();
+}
+
+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/dot/fc5f7c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.hlsl
new file mode 100644
index 0000000..19af42f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void dot_fc5f7c() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ int res = dot(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ dot_fc5f7c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ dot_fc5f7c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ dot_fc5f7c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl
new file mode 100644
index 0000000..ca35769
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.msl
@@ -0,0 +1,40 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+template<typename T>
+T tint_dot2(vec<T,2> a, vec<T,2> b) {
+ return a[0]*b[0] + a[1]*b[1];
+}
+void dot_fc5f7c() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ int res = tint_dot2(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ dot_fc5f7c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ dot_fc5f7c();
+ return;
+}
+
+kernel void compute_main() {
+ dot_fc5f7c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm
new file mode 100644
index 0000000..81ca2fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; 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 %dot_fc5f7c "dot_fc5f7c"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+%_ptr_Function_int = OpTypePointer Function %int
+ %30 = OpConstantNull %int
+ %31 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %dot_fc5f7c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_int Function %30
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %20 = OpLoad %v2int %arg_0
+ %21 = OpLoad %v2int %arg_1
+ %22 = OpCompositeExtract %int %20 0
+ %23 = OpCompositeExtract %int %21 0
+ %24 = OpIMul %int %22 %23
+ %25 = OpCompositeExtract %int %20 1
+ %26 = OpCompositeExtract %int %21 1
+ %27 = OpIMul %int %25 %26
+ %19 = OpIAdd %int %24 %27
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %31
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %dot_fc5f7c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %37
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %dot_fc5f7c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %dot_fc5f7c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl
new file mode 100644
index 0000000..f2d3f67
--- /dev/null
+++ b/test/tint/builtins/gen/var/dot/fc5f7c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn dot_fc5f7c() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var res : i32 = dot(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ dot_fc5f7c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dot_fc5f7c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ dot_fc5f7c();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl
new file mode 100644
index 0000000..6a7314b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdx(vec<3, f32>) -> vec<3, f32>
+fn dpdx_0763f7() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_0763f7();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl
new file mode 100644
index 0000000..4b81121
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdx_0763f7() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_0763f7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl
new file mode 100644
index 0000000..452f700
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdx_0763f7() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ddx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_0763f7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl
new file mode 100644
index 0000000..6fdb57e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdx_0763f7() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdx_0763f7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm
new file mode 100644
index 0000000..a797d84
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdx_0763f7 "dpdx_0763f7"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdx_0763f7 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpDPdx %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdx_0763f7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl
new file mode 100644
index 0000000..83b7c77
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/0763f7.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdx_0763f7() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_0763f7();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl
new file mode 100644
index 0000000..cc540ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdx(vec<2, f32>) -> vec<2, f32>
+fn dpdx_99edb1() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_99edb1();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl
new file mode 100644
index 0000000..a112826
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdx_99edb1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_99edb1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl
new file mode 100644
index 0000000..5251f08
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdx_99edb1() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ddx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_99edb1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl
new file mode 100644
index 0000000..c9d152a
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdx_99edb1() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdx_99edb1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm
new file mode 100644
index 0000000..0aa334a
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdx_99edb1 "dpdx_99edb1"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdx_99edb1 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpDPdx %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdx_99edb1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl
new file mode 100644
index 0000000..7fa9efe
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/99edb1.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdx_99edb1() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_99edb1();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl
new file mode 100644
index 0000000..ff04efb
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdx(vec<4, f32>) -> vec<4, f32>
+fn dpdx_c487fa() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_c487fa();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl
new file mode 100644
index 0000000..750d4af
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdx_c487fa() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_c487fa();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl
new file mode 100644
index 0000000..b36fbdd
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdx_c487fa() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ddx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_c487fa();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl
new file mode 100644
index 0000000..50ee886
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdx_c487fa() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdx_c487fa();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm
new file mode 100644
index 0000000..3ef2fd8
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdx_c487fa "dpdx_c487fa"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdx_c487fa = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpDPdx %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdx_c487fa
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl
new file mode 100644
index 0000000..f7aa222
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/c487fa.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdx_c487fa() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_c487fa();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl
new file mode 100644
index 0000000..7247c64
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdx(f32) -> f32
+fn dpdx_e263de() {
+ var arg_0 = 1.0;
+ var res: f32 = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_e263de();
+}
diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl
new file mode 100644
index 0000000..7debcdb
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdx_e263de() {
+ float arg_0 = 1.0f;
+ float res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_e263de();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl
new file mode 100644
index 0000000..ef8ef06
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdx_e263de() {
+ float arg_0 = 1.0f;
+ float res = ddx(arg_0);
+}
+
+void fragment_main() {
+ dpdx_e263de();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl
new file mode 100644
index 0000000..81401f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdx_e263de() {
+ float arg_0 = 1.0f;
+ float res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdx_e263de();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm
new file mode 100644
index 0000000..8346357
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdx_e263de "dpdx_e263de"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%dpdx_e263de = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpDPdx %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdx_e263de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl
new file mode 100644
index 0000000..aff2cf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdx/e263de.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdx_e263de() {
+ var arg_0 = 1.0;
+ var res : f32 = dpdx(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdx_e263de();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl
new file mode 100644
index 0000000..a565a80
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxCoarse(f32) -> f32
+fn dpdxCoarse_029152() {
+ var arg_0 = 1.0;
+ var res: f32 = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_029152();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl
new file mode 100644
index 0000000..22fcf55
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxCoarse_029152() {
+ float arg_0 = 1.0f;
+ float res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_029152();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl
new file mode 100644
index 0000000..e2ee497
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxCoarse_029152() {
+ float arg_0 = 1.0f;
+ float res = ddx_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_029152();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl
new file mode 100644
index 0000000..82e95e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxCoarse_029152() {
+ float arg_0 = 1.0f;
+ float res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxCoarse_029152();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm
new file mode 100644
index 0000000..c61f62b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxCoarse_029152 "dpdxCoarse_029152"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%dpdxCoarse_029152 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpDPdxCoarse %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxCoarse_029152
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl
new file mode 100644
index 0000000..d243b10
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/029152.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxCoarse_029152() {
+ var arg_0 = 1.0;
+ var res : f32 = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_029152();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl
new file mode 100644
index 0000000..4f30edf
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxCoarse(vec<2, f32>) -> vec<2, f32>
+fn dpdxCoarse_9581cf() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_9581cf();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl
new file mode 100644
index 0000000..c65e7f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxCoarse_9581cf() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_9581cf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl
new file mode 100644
index 0000000..54a39b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxCoarse_9581cf() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ddx_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_9581cf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl
new file mode 100644
index 0000000..d36bcaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxCoarse_9581cf() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxCoarse_9581cf();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm
new file mode 100644
index 0000000..72c0195
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxCoarse_9581cf "dpdxCoarse_9581cf"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdxCoarse_9581cf = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpDPdxCoarse %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxCoarse_9581cf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl
new file mode 100644
index 0000000..e2ff427
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/9581cf.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxCoarse_9581cf() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_9581cf();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl
new file mode 100644
index 0000000..1805285
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxCoarse(vec<4, f32>) -> vec<4, f32>
+fn dpdxCoarse_c28641() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_c28641();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl
new file mode 100644
index 0000000..11ac01c
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxCoarse_c28641() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_c28641();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl
new file mode 100644
index 0000000..202bff3
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxCoarse_c28641() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ddx_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_c28641();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl
new file mode 100644
index 0000000..a86c657
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxCoarse_c28641() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxCoarse_c28641();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm
new file mode 100644
index 0000000..ce6a0ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxCoarse_c28641 "dpdxCoarse_c28641"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdxCoarse_c28641 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpDPdxCoarse %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxCoarse_c28641
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl
new file mode 100644
index 0000000..50ffb65
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/c28641.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxCoarse_c28641() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_c28641();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl
new file mode 100644
index 0000000..fa36014
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxCoarse(vec<3, f32>) -> vec<3, f32>
+fn dpdxCoarse_f64d7b() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_f64d7b();
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl
new file mode 100644
index 0000000..842689b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxCoarse_f64d7b() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_f64d7b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl
new file mode 100644
index 0000000..e5d5ca6
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxCoarse_f64d7b() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ddx_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdxCoarse_f64d7b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl
new file mode 100644
index 0000000..af992b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxCoarse_f64d7b() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxCoarse_f64d7b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm
new file mode 100644
index 0000000..a58ab28
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxCoarse_f64d7b "dpdxCoarse_f64d7b"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdxCoarse_f64d7b = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpDPdxCoarse %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxCoarse_f64d7b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl
new file mode 100644
index 0000000..82763b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxCoarse/f64d7b.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxCoarse_f64d7b() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = dpdxCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxCoarse_f64d7b();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl
new file mode 100644
index 0000000..3d78fc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxFine(vec<4, f32>) -> vec<4, f32>
+fn dpdxFine_8c5069() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_8c5069();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl
new file mode 100644
index 0000000..0a43a92
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxFine_8c5069() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_8c5069();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl
new file mode 100644
index 0000000..b348c27
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_8c5069() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ddx_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_8c5069();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl
new file mode 100644
index 0000000..0ed9d35
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_8c5069() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxFine_8c5069();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm
new file mode 100644
index 0000000..8b51160
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_8c5069 "dpdxFine_8c5069"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdxFine_8c5069 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpDPdxFine %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxFine_8c5069
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl
new file mode 100644
index 0000000..d19330b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/8c5069.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxFine_8c5069() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_8c5069();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl
new file mode 100644
index 0000000..2d80b50
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxFine(vec<2, f32>) -> vec<2, f32>
+fn dpdxFine_9631de() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_9631de();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl
new file mode 100644
index 0000000..d1c4c17
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxFine_9631de() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_9631de();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl
new file mode 100644
index 0000000..1e4b48d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_9631de() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ddx_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_9631de();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl
new file mode 100644
index 0000000..0416ec5
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_9631de() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxFine_9631de();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm
new file mode 100644
index 0000000..ea0dbf6
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_9631de "dpdxFine_9631de"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdxFine_9631de = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpDPdxFine %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxFine_9631de
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl
new file mode 100644
index 0000000..179b071
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/9631de.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxFine_9631de() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_9631de();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl
new file mode 100644
index 0000000..1dfeb73
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxFine(f32) -> f32
+fn dpdxFine_f401a2() {
+ var arg_0 = 1.0;
+ var res: f32 = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_f401a2();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl
new file mode 100644
index 0000000..5840665
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxFine_f401a2() {
+ float arg_0 = 1.0f;
+ float res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_f401a2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl
new file mode 100644
index 0000000..4c1d8c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_f401a2() {
+ float arg_0 = 1.0f;
+ float res = ddx_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_f401a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl
new file mode 100644
index 0000000..6d33b99
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_f401a2() {
+ float arg_0 = 1.0f;
+ float res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxFine_f401a2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm
new file mode 100644
index 0000000..3806d73
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_f401a2 "dpdxFine_f401a2"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%dpdxFine_f401a2 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpDPdxFine %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxFine_f401a2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl
new file mode 100644
index 0000000..9b9d022
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f401a2.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxFine_f401a2() {
+ var arg_0 = 1.0;
+ var res : f32 = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_f401a2();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl
new file mode 100644
index 0000000..4849001
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdxFine(vec<3, f32>) -> vec<3, f32>
+fn dpdxFine_f92fb6() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_f92fb6();
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl
new file mode 100644
index 0000000..6e72e58
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdxFine_f92fb6() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = dFdx(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_f92fb6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl
new file mode 100644
index 0000000..0177f32
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdxFine_f92fb6() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ddx_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdxFine_f92fb6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl
new file mode 100644
index 0000000..020368e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdxFine_f92fb6() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = dfdx(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdxFine_f92fb6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm
new file mode 100644
index 0000000..eec936d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdxFine_f92fb6 "dpdxFine_f92fb6"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdxFine_f92fb6 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpDPdxFine %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdxFine_f92fb6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl
new file mode 100644
index 0000000..8a68011
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdxFine/f92fb6.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdxFine_f92fb6() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = dpdxFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdxFine_f92fb6();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl
new file mode 100644
index 0000000..2300266
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdy(vec<4, f32>) -> vec<4, f32>
+fn dpdy_699a05() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_699a05();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl
new file mode 100644
index 0000000..7dd547a
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdy_699a05() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_699a05();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl
new file mode 100644
index 0000000..32602be
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdy_699a05() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ddy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_699a05();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl
new file mode 100644
index 0000000..fedc72e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdy_699a05() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdy_699a05();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm
new file mode 100644
index 0000000..8664d49
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdy_699a05 "dpdy_699a05"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdy_699a05 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpDPdy %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdy_699a05
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl
new file mode 100644
index 0000000..afd333d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/699a05.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdy_699a05() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_699a05();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl
new file mode 100644
index 0000000..9c39cb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdy(f32) -> f32
+fn dpdy_7f8d84() {
+ var arg_0 = 1.0;
+ var res: f32 = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_7f8d84();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl
new file mode 100644
index 0000000..298a795
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdy_7f8d84() {
+ float arg_0 = 1.0f;
+ float res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_7f8d84();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl
new file mode 100644
index 0000000..566c64b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdy_7f8d84() {
+ float arg_0 = 1.0f;
+ float res = ddy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_7f8d84();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl
new file mode 100644
index 0000000..5651aa7
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdy_7f8d84() {
+ float arg_0 = 1.0f;
+ float res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdy_7f8d84();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm
new file mode 100644
index 0000000..4480737
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdy_7f8d84 "dpdy_7f8d84"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%dpdy_7f8d84 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpDPdy %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdy_7f8d84
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl
new file mode 100644
index 0000000..aa3d3e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/7f8d84.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdy_7f8d84() {
+ var arg_0 = 1.0;
+ var res : f32 = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_7f8d84();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl
new file mode 100644
index 0000000..9774ec2
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdy(vec<2, f32>) -> vec<2, f32>
+fn dpdy_a8b56e() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_a8b56e();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl
new file mode 100644
index 0000000..b9d4fcc
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdy_a8b56e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_a8b56e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl
new file mode 100644
index 0000000..87d014d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdy_a8b56e() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ddy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_a8b56e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl
new file mode 100644
index 0000000..fb3233e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdy_a8b56e() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdy_a8b56e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm
new file mode 100644
index 0000000..432eb0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdy_a8b56e "dpdy_a8b56e"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdy_a8b56e = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpDPdy %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdy_a8b56e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl
new file mode 100644
index 0000000..3c525a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/a8b56e.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdy_a8b56e() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_a8b56e();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl
new file mode 100644
index 0000000..927411e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdy(vec<3, f32>) -> vec<3, f32>
+fn dpdy_feb40f() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_feb40f();
+}
diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl
new file mode 100644
index 0000000..100bd2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdy_feb40f() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_feb40f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl
new file mode 100644
index 0000000..1dc58b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdy_feb40f() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ddy(arg_0);
+}
+
+void fragment_main() {
+ dpdy_feb40f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl
new file mode 100644
index 0000000..867b92f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdy_feb40f() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdy_feb40f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm
new file mode 100644
index 0000000..27dd550
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdy_feb40f "dpdy_feb40f"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdy_feb40f = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpDPdy %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdy_feb40f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl
new file mode 100644
index 0000000..e5cf66b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdy/feb40f.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdy_feb40f() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = dpdy(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdy_feb40f();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl
new file mode 100644
index 0000000..5ff70f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyCoarse(vec<2, f32>) -> vec<2, f32>
+fn dpdyCoarse_3e1ab4() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_3e1ab4();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl
new file mode 100644
index 0000000..cbed1c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyCoarse_3e1ab4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_3e1ab4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl
new file mode 100644
index 0000000..1820d16
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyCoarse_3e1ab4() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ddy_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_3e1ab4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl
new file mode 100644
index 0000000..59a448b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyCoarse_3e1ab4() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyCoarse_3e1ab4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm
new file mode 100644
index 0000000..bd5f5b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyCoarse_3e1ab4 "dpdyCoarse_3e1ab4"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdyCoarse_3e1ab4 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpDPdyCoarse %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyCoarse_3e1ab4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl
new file mode 100644
index 0000000..0a46975
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/3e1ab4.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyCoarse_3e1ab4() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_3e1ab4();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl
new file mode 100644
index 0000000..3e72e2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyCoarse(vec<4, f32>) -> vec<4, f32>
+fn dpdyCoarse_445d24() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_445d24();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl
new file mode 100644
index 0000000..048d6d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyCoarse_445d24() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_445d24();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl
new file mode 100644
index 0000000..0f2904c
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyCoarse_445d24() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ddy_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_445d24();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl
new file mode 100644
index 0000000..17ae635
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyCoarse_445d24() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyCoarse_445d24();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm
new file mode 100644
index 0000000..7fc9b3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyCoarse_445d24 "dpdyCoarse_445d24"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdyCoarse_445d24 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpDPdyCoarse %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyCoarse_445d24
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl
new file mode 100644
index 0000000..e1e9f85
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/445d24.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyCoarse_445d24() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_445d24();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl
new file mode 100644
index 0000000..c06358b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyCoarse(f32) -> f32
+fn dpdyCoarse_870a7e() {
+ var arg_0 = 1.0;
+ var res: f32 = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_870a7e();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl
new file mode 100644
index 0000000..a0e2cd7
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyCoarse_870a7e() {
+ float arg_0 = 1.0f;
+ float res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_870a7e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl
new file mode 100644
index 0000000..c5c4e1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyCoarse_870a7e() {
+ float arg_0 = 1.0f;
+ float res = ddy_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_870a7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl
new file mode 100644
index 0000000..88e086c
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyCoarse_870a7e() {
+ float arg_0 = 1.0f;
+ float res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyCoarse_870a7e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm
new file mode 100644
index 0000000..b0bc403
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyCoarse_870a7e "dpdyCoarse_870a7e"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%dpdyCoarse_870a7e = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpDPdyCoarse %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyCoarse_870a7e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl
new file mode 100644
index 0000000..a5fbe19
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/870a7e.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyCoarse_870a7e() {
+ var arg_0 = 1.0;
+ var res : f32 = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_870a7e();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl
new file mode 100644
index 0000000..120e799
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyCoarse(vec<3, f32>) -> vec<3, f32>
+fn dpdyCoarse_ae1873() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_ae1873();
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl
new file mode 100644
index 0000000..74aa42a
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyCoarse_ae1873() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_ae1873();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl
new file mode 100644
index 0000000..3518fc6
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyCoarse_ae1873() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ddy_coarse(arg_0);
+}
+
+void fragment_main() {
+ dpdyCoarse_ae1873();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl
new file mode 100644
index 0000000..b24d948
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyCoarse_ae1873() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyCoarse_ae1873();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm
new file mode 100644
index 0000000..89cc4b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyCoarse_ae1873 "dpdyCoarse_ae1873"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdyCoarse_ae1873 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpDPdyCoarse %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyCoarse_ae1873
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl
new file mode 100644
index 0000000..7cb6ef6
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyCoarse/ae1873.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyCoarse_ae1873() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = dpdyCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyCoarse_ae1873();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl
new file mode 100644
index 0000000..14de687
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyFine(vec<3, f32>) -> vec<3, f32>
+fn dpdyFine_1fb7ab() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_1fb7ab();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl
new file mode 100644
index 0000000..ec2f995
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyFine_1fb7ab() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_1fb7ab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl
new file mode 100644
index 0000000..e208640
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyFine_1fb7ab() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = ddy_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_1fb7ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl
new file mode 100644
index 0000000..d58e455
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyFine_1fb7ab() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyFine_1fb7ab();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm
new file mode 100644
index 0000000..56521ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyFine_1fb7ab "dpdyFine_1fb7ab"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%dpdyFine_1fb7ab = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpDPdyFine %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyFine_1fb7ab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl
new file mode 100644
index 0000000..a8b3457
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/1fb7ab.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyFine_1fb7ab() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_1fb7ab();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl
new file mode 100644
index 0000000..7513329
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyFine(f32) -> f32
+fn dpdyFine_6eb673() {
+ var arg_0 = 1.0;
+ var res: f32 = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_6eb673();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl
new file mode 100644
index 0000000..1762ecf
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyFine_6eb673() {
+ float arg_0 = 1.0f;
+ float res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_6eb673();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl
new file mode 100644
index 0000000..ddec210
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyFine_6eb673() {
+ float arg_0 = 1.0f;
+ float res = ddy_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_6eb673();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl
new file mode 100644
index 0000000..57adf6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyFine_6eb673() {
+ float arg_0 = 1.0f;
+ float res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyFine_6eb673();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm
new file mode 100644
index 0000000..cac131b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyFine_6eb673 "dpdyFine_6eb673"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%dpdyFine_6eb673 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpDPdyFine %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyFine_6eb673
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl
new file mode 100644
index 0000000..b6a2e54
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/6eb673.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyFine_6eb673() {
+ var arg_0 = 1.0;
+ var res : f32 = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_6eb673();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl
new file mode 100644
index 0000000..ab2f873
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyFine(vec<4, f32>) -> vec<4, f32>
+fn dpdyFine_d0a648() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_d0a648();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl
new file mode 100644
index 0000000..41f6256
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyFine_d0a648() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_d0a648();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl
new file mode 100644
index 0000000..0384f5c
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyFine_d0a648() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = ddy_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_d0a648();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl
new file mode 100644
index 0000000..73afd1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyFine_d0a648() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyFine_d0a648();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm
new file mode 100644
index 0000000..4f2cf98
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyFine_d0a648 "dpdyFine_d0a648"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%dpdyFine_d0a648 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpDPdyFine %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyFine_d0a648
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl
new file mode 100644
index 0000000..5a1f817
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/d0a648.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyFine_d0a648() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_d0a648();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl
new file mode 100644
index 0000000..819c688
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn dpdyFine(vec<2, f32>) -> vec<2, f32>
+fn dpdyFine_df33aa() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_df33aa();
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl
new file mode 100644
index 0000000..e9489e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void dpdyFine_df33aa() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = dFdy(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_df33aa();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl
new file mode 100644
index 0000000..d68bfb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void dpdyFine_df33aa() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = ddy_fine(arg_0);
+}
+
+void fragment_main() {
+ dpdyFine_df33aa();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl
new file mode 100644
index 0000000..6c0c0fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void dpdyFine_df33aa() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = dfdy(arg_0);
+}
+
+fragment void fragment_main() {
+ dpdyFine_df33aa();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm
new file mode 100644
index 0000000..1a9ef5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %dpdyFine_df33aa "dpdyFine_df33aa"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%dpdyFine_df33aa = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpDPdyFine %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %dpdyFine_df33aa
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl
new file mode 100644
index 0000000..46d0d1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/dpdyFine/df33aa.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn dpdyFine_df33aa() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = dpdyFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ dpdyFine_df33aa();
+}
diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl
new file mode 100644
index 0000000..dbcfeab
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp(vec<4, f32>) -> vec<4, f32>
+fn exp_0f70eb() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_0f70eb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_0f70eb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_0f70eb();
+}
diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl
new file mode 100644
index 0000000..7de8d8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp_0f70eb() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = exp(arg_0);
+}
+
+vec4 vertex_main() {
+ exp_0f70eb();
+ 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;
+
+void exp_0f70eb() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = exp(arg_0);
+}
+
+void fragment_main() {
+ exp_0f70eb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp_0f70eb() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = exp(arg_0);
+}
+
+void compute_main() {
+ exp_0f70eb();
+}
+
+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/exp/0f70eb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.hlsl
new file mode 100644
index 0000000..c99c41a
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp_0f70eb() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp_0f70eb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp_0f70eb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp_0f70eb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl
new file mode 100644
index 0000000..fefd0a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp_0f70eb() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp_0f70eb();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp_0f70eb();
+ return;
+}
+
+kernel void compute_main() {
+ exp_0f70eb();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm
new file mode 100644
index 0000000..18b79bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %exp_0f70eb "exp_0f70eb"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %exp_0f70eb = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Exp %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %exp_0f70eb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %exp_0f70eb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %exp_0f70eb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl
new file mode 100644
index 0000000..9c62eea
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/0f70eb.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp_0f70eb() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_0f70eb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_0f70eb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_0f70eb();
+}
diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl
new file mode 100644
index 0000000..9517b84
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp(vec<2, f32>) -> vec<2, f32>
+fn exp_1951e7() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_1951e7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_1951e7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_1951e7();
+}
diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl
new file mode 100644
index 0000000..159debe
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp_1951e7() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = exp(arg_0);
+}
+
+vec4 vertex_main() {
+ exp_1951e7();
+ 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;
+
+void exp_1951e7() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = exp(arg_0);
+}
+
+void fragment_main() {
+ exp_1951e7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp_1951e7() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = exp(arg_0);
+}
+
+void compute_main() {
+ exp_1951e7();
+}
+
+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/exp/1951e7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.hlsl
new file mode 100644
index 0000000..b809cec
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp_1951e7() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp_1951e7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp_1951e7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp_1951e7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl
new file mode 100644
index 0000000..3b0e694
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp_1951e7() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp_1951e7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp_1951e7();
+ return;
+}
+
+kernel void compute_main() {
+ exp_1951e7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm
new file mode 100644
index 0000000..83e21b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %exp_1951e7 "exp_1951e7"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %exp_1951e7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Exp %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %exp_1951e7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %exp_1951e7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %exp_1951e7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl
new file mode 100644
index 0000000..22c08d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/1951e7.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp_1951e7() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_1951e7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_1951e7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_1951e7();
+}
diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl
new file mode 100644
index 0000000..8ee0c82
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp(f32) -> f32
+fn exp_771fd2() {
+ var arg_0 = 1.0;
+ var res: f32 = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_771fd2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_771fd2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_771fd2();
+}
diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl
new file mode 100644
index 0000000..3c874f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp_771fd2() {
+ float arg_0 = 1.0f;
+ float res = exp(arg_0);
+}
+
+vec4 vertex_main() {
+ exp_771fd2();
+ 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;
+
+void exp_771fd2() {
+ float arg_0 = 1.0f;
+ float res = exp(arg_0);
+}
+
+void fragment_main() {
+ exp_771fd2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp_771fd2() {
+ float arg_0 = 1.0f;
+ float res = exp(arg_0);
+}
+
+void compute_main() {
+ exp_771fd2();
+}
+
+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/exp/771fd2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.hlsl
new file mode 100644
index 0000000..578cedb
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp_771fd2() {
+ float arg_0 = 1.0f;
+ float res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp_771fd2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp_771fd2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp_771fd2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl
new file mode 100644
index 0000000..0e3c093
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp_771fd2() {
+ float arg_0 = 1.0f;
+ float res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp_771fd2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp_771fd2();
+ return;
+}
+
+kernel void compute_main() {
+ exp_771fd2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm
new file mode 100644
index 0000000..83173a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %exp_771fd2 "exp_771fd2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %exp_771fd2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Exp %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %exp_771fd2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %exp_771fd2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %exp_771fd2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl
new file mode 100644
index 0000000..892fa97
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/771fd2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp_771fd2() {
+ var arg_0 = 1.0;
+ var res : f32 = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_771fd2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_771fd2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_771fd2();
+}
diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl b/test/tint/builtins/gen/var/exp/d98450.wgsl
new file mode 100644
index 0000000..fae8a40
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/d98450.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp(vec<3, f32>) -> vec<3, f32>
+fn exp_d98450() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_d98450();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_d98450();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_d98450();
+}
diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl
new file mode 100644
index 0000000..495a77a
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp_d98450() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = exp(arg_0);
+}
+
+vec4 vertex_main() {
+ exp_d98450();
+ 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;
+
+void exp_d98450() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = exp(arg_0);
+}
+
+void fragment_main() {
+ exp_d98450();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp_d98450() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = exp(arg_0);
+}
+
+void compute_main() {
+ exp_d98450();
+}
+
+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/exp/d98450.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.hlsl
new file mode 100644
index 0000000..090d2fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp_d98450() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp_d98450();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp_d98450();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp_d98450();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl
new file mode 100644
index 0000000..3dcaac1
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp_d98450() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = exp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp_d98450();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp_d98450();
+ return;
+}
+
+kernel void compute_main() {
+ exp_d98450();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm
new file mode 100644
index 0000000..905659e
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %exp_d98450 "exp_d98450"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %exp_d98450 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Exp %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %exp_d98450
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %exp_d98450
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %exp_d98450
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl
new file mode 100644
index 0000000..9cb0d52
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp/d98450.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp_d98450() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = exp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp_d98450();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp_d98450();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp_d98450();
+}
diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl
new file mode 100644
index 0000000..60cc0e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp2(vec<3, f32>) -> vec<3, f32>
+fn exp2_1f8680() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_1f8680();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_1f8680();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_1f8680();
+}
diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl
new file mode 100644
index 0000000..0cb5d7a
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp2_1f8680() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = exp2(arg_0);
+}
+
+vec4 vertex_main() {
+ exp2_1f8680();
+ 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;
+
+void exp2_1f8680() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = exp2(arg_0);
+}
+
+void fragment_main() {
+ exp2_1f8680();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp2_1f8680() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = exp2(arg_0);
+}
+
+void compute_main() {
+ exp2_1f8680();
+}
+
+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/exp2/1f8680.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.hlsl
new file mode 100644
index 0000000..5265000
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp2_1f8680() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp2_1f8680();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp2_1f8680();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp2_1f8680();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl
new file mode 100644
index 0000000..85188c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp2_1f8680() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp2_1f8680();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp2_1f8680();
+ return;
+}
+
+kernel void compute_main() {
+ exp2_1f8680();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm
new file mode 100644
index 0000000..efcb2f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %exp2_1f8680 "exp2_1f8680"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%exp2_1f8680 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Exp2 %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %exp2_1f8680
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %exp2_1f8680
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %exp2_1f8680
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl
new file mode 100644
index 0000000..1311b3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/1f8680.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp2_1f8680() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_1f8680();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_1f8680();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_1f8680();
+}
diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl
new file mode 100644
index 0000000..918930b
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp2(vec<4, f32>) -> vec<4, f32>
+fn exp2_a9d0a7() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_a9d0a7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_a9d0a7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_a9d0a7();
+}
diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl
new file mode 100644
index 0000000..bbf87b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp2_a9d0a7() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = exp2(arg_0);
+}
+
+vec4 vertex_main() {
+ exp2_a9d0a7();
+ 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;
+
+void exp2_a9d0a7() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = exp2(arg_0);
+}
+
+void fragment_main() {
+ exp2_a9d0a7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp2_a9d0a7() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = exp2(arg_0);
+}
+
+void compute_main() {
+ exp2_a9d0a7();
+}
+
+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/exp2/a9d0a7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.hlsl
new file mode 100644
index 0000000..9223653
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp2_a9d0a7() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp2_a9d0a7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp2_a9d0a7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp2_a9d0a7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl
new file mode 100644
index 0000000..ee5cb73
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp2_a9d0a7() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp2_a9d0a7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp2_a9d0a7();
+ return;
+}
+
+kernel void compute_main() {
+ exp2_a9d0a7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm
new file mode 100644
index 0000000..eab9cbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %exp2_a9d0a7 "exp2_a9d0a7"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%exp2_a9d0a7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Exp2 %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %exp2_a9d0a7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %exp2_a9d0a7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %exp2_a9d0a7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl
new file mode 100644
index 0000000..db5f690
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/a9d0a7.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp2_a9d0a7() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_a9d0a7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_a9d0a7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_a9d0a7();
+}
diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl
new file mode 100644
index 0000000..6f77edc
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp2(vec<2, f32>) -> vec<2, f32>
+fn exp2_d6777c() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_d6777c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_d6777c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_d6777c();
+}
diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl
new file mode 100644
index 0000000..cc18345
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp2_d6777c() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = exp2(arg_0);
+}
+
+vec4 vertex_main() {
+ exp2_d6777c();
+ 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;
+
+void exp2_d6777c() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = exp2(arg_0);
+}
+
+void fragment_main() {
+ exp2_d6777c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp2_d6777c() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = exp2(arg_0);
+}
+
+void compute_main() {
+ exp2_d6777c();
+}
+
+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/exp2/d6777c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.hlsl
new file mode 100644
index 0000000..487bb0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp2_d6777c() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp2_d6777c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp2_d6777c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp2_d6777c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl
new file mode 100644
index 0000000..dcda287
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp2_d6777c() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp2_d6777c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp2_d6777c();
+ return;
+}
+
+kernel void compute_main() {
+ exp2_d6777c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm
new file mode 100644
index 0000000..8902f1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %exp2_d6777c "exp2_d6777c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%exp2_d6777c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Exp2 %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %exp2_d6777c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %exp2_d6777c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %exp2_d6777c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl
new file mode 100644
index 0000000..e78ca2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/d6777c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp2_d6777c() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_d6777c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_d6777c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_d6777c();
+}
diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl
new file mode 100644
index 0000000..434d0f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn exp2(f32) -> f32
+fn exp2_dea523() {
+ var arg_0 = 1.0;
+ var res: f32 = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_dea523();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_dea523();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_dea523();
+}
diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl
new file mode 100644
index 0000000..0599396
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void exp2_dea523() {
+ float arg_0 = 1.0f;
+ float res = exp2(arg_0);
+}
+
+vec4 vertex_main() {
+ exp2_dea523();
+ 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;
+
+void exp2_dea523() {
+ float arg_0 = 1.0f;
+ float res = exp2(arg_0);
+}
+
+void fragment_main() {
+ exp2_dea523();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void exp2_dea523() {
+ float arg_0 = 1.0f;
+ float res = exp2(arg_0);
+}
+
+void compute_main() {
+ exp2_dea523();
+}
+
+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/exp2/dea523.wgsl.expected.hlsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.hlsl
new file mode 100644
index 0000000..d276db9
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void exp2_dea523() {
+ float arg_0 = 1.0f;
+ float res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ exp2_dea523();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ exp2_dea523();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ exp2_dea523();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl
new file mode 100644
index 0000000..38c0029
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void exp2_dea523() {
+ float arg_0 = 1.0f;
+ float res = exp2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ exp2_dea523();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ exp2_dea523();
+ return;
+}
+
+kernel void compute_main() {
+ exp2_dea523();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm
new file mode 100644
index 0000000..b350153
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %exp2_dea523 "exp2_dea523"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%exp2_dea523 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Exp2 %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %exp2_dea523
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %exp2_dea523
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %exp2_dea523
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl
new file mode 100644
index 0000000..f47e367
--- /dev/null
+++ b/test/tint/builtins/gen/var/exp2/dea523.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn exp2_dea523() {
+ var arg_0 = 1.0;
+ var res : f32 = exp2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ exp2_dea523();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ exp2_dea523();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ exp2_dea523();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl
new file mode 100644
index 0000000..75d988b
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(vec<3, u32>, u32, u32) -> vec<3, u32>
+fn extractBits_12b197() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: vec3<u32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_12b197();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_12b197();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_12b197();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl
new file mode 100644
index 0000000..3ad6ce8
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_12b197() {
+ uvec3 arg_0 = uvec3(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_12b197();
+ 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;
+
+uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_12b197() {
+ uvec3 arg_0 = uvec3(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_12b197();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec3 tint_extract_bits(uvec3 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_12b197() {
+ uvec3 arg_0 = uvec3(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_12b197();
+}
+
+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/extractBits/12b197.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.hlsl
new file mode 100644
index 0000000..bfd2b85
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint3 tint_extract_bits(uint3 v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << uint3((shl).xxx)) >> uint3((shr).xxx));
+}
+
+void extractBits_12b197() {
+ uint3 arg_0 = (0u).xxx;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_12b197();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_12b197();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_12b197();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl
new file mode 100644
index 0000000..74f5767
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint3 tint_extract_bits(uint3 v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_12b197() {
+ uint3 arg_0 = uint3(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_12b197();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_12b197();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_12b197();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm
new file mode 100644
index 0000000..e436392
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_12b197 "extractBits_12b197"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3uint = OpTypeVector %uint 3
+ %9 = OpTypeFunction %v3uint %v3uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
+ %28 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %34 = OpConstantNull %uint
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %v3uint None %9
+ %v = OpFunctionParameter %v3uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %16 = OpLabel
+ %17 = OpExtInst %uint %18 UMin %offset %uint_32
+ %21 = OpIAdd %uint %17 %count
+ %20 = OpExtInst %uint %18 UMin %uint_32 %21
+ %23 = OpISub %uint %20 %17
+ %22 = OpBitFieldUExtract %v3uint %v %17 %23
+ OpReturnValue %22
+ OpFunctionEnd
+%extractBits_12b197 = OpFunction %void None %24
+ %27 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %28
+ %arg_1 = OpVariable %_ptr_Function_uint Function %34
+ %arg_2 = OpVariable %_ptr_Function_uint Function %34
+ %res = OpVariable %_ptr_Function_v3uint Function %28
+ OpStore %arg_0 %28
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %37 = OpLoad %v3uint %arg_0
+ %38 = OpLoad %uint %arg_1
+ %39 = OpLoad %uint %arg_2
+ %36 = OpFunctionCall %v3uint %tint_extract_bits %37 %38 %39
+ OpStore %res %36
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %extractBits_12b197
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %extractBits_12b197
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %24
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %extractBits_12b197
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl
new file mode 100644
index 0000000..8aa910c
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/12b197.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_12b197() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : vec3<u32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_12b197();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_12b197();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_12b197();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl
new file mode 100644
index 0000000..58d0877
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(i32, u32, u32) -> i32
+fn extractBits_249874() {
+ var arg_0 = 1;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: i32 = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_249874();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_249874();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_249874();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl
new file mode 100644
index 0000000..1c7b829
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+int tint_extract_bits(int v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_249874() {
+ int arg_0 = 1;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_249874();
+ 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;
+
+int tint_extract_bits(int v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_249874() {
+ int arg_0 = 1;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_249874();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_extract_bits(int v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_249874() {
+ int arg_0 = 1;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_249874();
+}
+
+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/extractBits/249874.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.hlsl
new file mode 100644
index 0000000..bd0e6fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int tint_extract_bits(int v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << shl) >> shr);
+}
+
+void extractBits_249874() {
+ int arg_0 = 1;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_249874();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_249874();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_249874();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl
new file mode 100644
index 0000000..fe768fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int tint_extract_bits(int v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_249874() {
+ int arg_0 = 1;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_249874();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_249874();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_249874();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm
new file mode 100644
index 0000000..8b8dc87
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.spvasm
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_249874 "extractBits_249874"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %int %int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %31 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %35 = OpConstantNull %uint
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %int None %9
+ %v = OpFunctionParameter %int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %16 = OpLabel
+ %17 = OpExtInst %uint %18 UMin %offset %uint_32
+ %21 = OpIAdd %uint %17 %count
+ %20 = OpExtInst %uint %18 UMin %uint_32 %21
+ %23 = OpISub %uint %20 %17
+ %22 = OpBitFieldSExtract %int %v %17 %23
+ OpReturnValue %22
+ OpFunctionEnd
+%extractBits_249874 = OpFunction %void None %24
+ %27 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %31
+ %arg_1 = OpVariable %_ptr_Function_uint Function %35
+ %arg_2 = OpVariable %_ptr_Function_uint Function %35
+ %res = OpVariable %_ptr_Function_int Function %31
+ OpStore %arg_0 %int_1
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %38 = OpLoad %int %arg_0
+ %39 = OpLoad %uint %arg_1
+ %40 = OpLoad %uint %arg_2
+ %37 = OpFunctionCall %int %tint_extract_bits %38 %39 %40
+ OpStore %res %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %extractBits_249874
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %extractBits_249874
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %24
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %extractBits_249874
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7a2804
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/249874.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_249874() {
+ var arg_0 = 1;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : i32 = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_249874();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_249874();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_249874();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl
new file mode 100644
index 0000000..3785159
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(vec<4, u32>, u32, u32) -> vec<4, u32>
+fn extractBits_631377() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: vec4<u32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_631377();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_631377();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_631377();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl
new file mode 100644
index 0000000..ecb1aac
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_631377() {
+ uvec4 arg_0 = uvec4(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_631377();
+ 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;
+
+uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_631377() {
+ uvec4 arg_0 = uvec4(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_631377();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec4 tint_extract_bits(uvec4 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_631377() {
+ uvec4 arg_0 = uvec4(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_631377();
+}
+
+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/extractBits/631377.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.hlsl
new file mode 100644
index 0000000..6ee22ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint4 tint_extract_bits(uint4 v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx));
+}
+
+void extractBits_631377() {
+ uint4 arg_0 = (0u).xxxx;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_631377();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_631377();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_631377();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl
new file mode 100644
index 0000000..b19cf25
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint4 tint_extract_bits(uint4 v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_631377() {
+ uint4 arg_0 = uint4(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_631377();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_631377();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_631377();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm
new file mode 100644
index 0000000..1c51271
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_631377 "extractBits_631377"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4uint = OpTypeVector %uint 4
+ %9 = OpTypeFunction %v4uint %v4uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
+ %28 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %34 = OpConstantNull %uint
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %v4uint None %9
+ %v = OpFunctionParameter %v4uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %16 = OpLabel
+ %17 = OpExtInst %uint %18 UMin %offset %uint_32
+ %21 = OpIAdd %uint %17 %count
+ %20 = OpExtInst %uint %18 UMin %uint_32 %21
+ %23 = OpISub %uint %20 %17
+ %22 = OpBitFieldUExtract %v4uint %v %17 %23
+ OpReturnValue %22
+ OpFunctionEnd
+%extractBits_631377 = OpFunction %void None %24
+ %27 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %28
+ %arg_1 = OpVariable %_ptr_Function_uint Function %34
+ %arg_2 = OpVariable %_ptr_Function_uint Function %34
+ %res = OpVariable %_ptr_Function_v4uint Function %28
+ OpStore %arg_0 %28
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %37 = OpLoad %v4uint %arg_0
+ %38 = OpLoad %uint %arg_1
+ %39 = OpLoad %uint %arg_2
+ %36 = OpFunctionCall %v4uint %tint_extract_bits %37 %38 %39
+ OpStore %res %36
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %extractBits_631377
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %extractBits_631377
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %24
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %extractBits_631377
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl
new file mode 100644
index 0000000..23e45d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/631377.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_631377() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : vec4<u32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_631377();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_631377();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_631377();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl
new file mode 100644
index 0000000..0086a4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(vec<2, i32>, u32, u32) -> vec<2, i32>
+fn extractBits_a99a8d() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: vec2<i32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_a99a8d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_a99a8d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_a99a8d();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl
new file mode 100644
index 0000000..18db5ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_a99a8d() {
+ ivec2 arg_0 = ivec2(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_a99a8d();
+ 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;
+
+ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_a99a8d() {
+ ivec2 arg_0 = ivec2(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_a99a8d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec2 tint_extract_bits(ivec2 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_a99a8d() {
+ ivec2 arg_0 = ivec2(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_a99a8d();
+}
+
+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/extractBits/a99a8d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.hlsl
new file mode 100644
index 0000000..4307614
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int2 tint_extract_bits(int2 v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << uint2((shl).xx)) >> uint2((shr).xx));
+}
+
+void extractBits_a99a8d() {
+ int2 arg_0 = (0).xx;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_a99a8d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_a99a8d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_a99a8d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl
new file mode 100644
index 0000000..8065066
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int2 tint_extract_bits(int2 v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_a99a8d() {
+ int2 arg_0 = int2(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_a99a8d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_a99a8d();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_a99a8d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm
new file mode 100644
index 0000000..717854e
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.spvasm
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_a99a8d "extractBits_a99a8d"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %v2int %v2int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %29 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %35 = OpConstantNull %uint
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %v2int None %9
+ %v = OpFunctionParameter %v2int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldSExtract %v2int %v %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%extractBits_a99a8d = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %29
+ %arg_1 = OpVariable %_ptr_Function_uint Function %35
+ %arg_2 = OpVariable %_ptr_Function_uint Function %35
+ %res = OpVariable %_ptr_Function_v2int Function %29
+ OpStore %arg_0 %29
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %38 = OpLoad %v2int %arg_0
+ %39 = OpLoad %uint %arg_1
+ %40 = OpLoad %uint %arg_2
+ %37 = OpFunctionCall %v2int %tint_extract_bits %38 %39 %40
+ OpStore %res %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %extractBits_a99a8d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %extractBits_a99a8d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %extractBits_a99a8d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl
new file mode 100644
index 0000000..de8bc4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/a99a8d.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_a99a8d() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : vec2<i32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_a99a8d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_a99a8d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_a99a8d();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl
new file mode 100644
index 0000000..1e1e5fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(u32, u32, u32) -> u32
+fn extractBits_ce81f8() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: u32 = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_ce81f8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_ce81f8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_ce81f8();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl
new file mode 100644
index 0000000..117480c
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+uint tint_extract_bits(uint v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_ce81f8() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_ce81f8();
+ 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;
+
+uint tint_extract_bits(uint v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_ce81f8() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_ce81f8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_extract_bits(uint v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_ce81f8() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_ce81f8();
+}
+
+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/extractBits/ce81f8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.hlsl
new file mode 100644
index 0000000..944fe86
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint tint_extract_bits(uint v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << shl) >> shr);
+}
+
+void extractBits_ce81f8() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_ce81f8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_ce81f8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_ce81f8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl
new file mode 100644
index 0000000..60f0680
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint tint_extract_bits(uint v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_ce81f8() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_ce81f8();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_ce81f8();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_ce81f8();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm
new file mode 100644
index 0000000..bd13e5e
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 52
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_ce81f8 "extractBits_ce81f8"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %uint %uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %23 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %30 = OpConstantNull %uint
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %uint None %9
+ %v = OpFunctionParameter %uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %15 = OpLabel
+ %16 = OpExtInst %uint %17 UMin %offset %uint_32
+ %20 = OpIAdd %uint %16 %count
+ %19 = OpExtInst %uint %17 UMin %uint_32 %20
+ %22 = OpISub %uint %19 %16
+ %21 = OpBitFieldUExtract %uint %v %16 %22
+ OpReturnValue %21
+ OpFunctionEnd
+%extractBits_ce81f8 = OpFunction %void None %23
+ %26 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %30
+ %arg_1 = OpVariable %_ptr_Function_uint Function %30
+ %arg_2 = OpVariable %_ptr_Function_uint Function %30
+ %res = OpVariable %_ptr_Function_uint Function %30
+ OpStore %arg_0 %uint_1
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %34 = OpLoad %uint %arg_0
+ %35 = OpLoad %uint %arg_1
+ %36 = OpLoad %uint %arg_2
+ %33 = OpFunctionCall %uint %tint_extract_bits %34 %35 %36
+ OpStore %res %33
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %extractBits_ce81f8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %23
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %23
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %extractBits_ce81f8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %23
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %extractBits_ce81f8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl
new file mode 100644
index 0000000..0a4a29b
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/ce81f8.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_ce81f8() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : u32 = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_ce81f8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_ce81f8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_ce81f8();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl
new file mode 100644
index 0000000..940eb332
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(vec<3, i32>, u32, u32) -> vec<3, i32>
+fn extractBits_e04f5d() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: vec3<i32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_e04f5d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_e04f5d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_e04f5d();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl
new file mode 100644
index 0000000..80e3d78
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_e04f5d() {
+ ivec3 arg_0 = ivec3(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_e04f5d();
+ 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;
+
+ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_e04f5d() {
+ ivec3 arg_0 = ivec3(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_e04f5d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec3 tint_extract_bits(ivec3 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_e04f5d() {
+ ivec3 arg_0 = ivec3(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_e04f5d();
+}
+
+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/extractBits/e04f5d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.hlsl
new file mode 100644
index 0000000..f1cb606
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int3 tint_extract_bits(int3 v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << uint3((shl).xxx)) >> uint3((shr).xxx));
+}
+
+void extractBits_e04f5d() {
+ int3 arg_0 = (0).xxx;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_e04f5d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_e04f5d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_e04f5d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl
new file mode 100644
index 0000000..9587087
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int3 tint_extract_bits(int3 v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_e04f5d() {
+ int3 arg_0 = int3(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int3 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_e04f5d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_e04f5d();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_e04f5d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm
new file mode 100644
index 0000000..fd159b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.spvasm
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_e04f5d "extractBits_e04f5d"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %v3int %v3int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %29 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %35 = OpConstantNull %uint
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %v3int None %9
+ %v = OpFunctionParameter %v3int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldSExtract %v3int %v %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%extractBits_e04f5d = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %29
+ %arg_1 = OpVariable %_ptr_Function_uint Function %35
+ %arg_2 = OpVariable %_ptr_Function_uint Function %35
+ %res = OpVariable %_ptr_Function_v3int Function %29
+ OpStore %arg_0 %29
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %38 = OpLoad %v3int %arg_0
+ %39 = OpLoad %uint %arg_1
+ %40 = OpLoad %uint %arg_2
+ %37 = OpFunctionCall %v3int %tint_extract_bits %38 %39 %40
+ OpStore %res %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %extractBits_e04f5d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %extractBits_e04f5d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %extractBits_e04f5d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl
new file mode 100644
index 0000000..a866a10
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/e04f5d.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_e04f5d() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : vec3<i32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_e04f5d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_e04f5d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_e04f5d();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl
new file mode 100644
index 0000000..4c40da4
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(vec<2, u32>, u32, u32) -> vec<2, u32>
+fn extractBits_f28f69() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: vec2<u32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_f28f69();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_f28f69();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_f28f69();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl
new file mode 100644
index 0000000..a5b640b
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_f28f69() {
+ uvec2 arg_0 = uvec2(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_f28f69();
+ 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;
+
+uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_f28f69() {
+ uvec2 arg_0 = uvec2(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_f28f69();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec2 tint_extract_bits(uvec2 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_f28f69() {
+ uvec2 arg_0 = uvec2(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uvec2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_f28f69();
+}
+
+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/extractBits/f28f69.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.hlsl
new file mode 100644
index 0000000..d5e4931
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint2 tint_extract_bits(uint2 v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << uint2((shl).xx)) >> uint2((shr).xx));
+}
+
+void extractBits_f28f69() {
+ uint2 arg_0 = (0u).xx;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_f28f69();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_f28f69();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_f28f69();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl
new file mode 100644
index 0000000..bd0078e
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint2 tint_extract_bits(uint2 v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_f28f69() {
+ uint2 arg_0 = uint2(0u);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint2 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_f28f69();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_f28f69();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_f28f69();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm
new file mode 100644
index 0000000..fb2a5f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_f28f69 "extractBits_f28f69"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2uint = OpTypeVector %uint 2
+ %9 = OpTypeFunction %v2uint %v2uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
+ %28 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %34 = OpConstantNull %uint
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %v2uint None %9
+ %v = OpFunctionParameter %v2uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %16 = OpLabel
+ %17 = OpExtInst %uint %18 UMin %offset %uint_32
+ %21 = OpIAdd %uint %17 %count
+ %20 = OpExtInst %uint %18 UMin %uint_32 %21
+ %23 = OpISub %uint %20 %17
+ %22 = OpBitFieldUExtract %v2uint %v %17 %23
+ OpReturnValue %22
+ OpFunctionEnd
+%extractBits_f28f69 = OpFunction %void None %24
+ %27 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %28
+ %arg_1 = OpVariable %_ptr_Function_uint Function %34
+ %arg_2 = OpVariable %_ptr_Function_uint Function %34
+ %res = OpVariable %_ptr_Function_v2uint Function %28
+ OpStore %arg_0 %28
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %37 = OpLoad %v2uint %arg_0
+ %38 = OpLoad %uint %arg_1
+ %39 = OpLoad %uint %arg_2
+ %36 = OpFunctionCall %v2uint %tint_extract_bits %37 %38 %39
+ OpStore %res %36
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %extractBits_f28f69
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %extractBits_f28f69
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %24
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %extractBits_f28f69
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl
new file mode 100644
index 0000000..f70d9c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/f28f69.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_f28f69() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : vec2<u32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_f28f69();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_f28f69();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_f28f69();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl
new file mode 100644
index 0000000..f31e60e
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn extractBits(vec<4, i32>, u32, u32) -> vec<4, i32>
+fn extractBits_fb850f() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res: vec4<i32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_fb850f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_fb850f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_fb850f();
+}
diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl
new file mode 100644
index 0000000..db67c07
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.glsl
@@ -0,0 +1,76 @@
+#version 310 es
+
+ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_fb850f() {
+ ivec4 arg_0 = ivec4(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ extractBits_fb850f();
+ 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;
+
+ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_fb850f() {
+ ivec4 arg_0 = ivec4(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ extractBits_fb850f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec4 tint_extract_bits(ivec4 v, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldExtract(v, int(s), int((e - s)));
+}
+
+void extractBits_fb850f() {
+ ivec4 arg_0 = ivec4(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ ivec4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ extractBits_fb850f();
+}
+
+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/extractBits/fb850f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.hlsl
new file mode 100644
index 0000000..e6a538d
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int4 tint_extract_bits(int4 v, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint shl = (32u - e);
+ const uint shr = (shl + s);
+ return ((v << uint4((shl).xxxx)) >> uint4((shr).xxxx));
+}
+
+void extractBits_fb850f() {
+ int4 arg_0 = (0).xxxx;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ extractBits_fb850f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ extractBits_fb850f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ extractBits_fb850f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl
new file mode 100644
index 0000000..ff1e0a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.msl
@@ -0,0 +1,42 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int4 tint_extract_bits(int4 v, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return extract_bits(v, s, (e - s));
+}
+
+void extractBits_fb850f() {
+ int4 arg_0 = int4(0);
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ int4 res = tint_extract_bits(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ extractBits_fb850f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ extractBits_fb850f();
+ return;
+}
+
+kernel void compute_main() {
+ extractBits_fb850f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm
new file mode 100644
index 0000000..33149d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.spvasm
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_extract_bits "tint_extract_bits"
+ OpName %v "v"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %extractBits_fb850f "extractBits_fb850f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %v4int %v4int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %29 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %35 = OpConstantNull %uint
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_extract_bits = OpFunction %v4int None %9
+ %v = OpFunctionParameter %v4int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldSExtract %v4int %v %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%extractBits_fb850f = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %29
+ %arg_1 = OpVariable %_ptr_Function_uint Function %35
+ %arg_2 = OpVariable %_ptr_Function_uint Function %35
+ %res = OpVariable %_ptr_Function_v4int Function %29
+ OpStore %arg_0 %29
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ %38 = OpLoad %v4int %arg_0
+ %39 = OpLoad %uint %arg_1
+ %40 = OpLoad %uint %arg_2
+ %37 = OpFunctionCall %v4int %tint_extract_bits %38 %39 %40
+ OpStore %res %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %extractBits_fb850f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %extractBits_fb850f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %extractBits_fb850f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl
new file mode 100644
index 0000000..1b0afd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/extractBits/fb850f.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn extractBits_fb850f() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var res : vec4<i32> = extractBits(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ extractBits_fb850f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ extractBits_fb850f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ extractBits_fb850f();
+}
diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl
new file mode 100644
index 0000000..25d1a73
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn faceForward(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn faceForward_5afbd5() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res: vec3<f32> = faceForward(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ faceForward_5afbd5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ faceForward_5afbd5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ faceForward_5afbd5();
+}
diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl
new file mode 100644
index 0000000..d14d0d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void faceForward_5afbd5() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ faceForward_5afbd5();
+ 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;
+
+void faceForward_5afbd5() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ faceForward_5afbd5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void faceForward_5afbd5() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ faceForward_5afbd5();
+}
+
+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/faceForward/5afbd5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.hlsl
new file mode 100644
index 0000000..6983f1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void faceForward_5afbd5() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 arg_2 = (0.0f).xxx;
+ float3 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ faceForward_5afbd5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ faceForward_5afbd5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ faceForward_5afbd5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl
new file mode 100644
index 0000000..74f5cd1
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void faceForward_5afbd5() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 arg_2 = float3(0.0f);
+ float3 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ faceForward_5afbd5();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ faceForward_5afbd5();
+ return;
+}
+
+kernel void compute_main() {
+ faceForward_5afbd5();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm
new file mode 100644
index 0000000..278ef67
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %faceForward_5afbd5 "faceForward_5afbd5"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%faceForward_5afbd5 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v3float %arg_0
+ %22 = OpLoad %v3float %arg_1
+ %23 = OpLoad %v3float %arg_2
+ %19 = OpExtInst %v3float %20 FaceForward %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %faceForward_5afbd5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %faceForward_5afbd5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %faceForward_5afbd5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl
new file mode 100644
index 0000000..56bed23
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/5afbd5.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn faceForward_5afbd5() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res : vec3<f32> = faceForward(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ faceForward_5afbd5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ faceForward_5afbd5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ faceForward_5afbd5();
+}
diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl
new file mode 100644
index 0000000..4d4e57c
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn faceForward(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn faceForward_b316e5() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res: vec4<f32> = faceForward(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ faceForward_b316e5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ faceForward_b316e5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ faceForward_b316e5();
+}
diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl
new file mode 100644
index 0000000..99adf65
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void faceForward_b316e5() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ faceForward_b316e5();
+ 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;
+
+void faceForward_b316e5() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ faceForward_b316e5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void faceForward_b316e5() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ faceForward_b316e5();
+}
+
+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/faceForward/b316e5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.hlsl
new file mode 100644
index 0000000..b11b1da
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void faceForward_b316e5() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 arg_2 = (0.0f).xxxx;
+ float4 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ faceForward_b316e5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ faceForward_b316e5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ faceForward_b316e5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl
new file mode 100644
index 0000000..72ccfcb
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void faceForward_b316e5() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 arg_2 = float4(0.0f);
+ float4 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ faceForward_b316e5();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ faceForward_b316e5();
+ return;
+}
+
+kernel void compute_main() {
+ faceForward_b316e5();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm
new file mode 100644
index 0000000..f88252b
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %faceForward_b316e5 "faceForward_b316e5"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%faceForward_b316e5 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %5
+ %19 = OpLoad %v4float %arg_0
+ %20 = OpLoad %v4float %arg_1
+ %21 = OpLoad %v4float %arg_2
+ %17 = OpExtInst %v4float %18 FaceForward %19 %20 %21
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %faceForward_b316e5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %faceForward_b316e5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %faceForward_b316e5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl
new file mode 100644
index 0000000..50154f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/b316e5.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn faceForward_b316e5() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res : vec4<f32> = faceForward(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ faceForward_b316e5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ faceForward_b316e5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ faceForward_b316e5();
+}
diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl
new file mode 100644
index 0000000..5cb18c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn faceForward(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn faceForward_e6908b() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res: vec2<f32> = faceForward(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ faceForward_e6908b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ faceForward_e6908b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ faceForward_e6908b();
+}
diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl
new file mode 100644
index 0000000..d2f0fd3
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void faceForward_e6908b() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ faceForward_e6908b();
+ 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;
+
+void faceForward_e6908b() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ faceForward_e6908b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void faceForward_e6908b() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ faceForward_e6908b();
+}
+
+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/faceForward/e6908b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.hlsl
new file mode 100644
index 0000000..9f71b86
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void faceForward_e6908b() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 arg_2 = (0.0f).xx;
+ float2 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ faceForward_e6908b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ faceForward_e6908b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ faceForward_e6908b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl
new file mode 100644
index 0000000..ca6e3a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void faceForward_e6908b() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 arg_2 = float2(0.0f);
+ float2 res = faceforward(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ faceForward_e6908b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ faceForward_e6908b();
+ return;
+}
+
+kernel void compute_main() {
+ faceForward_e6908b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm
new file mode 100644
index 0000000..461a75a
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %faceForward_e6908b "faceForward_e6908b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%faceForward_e6908b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v2float %arg_0
+ %22 = OpLoad %v2float %arg_1
+ %23 = OpLoad %v2float %arg_2
+ %19 = OpExtInst %v2float %20 FaceForward %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %faceForward_e6908b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %faceForward_e6908b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %faceForward_e6908b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl
new file mode 100644
index 0000000..7e8df96
--- /dev/null
+++ b/test/tint/builtins/gen/var/faceForward/e6908b.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn faceForward_e6908b() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res : vec2<f32> = faceForward(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ faceForward_e6908b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ faceForward_e6908b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ faceForward_e6908b();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl
new file mode 100644
index 0000000..6ce9b05
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(vec<4, u32>) -> vec<4, u32>
+fn firstLeadingBit_000ff3() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_000ff3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_000ff3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_000ff3();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl
new file mode 100644
index 0000000..acfe1bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec4 tint_first_leading_bit(uvec4 v) {
+ uvec4 x = v;
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_000ff3() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_000ff3();
+ 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;
+
+uvec4 tint_first_leading_bit(uvec4 v) {
+ uvec4 x = v;
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_000ff3() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_000ff3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec4 tint_first_leading_bit(uvec4 v) {
+ uvec4 x = v;
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_000ff3() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_000ff3();
+}
+
+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/firstLeadingBit/000ff3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.hlsl
new file mode 100644
index 0000000..aa95d71
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint4 tint_first_leading_bit(uint4 v) {
+ uint4 x = v;
+ const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx);
+ x = (x >> b16);
+ const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx);
+ x = (x >> b8);
+ const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx);
+ x = (x >> b4);
+ const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx);
+ x = (x >> b2);
+ const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
+ return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_000ff3() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_000ff3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_000ff3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_000ff3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl
new file mode 100644
index 0000000..f5e731b
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint4 tint_first_leading_bit(uint4 v) {
+ uint4 x = v;
+ uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u))));
+ x = (x >> b16);
+ uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u))));
+ x = (x >> b8);
+ uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u))));
+ x = (x >> b4);
+ uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u))));
+ x = (x >> b2);
+ uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u))));
+ uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u)));
+ return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_000ff3() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_000ff3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_000ff3();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_000ff3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm
new file mode 100644
index 0000000..dc0c5a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.spvasm
@@ -0,0 +1,144 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 99
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_000ff3 "firstLeadingBit_000ff3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4uint = OpTypeVector %uint 4
+ %9 = OpTypeFunction %v4uint %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %17 = OpConstantNull %v4uint
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+%uint_4294901760 = OpConstant %uint 4294901760
+ %24 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760
+ %uint_16 = OpConstant %uint 16
+ %27 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+ %uint_65280 = OpConstant %uint 65280
+ %34 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280
+ %uint_8 = OpConstant %uint 8
+ %37 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+ %uint_240 = OpConstant %uint 240
+ %44 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240
+ %uint_4 = OpConstant %uint 4
+ %47 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+ %uint_12 = OpConstant %uint 12
+ %54 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12
+ %uint_2 = OpConstant %uint 2
+ %57 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %70 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %77 = OpTypeFunction %void
+ %85 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %v4uint None %9
+ %v = OpFunctionParameter %v4uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %17
+ OpStore %x %v
+ %22 = OpLoad %v4uint %x
+ %25 = OpBitwiseAnd %v4uint %22 %24
+ %19 = OpINotEqual %v4bool %25 %17
+ %18 = OpSelect %v4uint %19 %27 %17
+ %28 = OpLoad %v4uint %x
+ %29 = OpShiftRightLogical %v4uint %28 %18
+ OpStore %x %29
+ %32 = OpLoad %v4uint %x
+ %35 = OpBitwiseAnd %v4uint %32 %34
+ %31 = OpINotEqual %v4bool %35 %17
+ %30 = OpSelect %v4uint %31 %37 %17
+ %38 = OpLoad %v4uint %x
+ %39 = OpShiftRightLogical %v4uint %38 %30
+ OpStore %x %39
+ %42 = OpLoad %v4uint %x
+ %45 = OpBitwiseAnd %v4uint %42 %44
+ %41 = OpINotEqual %v4bool %45 %17
+ %40 = OpSelect %v4uint %41 %47 %17
+ %48 = OpLoad %v4uint %x
+ %49 = OpShiftRightLogical %v4uint %48 %40
+ OpStore %x %49
+ %52 = OpLoad %v4uint %x
+ %55 = OpBitwiseAnd %v4uint %52 %54
+ %51 = OpINotEqual %v4bool %55 %17
+ %50 = OpSelect %v4uint %51 %57 %17
+ %58 = OpLoad %v4uint %x
+ %59 = OpShiftRightLogical %v4uint %58 %50
+ OpStore %x %59
+ %62 = OpLoad %v4uint %x
+ %63 = OpBitwiseAnd %v4uint %62 %57
+ %61 = OpINotEqual %v4bool %63 %17
+ %60 = OpSelect %v4uint %61 %65 %17
+ %67 = OpLoad %v4uint %x
+ %68 = OpIEqual %v4bool %67 %17
+ %66 = OpSelect %v4uint %68 %70 %17
+ %72 = OpBitwiseOr %v4uint %18 %30
+ %73 = OpBitwiseOr %v4uint %72 %40
+ %74 = OpBitwiseOr %v4uint %73 %50
+ %75 = OpBitwiseOr %v4uint %74 %60
+ %76 = OpBitwiseOr %v4uint %75 %66
+ OpReturnValue %76
+ OpFunctionEnd
+%firstLeadingBit_000ff3 = OpFunction %void None %77
+ %80 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %17
+ %res = OpVariable %_ptr_Function_v4uint Function %17
+ OpStore %arg_0 %17
+ %83 = OpLoad %v4uint %arg_0
+ %82 = OpFunctionCall %v4uint %tint_first_leading_bit %83
+ OpStore %res %82
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %85
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %firstLeadingBit_000ff3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %77
+ %90 = OpLabel
+ %91 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %91
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %77
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %firstLeadingBit_000ff3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %77
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %firstLeadingBit_000ff3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl
new file mode 100644
index 0000000..d0c3dfc
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/000ff3.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_000ff3() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_000ff3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_000ff3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_000ff3();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl
new file mode 100644
index 0000000..9ff1c99
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(vec<3, i32>) -> vec<3, i32>
+fn firstLeadingBit_35053e() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_35053e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_35053e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_35053e();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl
new file mode 100644
index 0000000..180ee53
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec3 tint_first_leading_bit(ivec3 v) {
+ uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_35053e() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_35053e();
+ 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;
+
+ivec3 tint_first_leading_bit(ivec3 v) {
+ uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_35053e() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_35053e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec3 tint_first_leading_bit(ivec3 v) {
+ uvec3 x = mix(uvec3(v), uvec3(~(v)), lessThan(v, ivec3(0)));
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_35053e() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_35053e();
+}
+
+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/firstLeadingBit/35053e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.hlsl
new file mode 100644
index 0000000..f514b46
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int3 tint_first_leading_bit(int3 v) {
+ uint3 x = ((v < (0).xxx) ? uint3(~(v)) : uint3(v));
+ const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx);
+ x = (x >> b16);
+ const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx);
+ x = (x >> b8);
+ const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx);
+ x = (x >> b4);
+ const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx);
+ x = (x >> b2);
+ const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
+ return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_35053e() {
+ int3 arg_0 = (0).xxx;
+ int3 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_35053e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_35053e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_35053e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl
new file mode 100644
index 0000000..73d3d90
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int3 tint_first_leading_bit(int3 v) {
+ uint3 x = select(uint3(v), uint3(~(v)), (v < int3(0)));
+ uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u))));
+ x = (x >> b16);
+ uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u))));
+ x = (x >> b8);
+ uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u))));
+ x = (x >> b4);
+ uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u))));
+ x = (x >> b2);
+ uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u))));
+ uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u)));
+ return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_35053e() {
+ int3 arg_0 = int3(0);
+ int3 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_35053e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_35053e();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_35053e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm
new file mode 100644
index 0000000..f076535
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.spvasm
@@ -0,0 +1,154 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 108
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_35053e "firstLeadingBit_35053e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %9 = OpTypeFunction %v3int %v3int
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %18 = OpConstantNull %v3int
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %27 = OpConstantNull %v3uint
+%uint_4294901760 = OpConstant %uint 4294901760
+ %32 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760
+ %uint_16 = OpConstant %uint 16
+ %35 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+ %uint_65280 = OpConstant %uint 65280
+ %42 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280
+ %uint_8 = OpConstant %uint 8
+ %45 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+ %uint_240 = OpConstant %uint 240
+ %52 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240
+ %uint_4 = OpConstant %uint 4
+ %55 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %uint_12 = OpConstant %uint 12
+ %62 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12
+ %uint_2 = OpConstant %uint 2
+ %65 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %73 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %78 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %85 = OpTypeFunction %void
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %94 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %v3int None %9
+ %v = OpFunctionParameter %v3int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %27
+ %19 = OpSLessThan %v3bool %v %18
+ %23 = OpNot %v3int %v
+ %22 = OpBitcast %v3uint %23
+ %24 = OpBitcast %v3uint %v
+ %15 = OpSelect %v3uint %19 %22 %24
+ OpStore %x %15
+ %30 = OpLoad %v3uint %x
+ %33 = OpBitwiseAnd %v3uint %30 %32
+ %29 = OpINotEqual %v3bool %33 %27
+ %28 = OpSelect %v3uint %29 %35 %27
+ %36 = OpLoad %v3uint %x
+ %37 = OpShiftRightLogical %v3uint %36 %28
+ OpStore %x %37
+ %40 = OpLoad %v3uint %x
+ %43 = OpBitwiseAnd %v3uint %40 %42
+ %39 = OpINotEqual %v3bool %43 %27
+ %38 = OpSelect %v3uint %39 %45 %27
+ %46 = OpLoad %v3uint %x
+ %47 = OpShiftRightLogical %v3uint %46 %38
+ OpStore %x %47
+ %50 = OpLoad %v3uint %x
+ %53 = OpBitwiseAnd %v3uint %50 %52
+ %49 = OpINotEqual %v3bool %53 %27
+ %48 = OpSelect %v3uint %49 %55 %27
+ %56 = OpLoad %v3uint %x
+ %57 = OpShiftRightLogical %v3uint %56 %48
+ OpStore %x %57
+ %60 = OpLoad %v3uint %x
+ %63 = OpBitwiseAnd %v3uint %60 %62
+ %59 = OpINotEqual %v3bool %63 %27
+ %58 = OpSelect %v3uint %59 %65 %27
+ %66 = OpLoad %v3uint %x
+ %67 = OpShiftRightLogical %v3uint %66 %58
+ OpStore %x %67
+ %70 = OpLoad %v3uint %x
+ %71 = OpBitwiseAnd %v3uint %70 %65
+ %69 = OpINotEqual %v3bool %71 %27
+ %68 = OpSelect %v3uint %69 %73 %27
+ %75 = OpLoad %v3uint %x
+ %76 = OpIEqual %v3bool %75 %27
+ %74 = OpSelect %v3uint %76 %78 %27
+ %80 = OpBitwiseOr %v3uint %28 %38
+ %81 = OpBitwiseOr %v3uint %80 %48
+ %82 = OpBitwiseOr %v3uint %81 %58
+ %83 = OpBitwiseOr %v3uint %82 %68
+ %84 = OpBitwiseOr %v3uint %83 %74
+ %79 = OpBitcast %v3int %84
+ OpReturnValue %79
+ OpFunctionEnd
+%firstLeadingBit_35053e = OpFunction %void None %85
+ %88 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %18
+ %res = OpVariable %_ptr_Function_v3int Function %18
+ OpStore %arg_0 %18
+ %92 = OpLoad %v3int %arg_0
+ %91 = OpFunctionCall %v3int %tint_first_leading_bit %92
+ OpStore %res %91
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %94
+ %96 = OpLabel
+ %97 = OpFunctionCall %void %firstLeadingBit_35053e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %85
+ %99 = OpLabel
+ %100 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %100
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %85
+ %103 = OpLabel
+ %104 = OpFunctionCall %void %firstLeadingBit_35053e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %85
+ %106 = OpLabel
+ %107 = OpFunctionCall %void %firstLeadingBit_35053e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl
new file mode 100644
index 0000000..c191cc0
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/35053e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_35053e() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_35053e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_35053e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_35053e();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl
new file mode 100644
index 0000000..15595a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(vec<3, u32>) -> vec<3, u32>
+fn firstLeadingBit_3fd7d0() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_3fd7d0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_3fd7d0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_3fd7d0();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl
new file mode 100644
index 0000000..0a9b223
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec3 tint_first_leading_bit(uvec3 v) {
+ uvec3 x = v;
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_3fd7d0() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_3fd7d0();
+ 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;
+
+uvec3 tint_first_leading_bit(uvec3 v) {
+ uvec3 x = v;
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_3fd7d0() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_3fd7d0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec3 tint_first_leading_bit(uvec3 v) {
+ uvec3 x = v;
+ uvec3 b16 = mix(uvec3(0u), uvec3(16u), bvec3((x & uvec3(4294901760u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(0u), uvec3(8u), bvec3((x & uvec3(65280u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(0u), uvec3(4u), bvec3((x & uvec3(240u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(0u), uvec3(2u), bvec3((x & uvec3(12u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(0u), uvec3(1u), bvec3((x & uvec3(2u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_3fd7d0() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_3fd7d0();
+}
+
+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/firstLeadingBit/3fd7d0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.hlsl
new file mode 100644
index 0000000..6264691
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint3 tint_first_leading_bit(uint3 v) {
+ uint3 x = v;
+ const uint3 b16 = (bool3((x & (4294901760u).xxx)) ? (16u).xxx : (0u).xxx);
+ x = (x >> b16);
+ const uint3 b8 = (bool3((x & (65280u).xxx)) ? (8u).xxx : (0u).xxx);
+ x = (x >> b8);
+ const uint3 b4 = (bool3((x & (240u).xxx)) ? (4u).xxx : (0u).xxx);
+ x = (x >> b4);
+ const uint3 b2 = (bool3((x & (12u).xxx)) ? (2u).xxx : (0u).xxx);
+ x = (x >> b2);
+ const uint3 b1 = (bool3((x & (2u).xxx)) ? (1u).xxx : (0u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
+ return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_3fd7d0() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_3fd7d0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_3fd7d0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_3fd7d0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl
new file mode 100644
index 0000000..2d31007
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint3 tint_first_leading_bit(uint3 v) {
+ uint3 x = v;
+ uint3 const b16 = select(uint3(0u), uint3(16u), bool3((x & uint3(4294901760u))));
+ x = (x >> b16);
+ uint3 const b8 = select(uint3(0u), uint3(8u), bool3((x & uint3(65280u))));
+ x = (x >> b8);
+ uint3 const b4 = select(uint3(0u), uint3(4u), bool3((x & uint3(240u))));
+ x = (x >> b4);
+ uint3 const b2 = select(uint3(0u), uint3(2u), bool3((x & uint3(12u))));
+ x = (x >> b2);
+ uint3 const b1 = select(uint3(0u), uint3(1u), bool3((x & uint3(2u))));
+ uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u)));
+ return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_3fd7d0() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_3fd7d0();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_3fd7d0();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_3fd7d0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm
new file mode 100644
index 0000000..ac50c76
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.spvasm
@@ -0,0 +1,144 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 99
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_3fd7d0 "firstLeadingBit_3fd7d0"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3uint = OpTypeVector %uint 3
+ %9 = OpTypeFunction %v3uint %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %17 = OpConstantNull %v3uint
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+%uint_4294901760 = OpConstant %uint 4294901760
+ %24 = OpConstantComposite %v3uint %uint_4294901760 %uint_4294901760 %uint_4294901760
+ %uint_16 = OpConstant %uint 16
+ %27 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+ %uint_65280 = OpConstant %uint 65280
+ %34 = OpConstantComposite %v3uint %uint_65280 %uint_65280 %uint_65280
+ %uint_8 = OpConstant %uint 8
+ %37 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+ %uint_240 = OpConstant %uint 240
+ %44 = OpConstantComposite %v3uint %uint_240 %uint_240 %uint_240
+ %uint_4 = OpConstant %uint 4
+ %47 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %uint_12 = OpConstant %uint 12
+ %54 = OpConstantComposite %v3uint %uint_12 %uint_12 %uint_12
+ %uint_2 = OpConstant %uint 2
+ %57 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %70 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %77 = OpTypeFunction %void
+ %85 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %v3uint None %9
+ %v = OpFunctionParameter %v3uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %17
+ OpStore %x %v
+ %22 = OpLoad %v3uint %x
+ %25 = OpBitwiseAnd %v3uint %22 %24
+ %19 = OpINotEqual %v3bool %25 %17
+ %18 = OpSelect %v3uint %19 %27 %17
+ %28 = OpLoad %v3uint %x
+ %29 = OpShiftRightLogical %v3uint %28 %18
+ OpStore %x %29
+ %32 = OpLoad %v3uint %x
+ %35 = OpBitwiseAnd %v3uint %32 %34
+ %31 = OpINotEqual %v3bool %35 %17
+ %30 = OpSelect %v3uint %31 %37 %17
+ %38 = OpLoad %v3uint %x
+ %39 = OpShiftRightLogical %v3uint %38 %30
+ OpStore %x %39
+ %42 = OpLoad %v3uint %x
+ %45 = OpBitwiseAnd %v3uint %42 %44
+ %41 = OpINotEqual %v3bool %45 %17
+ %40 = OpSelect %v3uint %41 %47 %17
+ %48 = OpLoad %v3uint %x
+ %49 = OpShiftRightLogical %v3uint %48 %40
+ OpStore %x %49
+ %52 = OpLoad %v3uint %x
+ %55 = OpBitwiseAnd %v3uint %52 %54
+ %51 = OpINotEqual %v3bool %55 %17
+ %50 = OpSelect %v3uint %51 %57 %17
+ %58 = OpLoad %v3uint %x
+ %59 = OpShiftRightLogical %v3uint %58 %50
+ OpStore %x %59
+ %62 = OpLoad %v3uint %x
+ %63 = OpBitwiseAnd %v3uint %62 %57
+ %61 = OpINotEqual %v3bool %63 %17
+ %60 = OpSelect %v3uint %61 %65 %17
+ %67 = OpLoad %v3uint %x
+ %68 = OpIEqual %v3bool %67 %17
+ %66 = OpSelect %v3uint %68 %70 %17
+ %72 = OpBitwiseOr %v3uint %18 %30
+ %73 = OpBitwiseOr %v3uint %72 %40
+ %74 = OpBitwiseOr %v3uint %73 %50
+ %75 = OpBitwiseOr %v3uint %74 %60
+ %76 = OpBitwiseOr %v3uint %75 %66
+ OpReturnValue %76
+ OpFunctionEnd
+%firstLeadingBit_3fd7d0 = OpFunction %void None %77
+ %80 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %17
+ %res = OpVariable %_ptr_Function_v3uint Function %17
+ OpStore %arg_0 %17
+ %83 = OpLoad %v3uint %arg_0
+ %82 = OpFunctionCall %v3uint %tint_first_leading_bit %83
+ OpStore %res %82
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %85
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %firstLeadingBit_3fd7d0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %77
+ %90 = OpLabel
+ %91 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %91
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %77
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %firstLeadingBit_3fd7d0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %77
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %firstLeadingBit_3fd7d0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl
new file mode 100644
index 0000000..3f079f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/3fd7d0.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_3fd7d0() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_3fd7d0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_3fd7d0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_3fd7d0();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl
new file mode 100644
index 0000000..c6e63f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(i32) -> i32
+fn firstLeadingBit_57a1a3() {
+ var arg_0 = 1;
+ var res: i32 = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_57a1a3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_57a1a3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_57a1a3();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl
new file mode 100644
index 0000000..5a738fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+int tint_first_leading_bit(int v) {
+ uint x = ((v < 0) ? uint(~(v)) : uint(v));
+ uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_57a1a3() {
+ int arg_0 = 1;
+ int res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_57a1a3();
+ 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;
+
+int tint_first_leading_bit(int v) {
+ uint x = ((v < 0) ? uint(~(v)) : uint(v));
+ uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_57a1a3() {
+ int arg_0 = 1;
+ int res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_57a1a3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_first_leading_bit(int v) {
+ uint x = ((v < 0) ? uint(~(v)) : uint(v));
+ uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_57a1a3() {
+ int arg_0 = 1;
+ int res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_57a1a3();
+}
+
+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/firstLeadingBit/57a1a3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.hlsl
new file mode 100644
index 0000000..34f27f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int tint_first_leading_bit(int v) {
+ uint x = ((v < 0) ? uint(~(v)) : uint(v));
+ const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ const uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ const uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ const uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ const uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_57a1a3() {
+ int arg_0 = 1;
+ int res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_57a1a3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_57a1a3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_57a1a3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl
new file mode 100644
index 0000000..cb6e84d
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int tint_first_leading_bit(int v) {
+ uint x = select(uint(v), uint(~(v)), (v < 0));
+ uint const b16 = select(0u, 16u, bool((x & 4294901760u)));
+ x = (x >> b16);
+ uint const b8 = select(0u, 8u, bool((x & 65280u)));
+ x = (x >> b8);
+ uint const b4 = select(0u, 4u, bool((x & 240u)));
+ x = (x >> b4);
+ uint const b2 = select(0u, 2u, bool((x & 12u)));
+ x = (x >> b2);
+ uint const b1 = select(0u, 1u, bool((x & 2u)));
+ uint const is_zero = select(0u, 4294967295u, (x == 0u));
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_57a1a3() {
+ int arg_0 = 1;
+ int res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_57a1a3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_57a1a3();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_57a1a3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm
new file mode 100644
index 0000000..8f38eac
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.spvasm
@@ -0,0 +1,142 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 96
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_57a1a3 "firstLeadingBit_57a1a3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %int %int
+ %uint = OpTypeInt 32 0
+ %16 = OpConstantNull %int
+ %bool = OpTypeBool
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %24 = OpConstantNull %uint
+%uint_4294901760 = OpConstant %uint 4294901760
+ %uint_16 = OpConstant %uint 16
+ %uint_65280 = OpConstant %uint 65280
+ %uint_8 = OpConstant %uint 8
+ %uint_240 = OpConstant %uint 240
+ %uint_4 = OpConstant %uint 4
+ %uint_12 = OpConstant %uint 12
+ %uint_2 = OpConstant %uint 2
+ %uint_1 = OpConstant %uint 1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %void = OpTypeVoid
+ %72 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %82 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %int None %9
+ %v = OpFunctionParameter %int
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %24
+ %17 = OpSLessThan %bool %v %16
+ %20 = OpNot %int %v
+ %19 = OpBitcast %uint %20
+ %21 = OpBitcast %uint %v
+ %14 = OpSelect %uint %17 %19 %21
+ OpStore %x %14
+ %27 = OpLoad %uint %x
+ %29 = OpBitwiseAnd %uint %27 %uint_4294901760
+ %26 = OpINotEqual %bool %29 %24
+ %25 = OpSelect %uint %26 %uint_16 %24
+ %31 = OpLoad %uint %x
+ %32 = OpShiftRightLogical %uint %31 %25
+ OpStore %x %32
+ %35 = OpLoad %uint %x
+ %37 = OpBitwiseAnd %uint %35 %uint_65280
+ %34 = OpINotEqual %bool %37 %24
+ %33 = OpSelect %uint %34 %uint_8 %24
+ %39 = OpLoad %uint %x
+ %40 = OpShiftRightLogical %uint %39 %33
+ OpStore %x %40
+ %43 = OpLoad %uint %x
+ %45 = OpBitwiseAnd %uint %43 %uint_240
+ %42 = OpINotEqual %bool %45 %24
+ %41 = OpSelect %uint %42 %uint_4 %24
+ %47 = OpLoad %uint %x
+ %48 = OpShiftRightLogical %uint %47 %41
+ OpStore %x %48
+ %51 = OpLoad %uint %x
+ %53 = OpBitwiseAnd %uint %51 %uint_12
+ %50 = OpINotEqual %bool %53 %24
+ %49 = OpSelect %uint %50 %uint_2 %24
+ %55 = OpLoad %uint %x
+ %56 = OpShiftRightLogical %uint %55 %49
+ OpStore %x %56
+ %59 = OpLoad %uint %x
+ %60 = OpBitwiseAnd %uint %59 %uint_2
+ %58 = OpINotEqual %bool %60 %24
+ %57 = OpSelect %uint %58 %uint_1 %24
+ %63 = OpLoad %uint %x
+ %64 = OpIEqual %bool %63 %24
+ %62 = OpSelect %uint %64 %uint_4294967295 %24
+ %67 = OpBitwiseOr %uint %25 %33
+ %68 = OpBitwiseOr %uint %67 %41
+ %69 = OpBitwiseOr %uint %68 %49
+ %70 = OpBitwiseOr %uint %69 %57
+ %71 = OpBitwiseOr %uint %70 %62
+ %66 = OpBitcast %int %71
+ OpReturnValue %66
+ OpFunctionEnd
+%firstLeadingBit_57a1a3 = OpFunction %void None %72
+ %75 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %16
+ %res = OpVariable %_ptr_Function_int Function %16
+ OpStore %arg_0 %int_1
+ %80 = OpLoad %int %arg_0
+ %79 = OpFunctionCall %int %tint_first_leading_bit %80
+ OpStore %res %79
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %82
+ %84 = OpLabel
+ %85 = OpFunctionCall %void %firstLeadingBit_57a1a3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %72
+ %87 = OpLabel
+ %88 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %88
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %72
+ %91 = OpLabel
+ %92 = OpFunctionCall %void %firstLeadingBit_57a1a3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %72
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %firstLeadingBit_57a1a3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl
new file mode 100644
index 0000000..00fe1f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/57a1a3.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_57a1a3() {
+ var arg_0 = 1;
+ var res : i32 = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_57a1a3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_57a1a3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_57a1a3();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl
new file mode 100644
index 0000000..483f618
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(vec<2, u32>) -> vec<2, u32>
+fn firstLeadingBit_6fe804() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_6fe804();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_6fe804();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_6fe804();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl
new file mode 100644
index 0000000..e01f3f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec2 tint_first_leading_bit(uvec2 v) {
+ uvec2 x = v;
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_6fe804() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_6fe804();
+ 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;
+
+uvec2 tint_first_leading_bit(uvec2 v) {
+ uvec2 x = v;
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_6fe804() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_6fe804();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec2 tint_first_leading_bit(uvec2 v) {
+ uvec2 x = v;
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_6fe804() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_6fe804();
+}
+
+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/firstLeadingBit/6fe804.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.hlsl
new file mode 100644
index 0000000..fa7b9cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint2 tint_first_leading_bit(uint2 v) {
+ uint2 x = v;
+ const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx);
+ x = (x >> b16);
+ const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx);
+ x = (x >> b8);
+ const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx);
+ x = (x >> b4);
+ const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx);
+ x = (x >> b2);
+ const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
+ return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_6fe804() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_6fe804();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_6fe804();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_6fe804();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl
new file mode 100644
index 0000000..0dce909
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint2 tint_first_leading_bit(uint2 v) {
+ uint2 x = v;
+ uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u))));
+ x = (x >> b16);
+ uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u))));
+ x = (x >> b8);
+ uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u))));
+ x = (x >> b4);
+ uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u))));
+ x = (x >> b2);
+ uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u))));
+ uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u)));
+ return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_6fe804() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_6fe804();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_6fe804();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_6fe804();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm
new file mode 100644
index 0000000..77c6c00
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.spvasm
@@ -0,0 +1,144 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 99
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_6fe804 "firstLeadingBit_6fe804"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2uint = OpTypeVector %uint 2
+ %9 = OpTypeFunction %v2uint %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %17 = OpConstantNull %v2uint
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+%uint_4294901760 = OpConstant %uint 4294901760
+ %24 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760
+ %uint_16 = OpConstant %uint 16
+ %27 = OpConstantComposite %v2uint %uint_16 %uint_16
+ %uint_65280 = OpConstant %uint 65280
+ %34 = OpConstantComposite %v2uint %uint_65280 %uint_65280
+ %uint_8 = OpConstant %uint 8
+ %37 = OpConstantComposite %v2uint %uint_8 %uint_8
+ %uint_240 = OpConstant %uint 240
+ %44 = OpConstantComposite %v2uint %uint_240 %uint_240
+ %uint_4 = OpConstant %uint 4
+ %47 = OpConstantComposite %v2uint %uint_4 %uint_4
+ %uint_12 = OpConstant %uint 12
+ %54 = OpConstantComposite %v2uint %uint_12 %uint_12
+ %uint_2 = OpConstant %uint 2
+ %57 = OpConstantComposite %v2uint %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v2uint %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %70 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %77 = OpTypeFunction %void
+ %85 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %v2uint None %9
+ %v = OpFunctionParameter %v2uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %17
+ OpStore %x %v
+ %22 = OpLoad %v2uint %x
+ %25 = OpBitwiseAnd %v2uint %22 %24
+ %19 = OpINotEqual %v2bool %25 %17
+ %18 = OpSelect %v2uint %19 %27 %17
+ %28 = OpLoad %v2uint %x
+ %29 = OpShiftRightLogical %v2uint %28 %18
+ OpStore %x %29
+ %32 = OpLoad %v2uint %x
+ %35 = OpBitwiseAnd %v2uint %32 %34
+ %31 = OpINotEqual %v2bool %35 %17
+ %30 = OpSelect %v2uint %31 %37 %17
+ %38 = OpLoad %v2uint %x
+ %39 = OpShiftRightLogical %v2uint %38 %30
+ OpStore %x %39
+ %42 = OpLoad %v2uint %x
+ %45 = OpBitwiseAnd %v2uint %42 %44
+ %41 = OpINotEqual %v2bool %45 %17
+ %40 = OpSelect %v2uint %41 %47 %17
+ %48 = OpLoad %v2uint %x
+ %49 = OpShiftRightLogical %v2uint %48 %40
+ OpStore %x %49
+ %52 = OpLoad %v2uint %x
+ %55 = OpBitwiseAnd %v2uint %52 %54
+ %51 = OpINotEqual %v2bool %55 %17
+ %50 = OpSelect %v2uint %51 %57 %17
+ %58 = OpLoad %v2uint %x
+ %59 = OpShiftRightLogical %v2uint %58 %50
+ OpStore %x %59
+ %62 = OpLoad %v2uint %x
+ %63 = OpBitwiseAnd %v2uint %62 %57
+ %61 = OpINotEqual %v2bool %63 %17
+ %60 = OpSelect %v2uint %61 %65 %17
+ %67 = OpLoad %v2uint %x
+ %68 = OpIEqual %v2bool %67 %17
+ %66 = OpSelect %v2uint %68 %70 %17
+ %72 = OpBitwiseOr %v2uint %18 %30
+ %73 = OpBitwiseOr %v2uint %72 %40
+ %74 = OpBitwiseOr %v2uint %73 %50
+ %75 = OpBitwiseOr %v2uint %74 %60
+ %76 = OpBitwiseOr %v2uint %75 %66
+ OpReturnValue %76
+ OpFunctionEnd
+%firstLeadingBit_6fe804 = OpFunction %void None %77
+ %80 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %17
+ %res = OpVariable %_ptr_Function_v2uint Function %17
+ OpStore %arg_0 %17
+ %83 = OpLoad %v2uint %arg_0
+ %82 = OpFunctionCall %v2uint %tint_first_leading_bit %83
+ OpStore %res %82
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %85
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %firstLeadingBit_6fe804
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %77
+ %90 = OpLabel
+ %91 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %91
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %77
+ %94 = OpLabel
+ %95 = OpFunctionCall %void %firstLeadingBit_6fe804
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %77
+ %97 = OpLabel
+ %98 = OpFunctionCall %void %firstLeadingBit_6fe804
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl
new file mode 100644
index 0000000..1d6c27b
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/6fe804.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_6fe804() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_6fe804();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_6fe804();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_6fe804();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl
new file mode 100644
index 0000000..e482e72
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(vec<2, i32>) -> vec<2, i32>
+fn firstLeadingBit_a622c2() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_a622c2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_a622c2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_a622c2();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl
new file mode 100644
index 0000000..b12c7d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec2 tint_first_leading_bit(ivec2 v) {
+ uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_a622c2() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_a622c2();
+ 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;
+
+ivec2 tint_first_leading_bit(ivec2 v) {
+ uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_a622c2() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_a622c2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec2 tint_first_leading_bit(ivec2 v) {
+ uvec2 x = mix(uvec2(v), uvec2(~(v)), lessThan(v, ivec2(0)));
+ uvec2 b16 = mix(uvec2(0u), uvec2(16u), bvec2((x & uvec2(4294901760u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(0u), uvec2(8u), bvec2((x & uvec2(65280u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(0u), uvec2(4u), bvec2((x & uvec2(240u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(0u), uvec2(2u), bvec2((x & uvec2(12u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(0u), uvec2(1u), bvec2((x & uvec2(2u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_a622c2() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_a622c2();
+}
+
+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/firstLeadingBit/a622c2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.hlsl
new file mode 100644
index 0000000..d1da967
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int2 tint_first_leading_bit(int2 v) {
+ uint2 x = ((v < (0).xx) ? uint2(~(v)) : uint2(v));
+ const uint2 b16 = (bool2((x & (4294901760u).xx)) ? (16u).xx : (0u).xx);
+ x = (x >> b16);
+ const uint2 b8 = (bool2((x & (65280u).xx)) ? (8u).xx : (0u).xx);
+ x = (x >> b8);
+ const uint2 b4 = (bool2((x & (240u).xx)) ? (4u).xx : (0u).xx);
+ x = (x >> b4);
+ const uint2 b2 = (bool2((x & (12u).xx)) ? (2u).xx : (0u).xx);
+ x = (x >> b2);
+ const uint2 b1 = (bool2((x & (2u).xx)) ? (1u).xx : (0u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
+ return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_a622c2() {
+ int2 arg_0 = (0).xx;
+ int2 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_a622c2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_a622c2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_a622c2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl
new file mode 100644
index 0000000..8e55a5c
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int2 tint_first_leading_bit(int2 v) {
+ uint2 x = select(uint2(v), uint2(~(v)), (v < int2(0)));
+ uint2 const b16 = select(uint2(0u), uint2(16u), bool2((x & uint2(4294901760u))));
+ x = (x >> b16);
+ uint2 const b8 = select(uint2(0u), uint2(8u), bool2((x & uint2(65280u))));
+ x = (x >> b8);
+ uint2 const b4 = select(uint2(0u), uint2(4u), bool2((x & uint2(240u))));
+ x = (x >> b4);
+ uint2 const b2 = select(uint2(0u), uint2(2u), bool2((x & uint2(12u))));
+ x = (x >> b2);
+ uint2 const b1 = select(uint2(0u), uint2(1u), bool2((x & uint2(2u))));
+ uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u)));
+ return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_a622c2() {
+ int2 arg_0 = int2(0);
+ int2 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_a622c2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_a622c2();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_a622c2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm
new file mode 100644
index 0000000..ab66d0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.spvasm
@@ -0,0 +1,154 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 108
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_a622c2 "firstLeadingBit_a622c2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2int = OpTypeVector %int 2
+ %9 = OpTypeFunction %v2int %v2int
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %18 = OpConstantNull %v2int
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %27 = OpConstantNull %v2uint
+%uint_4294901760 = OpConstant %uint 4294901760
+ %32 = OpConstantComposite %v2uint %uint_4294901760 %uint_4294901760
+ %uint_16 = OpConstant %uint 16
+ %35 = OpConstantComposite %v2uint %uint_16 %uint_16
+ %uint_65280 = OpConstant %uint 65280
+ %42 = OpConstantComposite %v2uint %uint_65280 %uint_65280
+ %uint_8 = OpConstant %uint 8
+ %45 = OpConstantComposite %v2uint %uint_8 %uint_8
+ %uint_240 = OpConstant %uint 240
+ %52 = OpConstantComposite %v2uint %uint_240 %uint_240
+ %uint_4 = OpConstant %uint 4
+ %55 = OpConstantComposite %v2uint %uint_4 %uint_4
+ %uint_12 = OpConstant %uint 12
+ %62 = OpConstantComposite %v2uint %uint_12 %uint_12
+ %uint_2 = OpConstant %uint 2
+ %65 = OpConstantComposite %v2uint %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %73 = OpConstantComposite %v2uint %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %78 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %85 = OpTypeFunction %void
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %94 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %v2int None %9
+ %v = OpFunctionParameter %v2int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %27
+ %19 = OpSLessThan %v2bool %v %18
+ %23 = OpNot %v2int %v
+ %22 = OpBitcast %v2uint %23
+ %24 = OpBitcast %v2uint %v
+ %15 = OpSelect %v2uint %19 %22 %24
+ OpStore %x %15
+ %30 = OpLoad %v2uint %x
+ %33 = OpBitwiseAnd %v2uint %30 %32
+ %29 = OpINotEqual %v2bool %33 %27
+ %28 = OpSelect %v2uint %29 %35 %27
+ %36 = OpLoad %v2uint %x
+ %37 = OpShiftRightLogical %v2uint %36 %28
+ OpStore %x %37
+ %40 = OpLoad %v2uint %x
+ %43 = OpBitwiseAnd %v2uint %40 %42
+ %39 = OpINotEqual %v2bool %43 %27
+ %38 = OpSelect %v2uint %39 %45 %27
+ %46 = OpLoad %v2uint %x
+ %47 = OpShiftRightLogical %v2uint %46 %38
+ OpStore %x %47
+ %50 = OpLoad %v2uint %x
+ %53 = OpBitwiseAnd %v2uint %50 %52
+ %49 = OpINotEqual %v2bool %53 %27
+ %48 = OpSelect %v2uint %49 %55 %27
+ %56 = OpLoad %v2uint %x
+ %57 = OpShiftRightLogical %v2uint %56 %48
+ OpStore %x %57
+ %60 = OpLoad %v2uint %x
+ %63 = OpBitwiseAnd %v2uint %60 %62
+ %59 = OpINotEqual %v2bool %63 %27
+ %58 = OpSelect %v2uint %59 %65 %27
+ %66 = OpLoad %v2uint %x
+ %67 = OpShiftRightLogical %v2uint %66 %58
+ OpStore %x %67
+ %70 = OpLoad %v2uint %x
+ %71 = OpBitwiseAnd %v2uint %70 %65
+ %69 = OpINotEqual %v2bool %71 %27
+ %68 = OpSelect %v2uint %69 %73 %27
+ %75 = OpLoad %v2uint %x
+ %76 = OpIEqual %v2bool %75 %27
+ %74 = OpSelect %v2uint %76 %78 %27
+ %80 = OpBitwiseOr %v2uint %28 %38
+ %81 = OpBitwiseOr %v2uint %80 %48
+ %82 = OpBitwiseOr %v2uint %81 %58
+ %83 = OpBitwiseOr %v2uint %82 %68
+ %84 = OpBitwiseOr %v2uint %83 %74
+ %79 = OpBitcast %v2int %84
+ OpReturnValue %79
+ OpFunctionEnd
+%firstLeadingBit_a622c2 = OpFunction %void None %85
+ %88 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %18
+ %res = OpVariable %_ptr_Function_v2int Function %18
+ OpStore %arg_0 %18
+ %92 = OpLoad %v2int %arg_0
+ %91 = OpFunctionCall %v2int %tint_first_leading_bit %92
+ OpStore %res %91
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %94
+ %96 = OpLabel
+ %97 = OpFunctionCall %void %firstLeadingBit_a622c2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %85
+ %99 = OpLabel
+ %100 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %100
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %85
+ %103 = OpLabel
+ %104 = OpFunctionCall %void %firstLeadingBit_a622c2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %85
+ %106 = OpLabel
+ %107 = OpFunctionCall %void %firstLeadingBit_a622c2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl
new file mode 100644
index 0000000..73c7797
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/a622c2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_a622c2() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_a622c2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_a622c2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_a622c2();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl
new file mode 100644
index 0000000..be7d46c
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(vec<4, i32>) -> vec<4, i32>
+fn firstLeadingBit_c1f940() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_c1f940();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_c1f940();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_c1f940();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl
new file mode 100644
index 0000000..442f3b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec4 tint_first_leading_bit(ivec4 v) {
+ uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_c1f940() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_c1f940();
+ 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;
+
+ivec4 tint_first_leading_bit(ivec4 v) {
+ uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_c1f940() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_c1f940();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec4 tint_first_leading_bit(ivec4 v) {
+ uvec4 x = mix(uvec4(v), uvec4(~(v)), lessThan(v, ivec4(0)));
+ uvec4 b16 = mix(uvec4(0u), uvec4(16u), bvec4((x & uvec4(4294901760u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(0u), uvec4(8u), bvec4((x & uvec4(65280u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(0u), uvec4(4u), bvec4((x & uvec4(240u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(0u), uvec4(2u), bvec4((x & uvec4(12u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(0u), uvec4(1u), bvec4((x & uvec4(2u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_c1f940() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_c1f940();
+}
+
+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/firstLeadingBit/c1f940.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.hlsl
new file mode 100644
index 0000000..2103853
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int4 tint_first_leading_bit(int4 v) {
+ uint4 x = ((v < (0).xxxx) ? uint4(~(v)) : uint4(v));
+ const uint4 b16 = (bool4((x & (4294901760u).xxxx)) ? (16u).xxxx : (0u).xxxx);
+ x = (x >> b16);
+ const uint4 b8 = (bool4((x & (65280u).xxxx)) ? (8u).xxxx : (0u).xxxx);
+ x = (x >> b8);
+ const uint4 b4 = (bool4((x & (240u).xxxx)) ? (4u).xxxx : (0u).xxxx);
+ x = (x >> b4);
+ const uint4 b2 = (bool4((x & (12u).xxxx)) ? (2u).xxxx : (0u).xxxx);
+ x = (x >> b2);
+ const uint4 b1 = (bool4((x & (2u).xxxx)) ? (1u).xxxx : (0u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
+ return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_c1f940() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_c1f940();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_c1f940();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_c1f940();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl
new file mode 100644
index 0000000..950e9b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int4 tint_first_leading_bit(int4 v) {
+ uint4 x = select(uint4(v), uint4(~(v)), (v < int4(0)));
+ uint4 const b16 = select(uint4(0u), uint4(16u), bool4((x & uint4(4294901760u))));
+ x = (x >> b16);
+ uint4 const b8 = select(uint4(0u), uint4(8u), bool4((x & uint4(65280u))));
+ x = (x >> b8);
+ uint4 const b4 = select(uint4(0u), uint4(4u), bool4((x & uint4(240u))));
+ x = (x >> b4);
+ uint4 const b2 = select(uint4(0u), uint4(2u), bool4((x & uint4(12u))));
+ x = (x >> b2);
+ uint4 const b1 = select(uint4(0u), uint4(1u), bool4((x & uint4(2u))));
+ uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u)));
+ return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_c1f940() {
+ int4 arg_0 = int4(0);
+ int4 res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_c1f940();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_c1f940();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_c1f940();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm
new file mode 100644
index 0000000..7c6ee54
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.spvasm
@@ -0,0 +1,154 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 108
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_c1f940 "firstLeadingBit_c1f940"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4int = OpTypeVector %int 4
+ %9 = OpTypeFunction %v4int %v4int
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %18 = OpConstantNull %v4int
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %27 = OpConstantNull %v4uint
+%uint_4294901760 = OpConstant %uint 4294901760
+ %32 = OpConstantComposite %v4uint %uint_4294901760 %uint_4294901760 %uint_4294901760 %uint_4294901760
+ %uint_16 = OpConstant %uint 16
+ %35 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+ %uint_65280 = OpConstant %uint 65280
+ %42 = OpConstantComposite %v4uint %uint_65280 %uint_65280 %uint_65280 %uint_65280
+ %uint_8 = OpConstant %uint 8
+ %45 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+ %uint_240 = OpConstant %uint 240
+ %52 = OpConstantComposite %v4uint %uint_240 %uint_240 %uint_240 %uint_240
+ %uint_4 = OpConstant %uint 4
+ %55 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+ %uint_12 = OpConstant %uint 12
+ %62 = OpConstantComposite %v4uint %uint_12 %uint_12 %uint_12 %uint_12
+ %uint_2 = OpConstant %uint 2
+ %65 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %73 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %78 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %85 = OpTypeFunction %void
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %94 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %v4int None %9
+ %v = OpFunctionParameter %v4int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %27
+ %19 = OpSLessThan %v4bool %v %18
+ %23 = OpNot %v4int %v
+ %22 = OpBitcast %v4uint %23
+ %24 = OpBitcast %v4uint %v
+ %15 = OpSelect %v4uint %19 %22 %24
+ OpStore %x %15
+ %30 = OpLoad %v4uint %x
+ %33 = OpBitwiseAnd %v4uint %30 %32
+ %29 = OpINotEqual %v4bool %33 %27
+ %28 = OpSelect %v4uint %29 %35 %27
+ %36 = OpLoad %v4uint %x
+ %37 = OpShiftRightLogical %v4uint %36 %28
+ OpStore %x %37
+ %40 = OpLoad %v4uint %x
+ %43 = OpBitwiseAnd %v4uint %40 %42
+ %39 = OpINotEqual %v4bool %43 %27
+ %38 = OpSelect %v4uint %39 %45 %27
+ %46 = OpLoad %v4uint %x
+ %47 = OpShiftRightLogical %v4uint %46 %38
+ OpStore %x %47
+ %50 = OpLoad %v4uint %x
+ %53 = OpBitwiseAnd %v4uint %50 %52
+ %49 = OpINotEqual %v4bool %53 %27
+ %48 = OpSelect %v4uint %49 %55 %27
+ %56 = OpLoad %v4uint %x
+ %57 = OpShiftRightLogical %v4uint %56 %48
+ OpStore %x %57
+ %60 = OpLoad %v4uint %x
+ %63 = OpBitwiseAnd %v4uint %60 %62
+ %59 = OpINotEqual %v4bool %63 %27
+ %58 = OpSelect %v4uint %59 %65 %27
+ %66 = OpLoad %v4uint %x
+ %67 = OpShiftRightLogical %v4uint %66 %58
+ OpStore %x %67
+ %70 = OpLoad %v4uint %x
+ %71 = OpBitwiseAnd %v4uint %70 %65
+ %69 = OpINotEqual %v4bool %71 %27
+ %68 = OpSelect %v4uint %69 %73 %27
+ %75 = OpLoad %v4uint %x
+ %76 = OpIEqual %v4bool %75 %27
+ %74 = OpSelect %v4uint %76 %78 %27
+ %80 = OpBitwiseOr %v4uint %28 %38
+ %81 = OpBitwiseOr %v4uint %80 %48
+ %82 = OpBitwiseOr %v4uint %81 %58
+ %83 = OpBitwiseOr %v4uint %82 %68
+ %84 = OpBitwiseOr %v4uint %83 %74
+ %79 = OpBitcast %v4int %84
+ OpReturnValue %79
+ OpFunctionEnd
+%firstLeadingBit_c1f940 = OpFunction %void None %85
+ %88 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %18
+ %res = OpVariable %_ptr_Function_v4int Function %18
+ OpStore %arg_0 %18
+ %92 = OpLoad %v4int %arg_0
+ %91 = OpFunctionCall %v4int %tint_first_leading_bit %92
+ OpStore %res %91
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %94
+ %96 = OpLabel
+ %97 = OpFunctionCall %void %firstLeadingBit_c1f940
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %85
+ %99 = OpLabel
+ %100 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %100
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %85
+ %103 = OpLabel
+ %104 = OpFunctionCall %void %firstLeadingBit_c1f940
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %85
+ %106 = OpLabel
+ %107 = OpFunctionCall %void %firstLeadingBit_c1f940
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl
new file mode 100644
index 0000000..dd852d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/c1f940.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_c1f940() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_c1f940();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_c1f940();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_c1f940();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl
new file mode 100644
index 0000000..4ccf983
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstLeadingBit(u32) -> u32
+fn firstLeadingBit_f0779d() {
+ var arg_0 = 1u;
+ var res: u32 = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_f0779d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_f0779d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_f0779d();
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl
new file mode 100644
index 0000000..fe38e68
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uint tint_first_leading_bit(uint v) {
+ uint x = v;
+ uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_f0779d() {
+ uint arg_0 = 1u;
+ uint res = tint_first_leading_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstLeadingBit_f0779d();
+ 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;
+
+uint tint_first_leading_bit(uint v) {
+ uint x = v;
+ uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_f0779d() {
+ uint arg_0 = 1u;
+ uint res = tint_first_leading_bit(arg_0);
+}
+
+void fragment_main() {
+ firstLeadingBit_f0779d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_first_leading_bit(uint v) {
+ uint x = v;
+ uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_f0779d() {
+ uint arg_0 = 1u;
+ uint res = tint_first_leading_bit(arg_0);
+}
+
+void compute_main() {
+ firstLeadingBit_f0779d();
+}
+
+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/firstLeadingBit/f0779d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.hlsl
new file mode 100644
index 0000000..26c2ab9
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint tint_first_leading_bit(uint v) {
+ uint x = v;
+ const uint b16 = (bool((x & 4294901760u)) ? 16u : 0u);
+ x = (x >> b16);
+ const uint b8 = (bool((x & 65280u)) ? 8u : 0u);
+ x = (x >> b8);
+ const uint b4 = (bool((x & 240u)) ? 4u : 0u);
+ x = (x >> b4);
+ const uint b2 = (bool((x & 12u)) ? 2u : 0u);
+ x = (x >> b2);
+ const uint b1 = (bool((x & 2u)) ? 1u : 0u);
+ const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_f0779d() {
+ uint arg_0 = 1u;
+ uint res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_f0779d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstLeadingBit_f0779d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstLeadingBit_f0779d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl
new file mode 100644
index 0000000..daac75a
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint tint_first_leading_bit(uint v) {
+ uint x = v;
+ uint const b16 = select(0u, 16u, bool((x & 4294901760u)));
+ x = (x >> b16);
+ uint const b8 = select(0u, 8u, bool((x & 65280u)));
+ x = (x >> b8);
+ uint const b4 = select(0u, 4u, bool((x & 240u)));
+ x = (x >> b4);
+ uint const b2 = select(0u, 2u, bool((x & 12u)));
+ x = (x >> b2);
+ uint const b1 = select(0u, 1u, bool((x & 2u)));
+ uint const is_zero = select(0u, 4294967295u, (x == 0u));
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstLeadingBit_f0779d() {
+ uint arg_0 = 1u;
+ uint res = tint_first_leading_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstLeadingBit_f0779d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstLeadingBit_f0779d();
+ return;
+}
+
+kernel void compute_main() {
+ firstLeadingBit_f0779d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm
new file mode 100644
index 0000000..9236998
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.spvasm
@@ -0,0 +1,132 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 87
+; 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 %tint_first_leading_bit "tint_first_leading_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstLeadingBit_f0779d "firstLeadingBit_f0779d"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %uint %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %16 = OpConstantNull %uint
+ %bool = OpTypeBool
+%uint_4294901760 = OpConstant %uint 4294901760
+ %uint_16 = OpConstant %uint 16
+ %uint_65280 = OpConstant %uint 65280
+ %uint_8 = OpConstant %uint 8
+ %uint_240 = OpConstant %uint 240
+ %uint_4 = OpConstant %uint 4
+ %uint_12 = OpConstant %uint 12
+ %uint_2 = OpConstant %uint 2
+ %uint_1 = OpConstant %uint 1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %void = OpTypeVoid
+ %65 = OpTypeFunction %void
+ %73 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_leading_bit = OpFunction %uint None %9
+ %v = OpFunctionParameter %uint
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %16
+ OpStore %x %v
+ %20 = OpLoad %uint %x
+ %22 = OpBitwiseAnd %uint %20 %uint_4294901760
+ %18 = OpINotEqual %bool %22 %16
+ %17 = OpSelect %uint %18 %uint_16 %16
+ %24 = OpLoad %uint %x
+ %25 = OpShiftRightLogical %uint %24 %17
+ OpStore %x %25
+ %28 = OpLoad %uint %x
+ %30 = OpBitwiseAnd %uint %28 %uint_65280
+ %27 = OpINotEqual %bool %30 %16
+ %26 = OpSelect %uint %27 %uint_8 %16
+ %32 = OpLoad %uint %x
+ %33 = OpShiftRightLogical %uint %32 %26
+ OpStore %x %33
+ %36 = OpLoad %uint %x
+ %38 = OpBitwiseAnd %uint %36 %uint_240
+ %35 = OpINotEqual %bool %38 %16
+ %34 = OpSelect %uint %35 %uint_4 %16
+ %40 = OpLoad %uint %x
+ %41 = OpShiftRightLogical %uint %40 %34
+ OpStore %x %41
+ %44 = OpLoad %uint %x
+ %46 = OpBitwiseAnd %uint %44 %uint_12
+ %43 = OpINotEqual %bool %46 %16
+ %42 = OpSelect %uint %43 %uint_2 %16
+ %48 = OpLoad %uint %x
+ %49 = OpShiftRightLogical %uint %48 %42
+ OpStore %x %49
+ %52 = OpLoad %uint %x
+ %53 = OpBitwiseAnd %uint %52 %uint_2
+ %51 = OpINotEqual %bool %53 %16
+ %50 = OpSelect %uint %51 %uint_1 %16
+ %56 = OpLoad %uint %x
+ %57 = OpIEqual %bool %56 %16
+ %55 = OpSelect %uint %57 %uint_4294967295 %16
+ %60 = OpBitwiseOr %uint %17 %26
+ %61 = OpBitwiseOr %uint %60 %34
+ %62 = OpBitwiseOr %uint %61 %42
+ %63 = OpBitwiseOr %uint %62 %50
+ %64 = OpBitwiseOr %uint %63 %55
+ OpReturnValue %64
+ OpFunctionEnd
+%firstLeadingBit_f0779d = OpFunction %void None %65
+ %68 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %16
+ %res = OpVariable %_ptr_Function_uint Function %16
+ OpStore %arg_0 %uint_1
+ %71 = OpLoad %uint %arg_0
+ %70 = OpFunctionCall %uint %tint_first_leading_bit %71
+ OpStore %res %70
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %73
+ %75 = OpLabel
+ %76 = OpFunctionCall %void %firstLeadingBit_f0779d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %65
+ %78 = OpLabel
+ %79 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %79
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %65
+ %82 = OpLabel
+ %83 = OpFunctionCall %void %firstLeadingBit_f0779d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %65
+ %85 = OpLabel
+ %86 = OpFunctionCall %void %firstLeadingBit_f0779d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl
new file mode 100644
index 0000000..072135a
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstLeadingBit/f0779d.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstLeadingBit_f0779d() {
+ var arg_0 = 1u;
+ var res : u32 = firstLeadingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstLeadingBit_f0779d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstLeadingBit_f0779d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstLeadingBit_f0779d();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl
new file mode 100644
index 0000000..a3cdb6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(vec<4, u32>) -> vec<4, u32>
+fn firstTrailingBit_110f2c() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_110f2c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_110f2c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_110f2c();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl
new file mode 100644
index 0000000..dc7ca07
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec4 tint_first_trailing_bit(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_110f2c() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_110f2c();
+ 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;
+
+uvec4 tint_first_trailing_bit(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_110f2c() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_110f2c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec4 tint_first_trailing_bit(uvec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return uvec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_110f2c() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_110f2c();
+}
+
+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/firstTrailingBit/110f2c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.hlsl
new file mode 100644
index 0000000..ed6e500
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint4 tint_first_trailing_bit(uint4 v) {
+ uint4 x = uint4(v);
+ const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx);
+ x = (x >> b16);
+ const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx);
+ x = (x >> b8);
+ const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx);
+ x = (x >> b4);
+ const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx);
+ x = (x >> b2);
+ const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
+ return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_110f2c() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_110f2c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_110f2c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_110f2c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl
new file mode 100644
index 0000000..e1dfe90
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint4 tint_first_trailing_bit(uint4 v) {
+ uint4 x = uint4(v);
+ uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u))));
+ x = (x >> b16);
+ uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u))));
+ x = (x >> b8);
+ uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u))));
+ x = (x >> b4);
+ uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u))));
+ x = (x >> b2);
+ uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u))));
+ uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u)));
+ return uint4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_110f2c() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_110f2c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_110f2c();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_110f2c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm
new file mode 100644
index 0000000..e4d1cbb
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.spvasm
@@ -0,0 +1,144 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 100
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_110f2c "firstTrailingBit_110f2c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4uint = OpTypeVector %uint 4
+ %9 = OpTypeFunction %v4uint %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %18 = OpConstantNull %v4uint
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %uint_65535 = OpConstant %uint 65535
+ %25 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %28 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %35 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %45 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %48 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %55 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %58 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %71 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %78 = OpTypeFunction %void
+ %86 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %v4uint None %9
+ %v = OpFunctionParameter %v4uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %18
+ OpStore %x %v
+ %23 = OpLoad %v4uint %x
+ %26 = OpBitwiseAnd %v4uint %23 %25
+ %20 = OpINotEqual %v4bool %26 %18
+ %19 = OpSelect %v4uint %20 %18 %28
+ %29 = OpLoad %v4uint %x
+ %30 = OpShiftRightLogical %v4uint %29 %19
+ OpStore %x %30
+ %33 = OpLoad %v4uint %x
+ %36 = OpBitwiseAnd %v4uint %33 %35
+ %32 = OpINotEqual %v4bool %36 %18
+ %31 = OpSelect %v4uint %32 %18 %38
+ %39 = OpLoad %v4uint %x
+ %40 = OpShiftRightLogical %v4uint %39 %31
+ OpStore %x %40
+ %43 = OpLoad %v4uint %x
+ %46 = OpBitwiseAnd %v4uint %43 %45
+ %42 = OpINotEqual %v4bool %46 %18
+ %41 = OpSelect %v4uint %42 %18 %48
+ %49 = OpLoad %v4uint %x
+ %50 = OpShiftRightLogical %v4uint %49 %41
+ OpStore %x %50
+ %53 = OpLoad %v4uint %x
+ %56 = OpBitwiseAnd %v4uint %53 %55
+ %52 = OpINotEqual %v4bool %56 %18
+ %51 = OpSelect %v4uint %52 %18 %58
+ %59 = OpLoad %v4uint %x
+ %60 = OpShiftRightLogical %v4uint %59 %51
+ OpStore %x %60
+ %63 = OpLoad %v4uint %x
+ %66 = OpBitwiseAnd %v4uint %63 %65
+ %62 = OpINotEqual %v4bool %66 %18
+ %61 = OpSelect %v4uint %62 %18 %65
+ %68 = OpLoad %v4uint %x
+ %69 = OpIEqual %v4bool %68 %18
+ %67 = OpSelect %v4uint %69 %71 %18
+ %73 = OpBitwiseOr %v4uint %19 %31
+ %74 = OpBitwiseOr %v4uint %73 %41
+ %75 = OpBitwiseOr %v4uint %74 %51
+ %76 = OpBitwiseOr %v4uint %75 %61
+ %77 = OpBitwiseOr %v4uint %76 %67
+ OpReturnValue %77
+ OpFunctionEnd
+%firstTrailingBit_110f2c = OpFunction %void None %78
+ %81 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %18
+ %res = OpVariable %_ptr_Function_v4uint Function %18
+ OpStore %arg_0 %18
+ %84 = OpLoad %v4uint %arg_0
+ %83 = OpFunctionCall %v4uint %tint_first_trailing_bit %84
+ OpStore %res %83
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %86
+ %88 = OpLabel
+ %89 = OpFunctionCall %void %firstTrailingBit_110f2c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %78
+ %91 = OpLabel
+ %92 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %92
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %78
+ %95 = OpLabel
+ %96 = OpFunctionCall %void %firstTrailingBit_110f2c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %78
+ %98 = OpLabel
+ %99 = OpFunctionCall %void %firstTrailingBit_110f2c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl
new file mode 100644
index 0000000..6edd9d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/110f2c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_110f2c() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_110f2c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_110f2c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_110f2c();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl
new file mode 100644
index 0000000..ed95803
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(i32) -> i32
+fn firstTrailingBit_3a2acc() {
+ var arg_0 = 1;
+ var res: i32 = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_3a2acc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_3a2acc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_3a2acc();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl
new file mode 100644
index 0000000..7bc6250
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+int tint_first_trailing_bit(int v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_3a2acc() {
+ int arg_0 = 1;
+ int res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_3a2acc();
+ 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;
+
+int tint_first_trailing_bit(int v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_3a2acc() {
+ int arg_0 = 1;
+ int res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_3a2acc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_first_trailing_bit(int v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_3a2acc() {
+ int arg_0 = 1;
+ int res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_3a2acc();
+}
+
+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/firstTrailingBit/3a2acc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.hlsl
new file mode 100644
index 0000000..18cddbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int tint_first_trailing_bit(int v) {
+ uint x = uint(v);
+ const uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ const uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ const uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ const uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ const uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_3a2acc() {
+ int arg_0 = 1;
+ int res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_3a2acc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_3a2acc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_3a2acc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl
new file mode 100644
index 0000000..580ba30
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int tint_first_trailing_bit(int v) {
+ uint x = uint(v);
+ uint const b16 = select(16u, 0u, bool((x & 65535u)));
+ x = (x >> b16);
+ uint const b8 = select(8u, 0u, bool((x & 255u)));
+ x = (x >> b8);
+ uint const b4 = select(4u, 0u, bool((x & 15u)));
+ x = (x >> b4);
+ uint const b2 = select(2u, 0u, bool((x & 3u)));
+ x = (x >> b2);
+ uint const b1 = select(1u, 0u, bool((x & 1u)));
+ uint const is_zero = select(0u, 4294967295u, (x == 0u));
+ return int((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_3a2acc() {
+ int arg_0 = 1;
+ int res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_3a2acc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_3a2acc();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_3a2acc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm
new file mode 100644
index 0000000..ba548bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.spvasm
@@ -0,0 +1,138 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 92
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_3a2acc "firstTrailingBit_3a2acc"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %int %int
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %18 = OpConstantNull %uint
+ %bool = OpTypeBool
+ %uint_65535 = OpConstant %uint 65535
+ %uint_16 = OpConstant %uint 16
+ %uint_255 = OpConstant %uint 255
+ %uint_8 = OpConstant %uint 8
+ %uint_15 = OpConstant %uint 15
+ %uint_4 = OpConstant %uint 4
+ %uint_3 = OpConstant %uint 3
+ %uint_2 = OpConstant %uint 2
+ %uint_1 = OpConstant %uint 1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %void = OpTypeVoid
+ %67 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %74 = OpConstantNull %int
+ %78 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %int None %9
+ %v = OpFunctionParameter %int
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %18
+ %14 = OpBitcast %uint %v
+ OpStore %x %14
+ %22 = OpLoad %uint %x
+ %24 = OpBitwiseAnd %uint %22 %uint_65535
+ %20 = OpINotEqual %bool %24 %18
+ %19 = OpSelect %uint %20 %18 %uint_16
+ %26 = OpLoad %uint %x
+ %27 = OpShiftRightLogical %uint %26 %19
+ OpStore %x %27
+ %30 = OpLoad %uint %x
+ %32 = OpBitwiseAnd %uint %30 %uint_255
+ %29 = OpINotEqual %bool %32 %18
+ %28 = OpSelect %uint %29 %18 %uint_8
+ %34 = OpLoad %uint %x
+ %35 = OpShiftRightLogical %uint %34 %28
+ OpStore %x %35
+ %38 = OpLoad %uint %x
+ %40 = OpBitwiseAnd %uint %38 %uint_15
+ %37 = OpINotEqual %bool %40 %18
+ %36 = OpSelect %uint %37 %18 %uint_4
+ %42 = OpLoad %uint %x
+ %43 = OpShiftRightLogical %uint %42 %36
+ OpStore %x %43
+ %46 = OpLoad %uint %x
+ %48 = OpBitwiseAnd %uint %46 %uint_3
+ %45 = OpINotEqual %bool %48 %18
+ %44 = OpSelect %uint %45 %18 %uint_2
+ %50 = OpLoad %uint %x
+ %51 = OpShiftRightLogical %uint %50 %44
+ OpStore %x %51
+ %54 = OpLoad %uint %x
+ %56 = OpBitwiseAnd %uint %54 %uint_1
+ %53 = OpINotEqual %bool %56 %18
+ %52 = OpSelect %uint %53 %18 %uint_1
+ %58 = OpLoad %uint %x
+ %59 = OpIEqual %bool %58 %18
+ %57 = OpSelect %uint %59 %uint_4294967295 %18
+ %62 = OpBitwiseOr %uint %19 %28
+ %63 = OpBitwiseOr %uint %62 %36
+ %64 = OpBitwiseOr %uint %63 %44
+ %65 = OpBitwiseOr %uint %64 %52
+ %66 = OpBitwiseOr %uint %65 %57
+ %61 = OpBitcast %int %66
+ OpReturnValue %61
+ OpFunctionEnd
+%firstTrailingBit_3a2acc = OpFunction %void None %67
+ %70 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %74
+ %res = OpVariable %_ptr_Function_int Function %74
+ OpStore %arg_0 %int_1
+ %76 = OpLoad %int %arg_0
+ %75 = OpFunctionCall %int %tint_first_trailing_bit %76
+ OpStore %res %75
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %78
+ %80 = OpLabel
+ %81 = OpFunctionCall %void %firstTrailingBit_3a2acc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %67
+ %83 = OpLabel
+ %84 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %84
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %67
+ %87 = OpLabel
+ %88 = OpFunctionCall %void %firstTrailingBit_3a2acc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %67
+ %90 = OpLabel
+ %91 = OpFunctionCall %void %firstTrailingBit_3a2acc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl
new file mode 100644
index 0000000..414f2ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/3a2acc.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_3a2acc() {
+ var arg_0 = 1;
+ var res : i32 = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_3a2acc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_3a2acc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_3a2acc();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl
new file mode 100644
index 0000000..a76c9b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(vec<2, u32>) -> vec<2, u32>
+fn firstTrailingBit_45eb10() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_45eb10();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_45eb10();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_45eb10();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl
new file mode 100644
index 0000000..e31b527
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec2 tint_first_trailing_bit(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_45eb10() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_45eb10();
+ 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;
+
+uvec2 tint_first_trailing_bit(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_45eb10() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_45eb10();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec2 tint_first_trailing_bit(uvec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return uvec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_45eb10() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_45eb10();
+}
+
+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/firstTrailingBit/45eb10.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.hlsl
new file mode 100644
index 0000000..e8fe8a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint2 tint_first_trailing_bit(uint2 v) {
+ uint2 x = uint2(v);
+ const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx);
+ x = (x >> b16);
+ const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx);
+ x = (x >> b8);
+ const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx);
+ x = (x >> b4);
+ const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx);
+ x = (x >> b2);
+ const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
+ return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_45eb10() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_45eb10();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_45eb10();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_45eb10();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl
new file mode 100644
index 0000000..89138e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint2 tint_first_trailing_bit(uint2 v) {
+ uint2 x = uint2(v);
+ uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u))));
+ x = (x >> b16);
+ uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u))));
+ x = (x >> b8);
+ uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u))));
+ x = (x >> b4);
+ uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u))));
+ x = (x >> b2);
+ uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u))));
+ uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u)));
+ return uint2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_45eb10() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_45eb10();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_45eb10();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_45eb10();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm
new file mode 100644
index 0000000..0e6e087
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.spvasm
@@ -0,0 +1,144 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 100
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_45eb10 "firstTrailingBit_45eb10"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2uint = OpTypeVector %uint 2
+ %9 = OpTypeFunction %v2uint %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %18 = OpConstantNull %v2uint
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %uint_65535 = OpConstant %uint 65535
+ %25 = OpConstantComposite %v2uint %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %28 = OpConstantComposite %v2uint %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %35 = OpConstantComposite %v2uint %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v2uint %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %45 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %48 = OpConstantComposite %v2uint %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %55 = OpConstantComposite %v2uint %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %58 = OpConstantComposite %v2uint %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v2uint %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %71 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %78 = OpTypeFunction %void
+ %86 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %v2uint None %9
+ %v = OpFunctionParameter %v2uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %18
+ OpStore %x %v
+ %23 = OpLoad %v2uint %x
+ %26 = OpBitwiseAnd %v2uint %23 %25
+ %20 = OpINotEqual %v2bool %26 %18
+ %19 = OpSelect %v2uint %20 %18 %28
+ %29 = OpLoad %v2uint %x
+ %30 = OpShiftRightLogical %v2uint %29 %19
+ OpStore %x %30
+ %33 = OpLoad %v2uint %x
+ %36 = OpBitwiseAnd %v2uint %33 %35
+ %32 = OpINotEqual %v2bool %36 %18
+ %31 = OpSelect %v2uint %32 %18 %38
+ %39 = OpLoad %v2uint %x
+ %40 = OpShiftRightLogical %v2uint %39 %31
+ OpStore %x %40
+ %43 = OpLoad %v2uint %x
+ %46 = OpBitwiseAnd %v2uint %43 %45
+ %42 = OpINotEqual %v2bool %46 %18
+ %41 = OpSelect %v2uint %42 %18 %48
+ %49 = OpLoad %v2uint %x
+ %50 = OpShiftRightLogical %v2uint %49 %41
+ OpStore %x %50
+ %53 = OpLoad %v2uint %x
+ %56 = OpBitwiseAnd %v2uint %53 %55
+ %52 = OpINotEqual %v2bool %56 %18
+ %51 = OpSelect %v2uint %52 %18 %58
+ %59 = OpLoad %v2uint %x
+ %60 = OpShiftRightLogical %v2uint %59 %51
+ OpStore %x %60
+ %63 = OpLoad %v2uint %x
+ %66 = OpBitwiseAnd %v2uint %63 %65
+ %62 = OpINotEqual %v2bool %66 %18
+ %61 = OpSelect %v2uint %62 %18 %65
+ %68 = OpLoad %v2uint %x
+ %69 = OpIEqual %v2bool %68 %18
+ %67 = OpSelect %v2uint %69 %71 %18
+ %73 = OpBitwiseOr %v2uint %19 %31
+ %74 = OpBitwiseOr %v2uint %73 %41
+ %75 = OpBitwiseOr %v2uint %74 %51
+ %76 = OpBitwiseOr %v2uint %75 %61
+ %77 = OpBitwiseOr %v2uint %76 %67
+ OpReturnValue %77
+ OpFunctionEnd
+%firstTrailingBit_45eb10 = OpFunction %void None %78
+ %81 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %18
+ %res = OpVariable %_ptr_Function_v2uint Function %18
+ OpStore %arg_0 %18
+ %84 = OpLoad %v2uint %arg_0
+ %83 = OpFunctionCall %v2uint %tint_first_trailing_bit %84
+ OpStore %res %83
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %86
+ %88 = OpLabel
+ %89 = OpFunctionCall %void %firstTrailingBit_45eb10
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %78
+ %91 = OpLabel
+ %92 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %92
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %78
+ %95 = OpLabel
+ %96 = OpFunctionCall %void %firstTrailingBit_45eb10
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %78
+ %98 = OpLabel
+ %99 = OpFunctionCall %void %firstTrailingBit_45eb10
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl
new file mode 100644
index 0000000..f462942
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/45eb10.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_45eb10() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_45eb10();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_45eb10();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_45eb10();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl
new file mode 100644
index 0000000..1bb0de9
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(u32) -> u32
+fn firstTrailingBit_47d475() {
+ var arg_0 = 1u;
+ var res: u32 = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_47d475();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_47d475();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_47d475();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl
new file mode 100644
index 0000000..69af555
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uint tint_first_trailing_bit(uint v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_47d475() {
+ uint arg_0 = 1u;
+ uint res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_47d475();
+ 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;
+
+uint tint_first_trailing_bit(uint v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_47d475() {
+ uint arg_0 = 1u;
+ uint res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_47d475();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_first_trailing_bit(uint v) {
+ uint x = uint(v);
+ uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_47d475() {
+ uint arg_0 = 1u;
+ uint res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_47d475();
+}
+
+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/firstTrailingBit/47d475.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.hlsl
new file mode 100644
index 0000000..ba3f283
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint tint_first_trailing_bit(uint v) {
+ uint x = uint(v);
+ const uint b16 = (bool((x & 65535u)) ? 0u : 16u);
+ x = (x >> b16);
+ const uint b8 = (bool((x & 255u)) ? 0u : 8u);
+ x = (x >> b8);
+ const uint b4 = (bool((x & 15u)) ? 0u : 4u);
+ x = (x >> b4);
+ const uint b2 = (bool((x & 3u)) ? 0u : 2u);
+ x = (x >> b2);
+ const uint b1 = (bool((x & 1u)) ? 0u : 1u);
+ const uint is_zero = ((x == 0u) ? 4294967295u : 0u);
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_47d475() {
+ uint arg_0 = 1u;
+ uint res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_47d475();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_47d475();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_47d475();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl
new file mode 100644
index 0000000..9053e17
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint tint_first_trailing_bit(uint v) {
+ uint x = uint(v);
+ uint const b16 = select(16u, 0u, bool((x & 65535u)));
+ x = (x >> b16);
+ uint const b8 = select(8u, 0u, bool((x & 255u)));
+ x = (x >> b8);
+ uint const b4 = select(4u, 0u, bool((x & 15u)));
+ x = (x >> b4);
+ uint const b2 = select(2u, 0u, bool((x & 3u)));
+ x = (x >> b2);
+ uint const b1 = select(1u, 0u, bool((x & 1u)));
+ uint const is_zero = select(0u, 4294967295u, (x == 0u));
+ return uint((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_47d475() {
+ uint arg_0 = 1u;
+ uint res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_47d475();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_47d475();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_47d475();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm
new file mode 100644
index 0000000..fba4aa4
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.spvasm
@@ -0,0 +1,132 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 88
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_47d475 "firstTrailingBit_47d475"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %uint %uint
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %bool = OpTypeBool
+ %uint_65535 = OpConstant %uint 65535
+ %uint_16 = OpConstant %uint 16
+ %uint_255 = OpConstant %uint 255
+ %uint_8 = OpConstant %uint 8
+ %uint_15 = OpConstant %uint 15
+ %uint_4 = OpConstant %uint 4
+ %uint_3 = OpConstant %uint 3
+ %uint_2 = OpConstant %uint 2
+ %uint_1 = OpConstant %uint 1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %void = OpTypeVoid
+ %66 = OpTypeFunction %void
+ %74 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %uint None %9
+ %v = OpFunctionParameter %uint
+ %13 = OpLabel
+ %x = OpVariable %_ptr_Function_uint Function %17
+ OpStore %x %v
+ %21 = OpLoad %uint %x
+ %23 = OpBitwiseAnd %uint %21 %uint_65535
+ %19 = OpINotEqual %bool %23 %17
+ %18 = OpSelect %uint %19 %17 %uint_16
+ %25 = OpLoad %uint %x
+ %26 = OpShiftRightLogical %uint %25 %18
+ OpStore %x %26
+ %29 = OpLoad %uint %x
+ %31 = OpBitwiseAnd %uint %29 %uint_255
+ %28 = OpINotEqual %bool %31 %17
+ %27 = OpSelect %uint %28 %17 %uint_8
+ %33 = OpLoad %uint %x
+ %34 = OpShiftRightLogical %uint %33 %27
+ OpStore %x %34
+ %37 = OpLoad %uint %x
+ %39 = OpBitwiseAnd %uint %37 %uint_15
+ %36 = OpINotEqual %bool %39 %17
+ %35 = OpSelect %uint %36 %17 %uint_4
+ %41 = OpLoad %uint %x
+ %42 = OpShiftRightLogical %uint %41 %35
+ OpStore %x %42
+ %45 = OpLoad %uint %x
+ %47 = OpBitwiseAnd %uint %45 %uint_3
+ %44 = OpINotEqual %bool %47 %17
+ %43 = OpSelect %uint %44 %17 %uint_2
+ %49 = OpLoad %uint %x
+ %50 = OpShiftRightLogical %uint %49 %43
+ OpStore %x %50
+ %53 = OpLoad %uint %x
+ %55 = OpBitwiseAnd %uint %53 %uint_1
+ %52 = OpINotEqual %bool %55 %17
+ %51 = OpSelect %uint %52 %17 %uint_1
+ %57 = OpLoad %uint %x
+ %58 = OpIEqual %bool %57 %17
+ %56 = OpSelect %uint %58 %uint_4294967295 %17
+ %61 = OpBitwiseOr %uint %18 %27
+ %62 = OpBitwiseOr %uint %61 %35
+ %63 = OpBitwiseOr %uint %62 %43
+ %64 = OpBitwiseOr %uint %63 %51
+ %65 = OpBitwiseOr %uint %64 %56
+ OpReturnValue %65
+ OpFunctionEnd
+%firstTrailingBit_47d475 = OpFunction %void None %66
+ %69 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ %72 = OpLoad %uint %arg_0
+ %71 = OpFunctionCall %uint %tint_first_trailing_bit %72
+ OpStore %res %71
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %74
+ %76 = OpLabel
+ %77 = OpFunctionCall %void %firstTrailingBit_47d475
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %66
+ %79 = OpLabel
+ %80 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %80
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %66
+ %83 = OpLabel
+ %84 = OpFunctionCall %void %firstTrailingBit_47d475
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %66
+ %86 = OpLabel
+ %87 = OpFunctionCall %void %firstTrailingBit_47d475
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl
new file mode 100644
index 0000000..b93d114
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/47d475.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_47d475() {
+ var arg_0 = 1u;
+ var res : u32 = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_47d475();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_47d475();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_47d475();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl
new file mode 100644
index 0000000..41501df
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(vec<2, i32>) -> vec<2, i32>
+fn firstTrailingBit_50c072() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_50c072();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_50c072();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_50c072();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl
new file mode 100644
index 0000000..a56cd38
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec2 tint_first_trailing_bit(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_50c072() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_50c072();
+ 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;
+
+ivec2 tint_first_trailing_bit(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_50c072() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_50c072();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec2 tint_first_trailing_bit(ivec2 v) {
+ uvec2 x = uvec2(v);
+ uvec2 b16 = mix(uvec2(16u), uvec2(0u), bvec2((x & uvec2(65535u))));
+ x = (x >> b16);
+ uvec2 b8 = mix(uvec2(8u), uvec2(0u), bvec2((x & uvec2(255u))));
+ x = (x >> b8);
+ uvec2 b4 = mix(uvec2(4u), uvec2(0u), bvec2((x & uvec2(15u))));
+ x = (x >> b4);
+ uvec2 b2 = mix(uvec2(2u), uvec2(0u), bvec2((x & uvec2(3u))));
+ x = (x >> b2);
+ uvec2 b1 = mix(uvec2(1u), uvec2(0u), bvec2((x & uvec2(1u))));
+ uvec2 is_zero = mix(uvec2(0u), uvec2(4294967295u), equal(x, uvec2(0u)));
+ return ivec2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_50c072() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_50c072();
+}
+
+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/firstTrailingBit/50c072.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.hlsl
new file mode 100644
index 0000000..e0358e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int2 tint_first_trailing_bit(int2 v) {
+ uint2 x = uint2(v);
+ const uint2 b16 = (bool2((x & (65535u).xx)) ? (0u).xx : (16u).xx);
+ x = (x >> b16);
+ const uint2 b8 = (bool2((x & (255u).xx)) ? (0u).xx : (8u).xx);
+ x = (x >> b8);
+ const uint2 b4 = (bool2((x & (15u).xx)) ? (0u).xx : (4u).xx);
+ x = (x >> b4);
+ const uint2 b2 = (bool2((x & (3u).xx)) ? (0u).xx : (2u).xx);
+ x = (x >> b2);
+ const uint2 b1 = (bool2((x & (1u).xx)) ? (0u).xx : (1u).xx);
+ const uint2 is_zero = ((x == (0u).xx) ? (4294967295u).xx : (0u).xx);
+ return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_50c072() {
+ int2 arg_0 = (0).xx;
+ int2 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_50c072();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_50c072();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_50c072();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl
new file mode 100644
index 0000000..ad8bc33
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int2 tint_first_trailing_bit(int2 v) {
+ uint2 x = uint2(v);
+ uint2 const b16 = select(uint2(16u), uint2(0u), bool2((x & uint2(65535u))));
+ x = (x >> b16);
+ uint2 const b8 = select(uint2(8u), uint2(0u), bool2((x & uint2(255u))));
+ x = (x >> b8);
+ uint2 const b4 = select(uint2(4u), uint2(0u), bool2((x & uint2(15u))));
+ x = (x >> b4);
+ uint2 const b2 = select(uint2(2u), uint2(0u), bool2((x & uint2(3u))));
+ x = (x >> b2);
+ uint2 const b1 = select(uint2(1u), uint2(0u), bool2((x & uint2(1u))));
+ uint2 const is_zero = select(uint2(0u), uint2(4294967295u), (x == uint2(0u)));
+ return int2((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_50c072() {
+ int2 arg_0 = int2(0);
+ int2 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_50c072();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_50c072();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_50c072();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm
new file mode 100644
index 0000000..b428e65
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.spvasm
@@ -0,0 +1,150 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 104
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_50c072 "firstTrailingBit_50c072"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2int = OpTypeVector %int 2
+ %9 = OpTypeFunction %v2int %v2int
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %20 = OpConstantNull %v2uint
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %uint_65535 = OpConstant %uint 65535
+ %27 = OpConstantComposite %v2uint %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %30 = OpConstantComposite %v2uint %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %37 = OpConstantComposite %v2uint %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %40 = OpConstantComposite %v2uint %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %47 = OpConstantComposite %v2uint %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %50 = OpConstantComposite %v2uint %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %57 = OpConstantComposite %v2uint %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %60 = OpConstantComposite %v2uint %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %67 = OpConstantComposite %v2uint %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %73 = OpConstantComposite %v2uint %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %80 = OpTypeFunction %void
+ %84 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %90 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %v2int None %9
+ %v = OpFunctionParameter %v2int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v2uint Function %20
+ %15 = OpBitcast %v2uint %v
+ OpStore %x %15
+ %25 = OpLoad %v2uint %x
+ %28 = OpBitwiseAnd %v2uint %25 %27
+ %22 = OpINotEqual %v2bool %28 %20
+ %21 = OpSelect %v2uint %22 %20 %30
+ %31 = OpLoad %v2uint %x
+ %32 = OpShiftRightLogical %v2uint %31 %21
+ OpStore %x %32
+ %35 = OpLoad %v2uint %x
+ %38 = OpBitwiseAnd %v2uint %35 %37
+ %34 = OpINotEqual %v2bool %38 %20
+ %33 = OpSelect %v2uint %34 %20 %40
+ %41 = OpLoad %v2uint %x
+ %42 = OpShiftRightLogical %v2uint %41 %33
+ OpStore %x %42
+ %45 = OpLoad %v2uint %x
+ %48 = OpBitwiseAnd %v2uint %45 %47
+ %44 = OpINotEqual %v2bool %48 %20
+ %43 = OpSelect %v2uint %44 %20 %50
+ %51 = OpLoad %v2uint %x
+ %52 = OpShiftRightLogical %v2uint %51 %43
+ OpStore %x %52
+ %55 = OpLoad %v2uint %x
+ %58 = OpBitwiseAnd %v2uint %55 %57
+ %54 = OpINotEqual %v2bool %58 %20
+ %53 = OpSelect %v2uint %54 %20 %60
+ %61 = OpLoad %v2uint %x
+ %62 = OpShiftRightLogical %v2uint %61 %53
+ OpStore %x %62
+ %65 = OpLoad %v2uint %x
+ %68 = OpBitwiseAnd %v2uint %65 %67
+ %64 = OpINotEqual %v2bool %68 %20
+ %63 = OpSelect %v2uint %64 %20 %67
+ %70 = OpLoad %v2uint %x
+ %71 = OpIEqual %v2bool %70 %20
+ %69 = OpSelect %v2uint %71 %73 %20
+ %75 = OpBitwiseOr %v2uint %21 %33
+ %76 = OpBitwiseOr %v2uint %75 %43
+ %77 = OpBitwiseOr %v2uint %76 %53
+ %78 = OpBitwiseOr %v2uint %77 %63
+ %79 = OpBitwiseOr %v2uint %78 %69
+ %74 = OpBitcast %v2int %79
+ OpReturnValue %74
+ OpFunctionEnd
+%firstTrailingBit_50c072 = OpFunction %void None %80
+ %83 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %84
+ %res = OpVariable %_ptr_Function_v2int Function %84
+ OpStore %arg_0 %84
+ %88 = OpLoad %v2int %arg_0
+ %87 = OpFunctionCall %v2int %tint_first_trailing_bit %88
+ OpStore %res %87
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %90
+ %92 = OpLabel
+ %93 = OpFunctionCall %void %firstTrailingBit_50c072
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %80
+ %95 = OpLabel
+ %96 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %96
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %80
+ %99 = OpLabel
+ %100 = OpFunctionCall %void %firstTrailingBit_50c072
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %80
+ %102 = OpLabel
+ %103 = OpFunctionCall %void %firstTrailingBit_50c072
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl
new file mode 100644
index 0000000..e3f4f6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/50c072.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_50c072() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_50c072();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_50c072();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_50c072();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl
new file mode 100644
index 0000000..b38a416
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(vec<3, i32>) -> vec<3, i32>
+fn firstTrailingBit_7496d6() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_7496d6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_7496d6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_7496d6();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl
new file mode 100644
index 0000000..b80c1b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec3 tint_first_trailing_bit(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_7496d6() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_7496d6();
+ 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;
+
+ivec3 tint_first_trailing_bit(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_7496d6() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_7496d6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec3 tint_first_trailing_bit(ivec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return ivec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_7496d6() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_7496d6();
+}
+
+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/firstTrailingBit/7496d6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.hlsl
new file mode 100644
index 0000000..dcdf8e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int3 tint_first_trailing_bit(int3 v) {
+ uint3 x = uint3(v);
+ const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx);
+ x = (x >> b16);
+ const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx);
+ x = (x >> b8);
+ const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx);
+ x = (x >> b4);
+ const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx);
+ x = (x >> b2);
+ const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
+ return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_7496d6() {
+ int3 arg_0 = (0).xxx;
+ int3 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_7496d6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_7496d6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_7496d6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl
new file mode 100644
index 0000000..babf2c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int3 tint_first_trailing_bit(int3 v) {
+ uint3 x = uint3(v);
+ uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u))));
+ x = (x >> b16);
+ uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u))));
+ x = (x >> b8);
+ uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u))));
+ x = (x >> b4);
+ uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u))));
+ x = (x >> b2);
+ uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u))));
+ uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u)));
+ return int3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_7496d6() {
+ int3 arg_0 = int3(0);
+ int3 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_7496d6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_7496d6();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_7496d6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm
new file mode 100644
index 0000000..843ea93
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.spvasm
@@ -0,0 +1,150 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 104
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_7496d6 "firstTrailingBit_7496d6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %9 = OpTypeFunction %v3int %v3int
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %20 = OpConstantNull %v3uint
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %uint_65535 = OpConstant %uint 65535
+ %27 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %30 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %37 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %40 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %47 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %50 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %57 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %60 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %67 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %73 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %80 = OpTypeFunction %void
+ %84 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %90 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %v3int None %9
+ %v = OpFunctionParameter %v3int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %20
+ %15 = OpBitcast %v3uint %v
+ OpStore %x %15
+ %25 = OpLoad %v3uint %x
+ %28 = OpBitwiseAnd %v3uint %25 %27
+ %22 = OpINotEqual %v3bool %28 %20
+ %21 = OpSelect %v3uint %22 %20 %30
+ %31 = OpLoad %v3uint %x
+ %32 = OpShiftRightLogical %v3uint %31 %21
+ OpStore %x %32
+ %35 = OpLoad %v3uint %x
+ %38 = OpBitwiseAnd %v3uint %35 %37
+ %34 = OpINotEqual %v3bool %38 %20
+ %33 = OpSelect %v3uint %34 %20 %40
+ %41 = OpLoad %v3uint %x
+ %42 = OpShiftRightLogical %v3uint %41 %33
+ OpStore %x %42
+ %45 = OpLoad %v3uint %x
+ %48 = OpBitwiseAnd %v3uint %45 %47
+ %44 = OpINotEqual %v3bool %48 %20
+ %43 = OpSelect %v3uint %44 %20 %50
+ %51 = OpLoad %v3uint %x
+ %52 = OpShiftRightLogical %v3uint %51 %43
+ OpStore %x %52
+ %55 = OpLoad %v3uint %x
+ %58 = OpBitwiseAnd %v3uint %55 %57
+ %54 = OpINotEqual %v3bool %58 %20
+ %53 = OpSelect %v3uint %54 %20 %60
+ %61 = OpLoad %v3uint %x
+ %62 = OpShiftRightLogical %v3uint %61 %53
+ OpStore %x %62
+ %65 = OpLoad %v3uint %x
+ %68 = OpBitwiseAnd %v3uint %65 %67
+ %64 = OpINotEqual %v3bool %68 %20
+ %63 = OpSelect %v3uint %64 %20 %67
+ %70 = OpLoad %v3uint %x
+ %71 = OpIEqual %v3bool %70 %20
+ %69 = OpSelect %v3uint %71 %73 %20
+ %75 = OpBitwiseOr %v3uint %21 %33
+ %76 = OpBitwiseOr %v3uint %75 %43
+ %77 = OpBitwiseOr %v3uint %76 %53
+ %78 = OpBitwiseOr %v3uint %77 %63
+ %79 = OpBitwiseOr %v3uint %78 %69
+ %74 = OpBitcast %v3int %79
+ OpReturnValue %74
+ OpFunctionEnd
+%firstTrailingBit_7496d6 = OpFunction %void None %80
+ %83 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %84
+ %res = OpVariable %_ptr_Function_v3int Function %84
+ OpStore %arg_0 %84
+ %88 = OpLoad %v3int %arg_0
+ %87 = OpFunctionCall %v3int %tint_first_trailing_bit %88
+ OpStore %res %87
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %90
+ %92 = OpLabel
+ %93 = OpFunctionCall %void %firstTrailingBit_7496d6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %80
+ %95 = OpLabel
+ %96 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %96
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %80
+ %99 = OpLabel
+ %100 = OpFunctionCall %void %firstTrailingBit_7496d6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %80
+ %102 = OpLabel
+ %103 = OpFunctionCall %void %firstTrailingBit_7496d6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl
new file mode 100644
index 0000000..bf926d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/7496d6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_7496d6() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_7496d6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_7496d6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_7496d6();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl
new file mode 100644
index 0000000..7d87a43
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(vec<4, i32>) -> vec<4, i32>
+fn firstTrailingBit_86551b() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_86551b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_86551b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_86551b();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl
new file mode 100644
index 0000000..91d2633
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+ivec4 tint_first_trailing_bit(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_86551b() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_86551b();
+ 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;
+
+ivec4 tint_first_trailing_bit(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_86551b() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_86551b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec4 tint_first_trailing_bit(ivec4 v) {
+ uvec4 x = uvec4(v);
+ uvec4 b16 = mix(uvec4(16u), uvec4(0u), bvec4((x & uvec4(65535u))));
+ x = (x >> b16);
+ uvec4 b8 = mix(uvec4(8u), uvec4(0u), bvec4((x & uvec4(255u))));
+ x = (x >> b8);
+ uvec4 b4 = mix(uvec4(4u), uvec4(0u), bvec4((x & uvec4(15u))));
+ x = (x >> b4);
+ uvec4 b2 = mix(uvec4(2u), uvec4(0u), bvec4((x & uvec4(3u))));
+ x = (x >> b2);
+ uvec4 b1 = mix(uvec4(1u), uvec4(0u), bvec4((x & uvec4(1u))));
+ uvec4 is_zero = mix(uvec4(0u), uvec4(4294967295u), equal(x, uvec4(0u)));
+ return ivec4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_86551b() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_86551b();
+}
+
+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/firstTrailingBit/86551b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.hlsl
new file mode 100644
index 0000000..ea2a5fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+int4 tint_first_trailing_bit(int4 v) {
+ uint4 x = uint4(v);
+ const uint4 b16 = (bool4((x & (65535u).xxxx)) ? (0u).xxxx : (16u).xxxx);
+ x = (x >> b16);
+ const uint4 b8 = (bool4((x & (255u).xxxx)) ? (0u).xxxx : (8u).xxxx);
+ x = (x >> b8);
+ const uint4 b4 = (bool4((x & (15u).xxxx)) ? (0u).xxxx : (4u).xxxx);
+ x = (x >> b4);
+ const uint4 b2 = (bool4((x & (3u).xxxx)) ? (0u).xxxx : (2u).xxxx);
+ x = (x >> b2);
+ const uint4 b1 = (bool4((x & (1u).xxxx)) ? (0u).xxxx : (1u).xxxx);
+ const uint4 is_zero = ((x == (0u).xxxx) ? (4294967295u).xxxx : (0u).xxxx);
+ return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_86551b() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_86551b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_86551b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_86551b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl
new file mode 100644
index 0000000..62718e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int4 tint_first_trailing_bit(int4 v) {
+ uint4 x = uint4(v);
+ uint4 const b16 = select(uint4(16u), uint4(0u), bool4((x & uint4(65535u))));
+ x = (x >> b16);
+ uint4 const b8 = select(uint4(8u), uint4(0u), bool4((x & uint4(255u))));
+ x = (x >> b8);
+ uint4 const b4 = select(uint4(4u), uint4(0u), bool4((x & uint4(15u))));
+ x = (x >> b4);
+ uint4 const b2 = select(uint4(2u), uint4(0u), bool4((x & uint4(3u))));
+ x = (x >> b2);
+ uint4 const b1 = select(uint4(1u), uint4(0u), bool4((x & uint4(1u))));
+ uint4 const is_zero = select(uint4(0u), uint4(4294967295u), (x == uint4(0u)));
+ return int4((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_86551b() {
+ int4 arg_0 = int4(0);
+ int4 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_86551b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_86551b();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_86551b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm
new file mode 100644
index 0000000..b6e04f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.spvasm
@@ -0,0 +1,150 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 104
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_86551b "firstTrailingBit_86551b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4int = OpTypeVector %int 4
+ %9 = OpTypeFunction %v4int %v4int
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %20 = OpConstantNull %v4uint
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %uint_65535 = OpConstant %uint 65535
+ %27 = OpConstantComposite %v4uint %uint_65535 %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %30 = OpConstantComposite %v4uint %uint_16 %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %37 = OpConstantComposite %v4uint %uint_255 %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %40 = OpConstantComposite %v4uint %uint_8 %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %47 = OpConstantComposite %v4uint %uint_15 %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %50 = OpConstantComposite %v4uint %uint_4 %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %57 = OpConstantComposite %v4uint %uint_3 %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %60 = OpConstantComposite %v4uint %uint_2 %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %67 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %73 = OpConstantComposite %v4uint %uint_4294967295 %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %80 = OpTypeFunction %void
+ %84 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %90 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %v4int None %9
+ %v = OpFunctionParameter %v4int
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v4uint Function %20
+ %15 = OpBitcast %v4uint %v
+ OpStore %x %15
+ %25 = OpLoad %v4uint %x
+ %28 = OpBitwiseAnd %v4uint %25 %27
+ %22 = OpINotEqual %v4bool %28 %20
+ %21 = OpSelect %v4uint %22 %20 %30
+ %31 = OpLoad %v4uint %x
+ %32 = OpShiftRightLogical %v4uint %31 %21
+ OpStore %x %32
+ %35 = OpLoad %v4uint %x
+ %38 = OpBitwiseAnd %v4uint %35 %37
+ %34 = OpINotEqual %v4bool %38 %20
+ %33 = OpSelect %v4uint %34 %20 %40
+ %41 = OpLoad %v4uint %x
+ %42 = OpShiftRightLogical %v4uint %41 %33
+ OpStore %x %42
+ %45 = OpLoad %v4uint %x
+ %48 = OpBitwiseAnd %v4uint %45 %47
+ %44 = OpINotEqual %v4bool %48 %20
+ %43 = OpSelect %v4uint %44 %20 %50
+ %51 = OpLoad %v4uint %x
+ %52 = OpShiftRightLogical %v4uint %51 %43
+ OpStore %x %52
+ %55 = OpLoad %v4uint %x
+ %58 = OpBitwiseAnd %v4uint %55 %57
+ %54 = OpINotEqual %v4bool %58 %20
+ %53 = OpSelect %v4uint %54 %20 %60
+ %61 = OpLoad %v4uint %x
+ %62 = OpShiftRightLogical %v4uint %61 %53
+ OpStore %x %62
+ %65 = OpLoad %v4uint %x
+ %68 = OpBitwiseAnd %v4uint %65 %67
+ %64 = OpINotEqual %v4bool %68 %20
+ %63 = OpSelect %v4uint %64 %20 %67
+ %70 = OpLoad %v4uint %x
+ %71 = OpIEqual %v4bool %70 %20
+ %69 = OpSelect %v4uint %71 %73 %20
+ %75 = OpBitwiseOr %v4uint %21 %33
+ %76 = OpBitwiseOr %v4uint %75 %43
+ %77 = OpBitwiseOr %v4uint %76 %53
+ %78 = OpBitwiseOr %v4uint %77 %63
+ %79 = OpBitwiseOr %v4uint %78 %69
+ %74 = OpBitcast %v4int %79
+ OpReturnValue %74
+ OpFunctionEnd
+%firstTrailingBit_86551b = OpFunction %void None %80
+ %83 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %84
+ %res = OpVariable %_ptr_Function_v4int Function %84
+ OpStore %arg_0 %84
+ %88 = OpLoad %v4int %arg_0
+ %87 = OpFunctionCall %v4int %tint_first_trailing_bit %88
+ OpStore %res %87
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %90
+ %92 = OpLabel
+ %93 = OpFunctionCall %void %firstTrailingBit_86551b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %80
+ %95 = OpLabel
+ %96 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %96
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %80
+ %99 = OpLabel
+ %100 = OpFunctionCall %void %firstTrailingBit_86551b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %80
+ %102 = OpLabel
+ %103 = OpFunctionCall %void %firstTrailingBit_86551b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl
new file mode 100644
index 0000000..f12d022
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/86551b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_86551b() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_86551b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_86551b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_86551b();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl
new file mode 100644
index 0000000..f32a9b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn firstTrailingBit(vec<3, u32>) -> vec<3, u32>
+fn firstTrailingBit_cb51ce() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_cb51ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_cb51ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_cb51ce();
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl
new file mode 100644
index 0000000..f01c16c
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.glsl
@@ -0,0 +1,97 @@
+#version 310 es
+
+uvec3 tint_first_trailing_bit(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_cb51ce() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_first_trailing_bit(arg_0);
+}
+
+vec4 vertex_main() {
+ firstTrailingBit_cb51ce();
+ 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;
+
+uvec3 tint_first_trailing_bit(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_cb51ce() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_first_trailing_bit(arg_0);
+}
+
+void fragment_main() {
+ firstTrailingBit_cb51ce();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec3 tint_first_trailing_bit(uvec3 v) {
+ uvec3 x = uvec3(v);
+ uvec3 b16 = mix(uvec3(16u), uvec3(0u), bvec3((x & uvec3(65535u))));
+ x = (x >> b16);
+ uvec3 b8 = mix(uvec3(8u), uvec3(0u), bvec3((x & uvec3(255u))));
+ x = (x >> b8);
+ uvec3 b4 = mix(uvec3(4u), uvec3(0u), bvec3((x & uvec3(15u))));
+ x = (x >> b4);
+ uvec3 b2 = mix(uvec3(2u), uvec3(0u), bvec3((x & uvec3(3u))));
+ x = (x >> b2);
+ uvec3 b1 = mix(uvec3(1u), uvec3(0u), bvec3((x & uvec3(1u))));
+ uvec3 is_zero = mix(uvec3(0u), uvec3(4294967295u), equal(x, uvec3(0u)));
+ return uvec3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_cb51ce() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = tint_first_trailing_bit(arg_0);
+}
+
+void compute_main() {
+ firstTrailingBit_cb51ce();
+}
+
+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/firstTrailingBit/cb51ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.hlsl
new file mode 100644
index 0000000..747300c
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.hlsl
@@ -0,0 +1,46 @@
+uint3 tint_first_trailing_bit(uint3 v) {
+ uint3 x = uint3(v);
+ const uint3 b16 = (bool3((x & (65535u).xxx)) ? (0u).xxx : (16u).xxx);
+ x = (x >> b16);
+ const uint3 b8 = (bool3((x & (255u).xxx)) ? (0u).xxx : (8u).xxx);
+ x = (x >> b8);
+ const uint3 b4 = (bool3((x & (15u).xxx)) ? (0u).xxx : (4u).xxx);
+ x = (x >> b4);
+ const uint3 b2 = (bool3((x & (3u).xxx)) ? (0u).xxx : (2u).xxx);
+ x = (x >> b2);
+ const uint3 b1 = (bool3((x & (1u).xxx)) ? (0u).xxx : (1u).xxx);
+ const uint3 is_zero = ((x == (0u).xxx) ? (4294967295u).xxx : (0u).xxx);
+ return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_cb51ce() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_cb51ce();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ firstTrailingBit_cb51ce();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ firstTrailingBit_cb51ce();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl
new file mode 100644
index 0000000..4cd8f3a
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.msl
@@ -0,0 +1,49 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint3 tint_first_trailing_bit(uint3 v) {
+ uint3 x = uint3(v);
+ uint3 const b16 = select(uint3(16u), uint3(0u), bool3((x & uint3(65535u))));
+ x = (x >> b16);
+ uint3 const b8 = select(uint3(8u), uint3(0u), bool3((x & uint3(255u))));
+ x = (x >> b8);
+ uint3 const b4 = select(uint3(4u), uint3(0u), bool3((x & uint3(15u))));
+ x = (x >> b4);
+ uint3 const b2 = select(uint3(2u), uint3(0u), bool3((x & uint3(3u))));
+ x = (x >> b2);
+ uint3 const b1 = select(uint3(1u), uint3(0u), bool3((x & uint3(1u))));
+ uint3 const is_zero = select(uint3(0u), uint3(4294967295u), (x == uint3(0u)));
+ return uint3((((((b16 | b8) | b4) | b2) | b1) | is_zero));
+}
+
+void firstTrailingBit_cb51ce() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = tint_first_trailing_bit(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ firstTrailingBit_cb51ce();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ firstTrailingBit_cb51ce();
+ return;
+}
+
+kernel void compute_main() {
+ firstTrailingBit_cb51ce();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm
new file mode 100644
index 0000000..742b42b
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.spvasm
@@ -0,0 +1,144 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 100
+; 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 %tint_first_trailing_bit "tint_first_trailing_bit"
+ OpName %v "v"
+ OpName %x "x"
+ OpName %firstTrailingBit_cb51ce "firstTrailingBit_cb51ce"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3uint = OpTypeVector %uint 3
+ %9 = OpTypeFunction %v3uint %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %18 = OpConstantNull %v3uint
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %uint_65535 = OpConstant %uint 65535
+ %25 = OpConstantComposite %v3uint %uint_65535 %uint_65535 %uint_65535
+ %uint_16 = OpConstant %uint 16
+ %28 = OpConstantComposite %v3uint %uint_16 %uint_16 %uint_16
+ %uint_255 = OpConstant %uint 255
+ %35 = OpConstantComposite %v3uint %uint_255 %uint_255 %uint_255
+ %uint_8 = OpConstant %uint 8
+ %38 = OpConstantComposite %v3uint %uint_8 %uint_8 %uint_8
+ %uint_15 = OpConstant %uint 15
+ %45 = OpConstantComposite %v3uint %uint_15 %uint_15 %uint_15
+ %uint_4 = OpConstant %uint 4
+ %48 = OpConstantComposite %v3uint %uint_4 %uint_4 %uint_4
+ %uint_3 = OpConstant %uint 3
+ %55 = OpConstantComposite %v3uint %uint_3 %uint_3 %uint_3
+ %uint_2 = OpConstant %uint 2
+ %58 = OpConstantComposite %v3uint %uint_2 %uint_2 %uint_2
+ %uint_1 = OpConstant %uint 1
+ %65 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
+%uint_4294967295 = OpConstant %uint 4294967295
+ %71 = OpConstantComposite %v3uint %uint_4294967295 %uint_4294967295 %uint_4294967295
+ %void = OpTypeVoid
+ %78 = OpTypeFunction %void
+ %86 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_first_trailing_bit = OpFunction %v3uint None %9
+ %v = OpFunctionParameter %v3uint
+ %14 = OpLabel
+ %x = OpVariable %_ptr_Function_v3uint Function %18
+ OpStore %x %v
+ %23 = OpLoad %v3uint %x
+ %26 = OpBitwiseAnd %v3uint %23 %25
+ %20 = OpINotEqual %v3bool %26 %18
+ %19 = OpSelect %v3uint %20 %18 %28
+ %29 = OpLoad %v3uint %x
+ %30 = OpShiftRightLogical %v3uint %29 %19
+ OpStore %x %30
+ %33 = OpLoad %v3uint %x
+ %36 = OpBitwiseAnd %v3uint %33 %35
+ %32 = OpINotEqual %v3bool %36 %18
+ %31 = OpSelect %v3uint %32 %18 %38
+ %39 = OpLoad %v3uint %x
+ %40 = OpShiftRightLogical %v3uint %39 %31
+ OpStore %x %40
+ %43 = OpLoad %v3uint %x
+ %46 = OpBitwiseAnd %v3uint %43 %45
+ %42 = OpINotEqual %v3bool %46 %18
+ %41 = OpSelect %v3uint %42 %18 %48
+ %49 = OpLoad %v3uint %x
+ %50 = OpShiftRightLogical %v3uint %49 %41
+ OpStore %x %50
+ %53 = OpLoad %v3uint %x
+ %56 = OpBitwiseAnd %v3uint %53 %55
+ %52 = OpINotEqual %v3bool %56 %18
+ %51 = OpSelect %v3uint %52 %18 %58
+ %59 = OpLoad %v3uint %x
+ %60 = OpShiftRightLogical %v3uint %59 %51
+ OpStore %x %60
+ %63 = OpLoad %v3uint %x
+ %66 = OpBitwiseAnd %v3uint %63 %65
+ %62 = OpINotEqual %v3bool %66 %18
+ %61 = OpSelect %v3uint %62 %18 %65
+ %68 = OpLoad %v3uint %x
+ %69 = OpIEqual %v3bool %68 %18
+ %67 = OpSelect %v3uint %69 %71 %18
+ %73 = OpBitwiseOr %v3uint %19 %31
+ %74 = OpBitwiseOr %v3uint %73 %41
+ %75 = OpBitwiseOr %v3uint %74 %51
+ %76 = OpBitwiseOr %v3uint %75 %61
+ %77 = OpBitwiseOr %v3uint %76 %67
+ OpReturnValue %77
+ OpFunctionEnd
+%firstTrailingBit_cb51ce = OpFunction %void None %78
+ %81 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %18
+ %res = OpVariable %_ptr_Function_v3uint Function %18
+ OpStore %arg_0 %18
+ %84 = OpLoad %v3uint %arg_0
+ %83 = OpFunctionCall %v3uint %tint_first_trailing_bit %84
+ OpStore %res %83
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %86
+ %88 = OpLabel
+ %89 = OpFunctionCall %void %firstTrailingBit_cb51ce
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %78
+ %91 = OpLabel
+ %92 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %92
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %78
+ %95 = OpLabel
+ %96 = OpFunctionCall %void %firstTrailingBit_cb51ce
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %78
+ %98 = OpLabel
+ %99 = OpFunctionCall %void %firstTrailingBit_cb51ce
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl
new file mode 100644
index 0000000..f167e27
--- /dev/null
+++ b/test/tint/builtins/gen/var/firstTrailingBit/cb51ce.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn firstTrailingBit_cb51ce() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = firstTrailingBit(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ firstTrailingBit_cb51ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ firstTrailingBit_cb51ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ firstTrailingBit_cb51ce();
+}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl
new file mode 100644
index 0000000..8ff9d8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<4, f32>) -> vec<4, f32>
+fn floor_3bccc4() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_3bccc4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_3bccc4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_3bccc4();
+}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl
new file mode 100644
index 0000000..3b91e5d
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void floor_3bccc4() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = floor(arg_0);
+}
+
+vec4 vertex_main() {
+ floor_3bccc4();
+ 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;
+
+void floor_3bccc4() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = floor(arg_0);
+}
+
+void fragment_main() {
+ floor_3bccc4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_3bccc4() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = floor(arg_0);
+}
+
+void compute_main() {
+ floor_3bccc4();
+}
+
+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/floor/3bccc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.hlsl
new file mode 100644
index 0000000..18d11a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void floor_3bccc4() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_3bccc4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_3bccc4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_3bccc4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl
new file mode 100644
index 0000000..1c6a7e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_3bccc4() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_3bccc4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_3bccc4();
+ return;
+}
+
+kernel void compute_main() {
+ floor_3bccc4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm
new file mode 100644
index 0000000..b2e800a
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %floor_3bccc4 "floor_3bccc4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%floor_3bccc4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Floor %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_3bccc4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %floor_3bccc4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %floor_3bccc4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl
new file mode 100644
index 0000000..119d8fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_3bccc4() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_3bccc4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_3bccc4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_3bccc4();
+}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl
new file mode 100644
index 0000000..0f70182
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<2, f32>) -> vec<2, f32>
+fn floor_5fc9ac() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_5fc9ac();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_5fc9ac();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_5fc9ac();
+}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl
new file mode 100644
index 0000000..570e48b
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void floor_5fc9ac() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = floor(arg_0);
+}
+
+vec4 vertex_main() {
+ floor_5fc9ac();
+ 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;
+
+void floor_5fc9ac() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = floor(arg_0);
+}
+
+void fragment_main() {
+ floor_5fc9ac();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_5fc9ac() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = floor(arg_0);
+}
+
+void compute_main() {
+ floor_5fc9ac();
+}
+
+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/floor/5fc9ac.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.hlsl
new file mode 100644
index 0000000..74dd9c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void floor_5fc9ac() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_5fc9ac();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_5fc9ac();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_5fc9ac();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl
new file mode 100644
index 0000000..01c6b5f
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_5fc9ac() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_5fc9ac();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_5fc9ac();
+ return;
+}
+
+kernel void compute_main() {
+ floor_5fc9ac();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm
new file mode 100644
index 0000000..0ce4a88
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %floor_5fc9ac "floor_5fc9ac"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%floor_5fc9ac = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Floor %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %floor_5fc9ac
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_5fc9ac
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %floor_5fc9ac
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl
new file mode 100644
index 0000000..6ebabfc
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_5fc9ac() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_5fc9ac();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_5fc9ac();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_5fc9ac();
+}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl
new file mode 100644
index 0000000..fe6a56e
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<3, f32>) -> vec<3, f32>
+fn floor_60d7ea() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_60d7ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_60d7ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_60d7ea();
+}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl
new file mode 100644
index 0000000..22fae37
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void floor_60d7ea() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = floor(arg_0);
+}
+
+vec4 vertex_main() {
+ floor_60d7ea();
+ 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;
+
+void floor_60d7ea() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = floor(arg_0);
+}
+
+void fragment_main() {
+ floor_60d7ea();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_60d7ea() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = floor(arg_0);
+}
+
+void compute_main() {
+ floor_60d7ea();
+}
+
+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/floor/60d7ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.hlsl
new file mode 100644
index 0000000..7659782
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void floor_60d7ea() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_60d7ea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_60d7ea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_60d7ea();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl
new file mode 100644
index 0000000..fd7f6d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_60d7ea() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_60d7ea();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_60d7ea();
+ return;
+}
+
+kernel void compute_main() {
+ floor_60d7ea();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm
new file mode 100644
index 0000000..0da636b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %floor_60d7ea "floor_60d7ea"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%floor_60d7ea = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Floor %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %floor_60d7ea
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_60d7ea
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %floor_60d7ea
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl
new file mode 100644
index 0000000..efb4036
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_60d7ea() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_60d7ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_60d7ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_60d7ea();
+}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl
new file mode 100644
index 0000000..20f91b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(f32) -> f32
+fn floor_66f154() {
+ var arg_0 = 1.0;
+ var res: f32 = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_66f154();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_66f154();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_66f154();
+}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl
new file mode 100644
index 0000000..4de296c
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void floor_66f154() {
+ float arg_0 = 1.0f;
+ float res = floor(arg_0);
+}
+
+vec4 vertex_main() {
+ floor_66f154();
+ 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;
+
+void floor_66f154() {
+ float arg_0 = 1.0f;
+ float res = floor(arg_0);
+}
+
+void fragment_main() {
+ floor_66f154();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_66f154() {
+ float arg_0 = 1.0f;
+ float res = floor(arg_0);
+}
+
+void compute_main() {
+ floor_66f154();
+}
+
+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/floor/66f154.wgsl.expected.hlsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.hlsl
new file mode 100644
index 0000000..43aecf8
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void floor_66f154() {
+ float arg_0 = 1.0f;
+ float res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_66f154();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_66f154();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_66f154();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl
new file mode 100644
index 0000000..577960f
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_66f154() {
+ float arg_0 = 1.0f;
+ float res = floor(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_66f154();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_66f154();
+ return;
+}
+
+kernel void compute_main() {
+ floor_66f154();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm
new file mode 100644
index 0000000..dc88494
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %floor_66f154 "floor_66f154"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%floor_66f154 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Floor %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %floor_66f154
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %floor_66f154
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %floor_66f154
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl
new file mode 100644
index 0000000..a368ec4
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_66f154() {
+ var arg_0 = 1.0;
+ var res : f32 = floor(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_66f154();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ floor_66f154();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ floor_66f154();
+}
diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl
new file mode 100644
index 0000000..77a07d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fma(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn fma_26a7a9() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res: vec2<f32> = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_26a7a9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_26a7a9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_26a7a9();
+}
diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl
new file mode 100644
index 0000000..dbc3037
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void fma_26a7a9() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+vec4 vertex_main() {
+ fma_26a7a9();
+ 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;
+
+void fma_26a7a9() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void fragment_main() {
+ fma_26a7a9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fma_26a7a9() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void compute_main() {
+ fma_26a7a9();
+}
+
+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/fma/26a7a9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.hlsl
new file mode 100644
index 0000000..b8a1465
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void fma_26a7a9() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 arg_2 = (0.0f).xx;
+ float2 res = mad(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fma_26a7a9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fma_26a7a9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fma_26a7a9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl
new file mode 100644
index 0000000..678c2ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fma_26a7a9() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 arg_2 = float2(0.0f);
+ float2 res = fma(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fma_26a7a9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fma_26a7a9();
+ return;
+}
+
+kernel void compute_main() {
+ fma_26a7a9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm
new file mode 100644
index 0000000..6f96fbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %fma_26a7a9 "fma_26a7a9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %fma_26a7a9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v2float %arg_0
+ %22 = OpLoad %v2float %arg_1
+ %23 = OpLoad %v2float %arg_2
+ %19 = OpExtInst %v2float %20 Fma %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %fma_26a7a9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %fma_26a7a9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %fma_26a7a9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl
new file mode 100644
index 0000000..ee68974
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/26a7a9.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn fma_26a7a9() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res : vec2<f32> = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_26a7a9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_26a7a9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_26a7a9();
+}
diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl
new file mode 100644
index 0000000..4cfaff2
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fma(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn fma_6a3283() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res: vec4<f32> = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_6a3283();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_6a3283();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_6a3283();
+}
diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl
new file mode 100644
index 0000000..2b0fd3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void fma_6a3283() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+vec4 vertex_main() {
+ fma_6a3283();
+ 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;
+
+void fma_6a3283() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void fragment_main() {
+ fma_6a3283();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fma_6a3283() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void compute_main() {
+ fma_6a3283();
+}
+
+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/fma/6a3283.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.hlsl
new file mode 100644
index 0000000..8786af1
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void fma_6a3283() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 arg_2 = (0.0f).xxxx;
+ float4 res = mad(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fma_6a3283();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fma_6a3283();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fma_6a3283();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl
new file mode 100644
index 0000000..34687c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fma_6a3283() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 arg_2 = float4(0.0f);
+ float4 res = fma(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fma_6a3283();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fma_6a3283();
+ return;
+}
+
+kernel void compute_main() {
+ fma_6a3283();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm
new file mode 100644
index 0000000..ab7b9b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %fma_6a3283 "fma_6a3283"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %fma_6a3283 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %5
+ %19 = OpLoad %v4float %arg_0
+ %20 = OpLoad %v4float %arg_1
+ %21 = OpLoad %v4float %arg_2
+ %17 = OpExtInst %v4float %18 Fma %19 %20 %21
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %fma_6a3283
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %fma_6a3283
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %fma_6a3283
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl
new file mode 100644
index 0000000..4cf1dde
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/6a3283.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn fma_6a3283() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res : vec4<f32> = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_6a3283();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_6a3283();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_6a3283();
+}
diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl
new file mode 100644
index 0000000..8f7bb65
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fma(f32, f32, f32) -> f32
+fn fma_c10ba3() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res: f32 = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_c10ba3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_c10ba3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_c10ba3();
+}
diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl
new file mode 100644
index 0000000..895f1bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void fma_c10ba3() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+vec4 vertex_main() {
+ fma_c10ba3();
+ 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;
+
+void fma_c10ba3() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void fragment_main() {
+ fma_c10ba3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fma_c10ba3() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void compute_main() {
+ fma_c10ba3();
+}
+
+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/fma/c10ba3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.hlsl
new file mode 100644
index 0000000..0c4b6a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void fma_c10ba3() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = mad(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fma_c10ba3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fma_c10ba3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fma_c10ba3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl
new file mode 100644
index 0000000..a58b323
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fma_c10ba3() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = fma(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fma_c10ba3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fma_c10ba3();
+ return;
+}
+
+kernel void compute_main() {
+ fma_c10ba3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm
new file mode 100644
index 0000000..5c99fc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %fma_c10ba3 "fma_c10ba3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpTypeFunction %v4float
+ %fma_c10ba3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ OpStore %arg_2 %float_1
+ %20 = OpLoad %float %arg_0
+ %21 = OpLoad %float %arg_1
+ %22 = OpLoad %float %arg_2
+ %18 = OpExtInst %float %19 Fma %20 %21 %22
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %fma_c10ba3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %fma_c10ba3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %fma_c10ba3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl
new file mode 100644
index 0000000..4b4da43
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/c10ba3.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn fma_c10ba3() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res : f32 = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_c10ba3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_c10ba3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_c10ba3();
+}
diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl
new file mode 100644
index 0000000..d2b71c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fma(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn fma_e17c5c() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res: vec3<f32> = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_e17c5c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_e17c5c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_e17c5c();
+}
diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl
new file mode 100644
index 0000000..548579c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void fma_e17c5c() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+vec4 vertex_main() {
+ fma_e17c5c();
+ 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;
+
+void fma_e17c5c() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void fragment_main() {
+ fma_e17c5c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fma_e17c5c() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = ((arg_0) * (arg_1) + (arg_2));
+}
+
+void compute_main() {
+ fma_e17c5c();
+}
+
+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/fma/e17c5c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.hlsl
new file mode 100644
index 0000000..5e4d025
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void fma_e17c5c() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 arg_2 = (0.0f).xxx;
+ float3 res = mad(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fma_e17c5c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fma_e17c5c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fma_e17c5c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl
new file mode 100644
index 0000000..ac34e5c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fma_e17c5c() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 arg_2 = float3(0.0f);
+ float3 res = fma(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fma_e17c5c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fma_e17c5c();
+ return;
+}
+
+kernel void compute_main() {
+ fma_e17c5c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm
new file mode 100644
index 0000000..9b4d8bf
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %fma_e17c5c "fma_e17c5c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %fma_e17c5c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v3float %arg_0
+ %22 = OpLoad %v3float %arg_1
+ %23 = OpLoad %v3float %arg_2
+ %19 = OpExtInst %v3float %20 Fma %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %fma_e17c5c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %fma_e17c5c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %fma_e17c5c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl
new file mode 100644
index 0000000..e47a18e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fma/e17c5c.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn fma_e17c5c() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res : vec3<f32> = fma(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fma_e17c5c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fma_e17c5c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fma_e17c5c();
+}
diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl
new file mode 100644
index 0000000..eb6d1de
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fract(vec<4, f32>) -> vec<4, f32>
+fn fract_8bc1e9() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_8bc1e9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_8bc1e9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_8bc1e9();
+}
diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl
new file mode 100644
index 0000000..10d6f35
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void fract_8bc1e9() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = fract(arg_0);
+}
+
+vec4 vertex_main() {
+ fract_8bc1e9();
+ 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;
+
+void fract_8bc1e9() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = fract(arg_0);
+}
+
+void fragment_main() {
+ fract_8bc1e9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fract_8bc1e9() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = fract(arg_0);
+}
+
+void compute_main() {
+ fract_8bc1e9();
+}
+
+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/fract/8bc1e9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.hlsl
new file mode 100644
index 0000000..cc5fa7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void fract_8bc1e9() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = frac(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fract_8bc1e9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fract_8bc1e9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fract_8bc1e9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl
new file mode 100644
index 0000000..10b36c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fract_8bc1e9() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = fract(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fract_8bc1e9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fract_8bc1e9();
+ return;
+}
+
+kernel void compute_main() {
+ fract_8bc1e9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm
new file mode 100644
index 0000000..5b20c6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %fract_8bc1e9 "fract_8bc1e9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%fract_8bc1e9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Fract %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %fract_8bc1e9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %fract_8bc1e9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %fract_8bc1e9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl
new file mode 100644
index 0000000..9447b8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/8bc1e9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn fract_8bc1e9() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_8bc1e9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_8bc1e9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_8bc1e9();
+}
diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl
new file mode 100644
index 0000000..f82334e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fract(vec<2, f32>) -> vec<2, f32>
+fn fract_943cb1() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_943cb1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_943cb1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_943cb1();
+}
diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl
new file mode 100644
index 0000000..ba5a3f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void fract_943cb1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = fract(arg_0);
+}
+
+vec4 vertex_main() {
+ fract_943cb1();
+ 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;
+
+void fract_943cb1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = fract(arg_0);
+}
+
+void fragment_main() {
+ fract_943cb1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fract_943cb1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = fract(arg_0);
+}
+
+void compute_main() {
+ fract_943cb1();
+}
+
+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/fract/943cb1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.hlsl
new file mode 100644
index 0000000..38f6505
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void fract_943cb1() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = frac(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fract_943cb1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fract_943cb1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fract_943cb1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl
new file mode 100644
index 0000000..c80a69b
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fract_943cb1() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = fract(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fract_943cb1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fract_943cb1();
+ return;
+}
+
+kernel void compute_main() {
+ fract_943cb1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm
new file mode 100644
index 0000000..d63463b
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %fract_943cb1 "fract_943cb1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%fract_943cb1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Fract %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %fract_943cb1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %fract_943cb1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %fract_943cb1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl
new file mode 100644
index 0000000..089b08d
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/943cb1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn fract_943cb1() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_943cb1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_943cb1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_943cb1();
+}
diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl b/test/tint/builtins/gen/var/fract/a49758.wgsl
new file mode 100644
index 0000000..51ebe9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/a49758.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fract(vec<3, f32>) -> vec<3, f32>
+fn fract_a49758() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_a49758();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_a49758();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_a49758();
+}
diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl
new file mode 100644
index 0000000..9f2b8f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void fract_a49758() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = fract(arg_0);
+}
+
+vec4 vertex_main() {
+ fract_a49758();
+ 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;
+
+void fract_a49758() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = fract(arg_0);
+}
+
+void fragment_main() {
+ fract_a49758();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fract_a49758() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = fract(arg_0);
+}
+
+void compute_main() {
+ fract_a49758();
+}
+
+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/fract/a49758.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.hlsl
new file mode 100644
index 0000000..1efd8ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void fract_a49758() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = frac(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fract_a49758();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fract_a49758();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fract_a49758();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl
new file mode 100644
index 0000000..ee497e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fract_a49758() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = fract(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fract_a49758();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fract_a49758();
+ return;
+}
+
+kernel void compute_main() {
+ fract_a49758();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm
new file mode 100644
index 0000000..7aed99e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %fract_a49758 "fract_a49758"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%fract_a49758 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Fract %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %fract_a49758
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %fract_a49758
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %fract_a49758
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl
new file mode 100644
index 0000000..0aef8a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/a49758.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn fract_a49758() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_a49758();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_a49758();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_a49758();
+}
diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl
new file mode 100644
index 0000000..22bff95
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fract(f32) -> f32
+fn fract_fa5c71() {
+ var arg_0 = 1.0;
+ var res: f32 = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_fa5c71();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_fa5c71();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_fa5c71();
+}
diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl
new file mode 100644
index 0000000..1727089
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void fract_fa5c71() {
+ float arg_0 = 1.0f;
+ float res = fract(arg_0);
+}
+
+vec4 vertex_main() {
+ fract_fa5c71();
+ 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;
+
+void fract_fa5c71() {
+ float arg_0 = 1.0f;
+ float res = fract(arg_0);
+}
+
+void fragment_main() {
+ fract_fa5c71();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void fract_fa5c71() {
+ float arg_0 = 1.0f;
+ float res = fract(arg_0);
+}
+
+void compute_main() {
+ fract_fa5c71();
+}
+
+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/fract/fa5c71.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.hlsl
new file mode 100644
index 0000000..c24fc77
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void fract_fa5c71() {
+ float arg_0 = 1.0f;
+ float res = frac(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ fract_fa5c71();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ fract_fa5c71();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ fract_fa5c71();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl
new file mode 100644
index 0000000..28643cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fract_fa5c71() {
+ float arg_0 = 1.0f;
+ float res = fract(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ fract_fa5c71();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ fract_fa5c71();
+ return;
+}
+
+kernel void compute_main() {
+ fract_fa5c71();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm
new file mode 100644
index 0000000..18cc7aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %fract_fa5c71 "fract_fa5c71"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%fract_fa5c71 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Fract %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %fract_fa5c71
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %fract_fa5c71
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %fract_fa5c71
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl
new file mode 100644
index 0000000..b41cb8b
--- /dev/null
+++ b/test/tint/builtins/gen/var/fract/fa5c71.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn fract_fa5c71() {
+ var arg_0 = 1.0;
+ var res : f32 = fract(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ fract_fa5c71();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fract_fa5c71();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ fract_fa5c71();
+}
diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl b/test/tint/builtins/gen/var/frexp/368997.wgsl
new file mode 100644
index 0000000..b71eb10
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/368997.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn frexp(vec<3, f32>) -> __frexp_result_vec<3>
+fn frexp_368997() {
+ var arg_0 = vec3<f32>();
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_368997();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_368997();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_368997();
+}
diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl
new file mode 100644
index 0000000..122794f
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct frexp_result_vec3 {
+ vec3 sig;
+ ivec3 exp;
+};
+
+frexp_result_vec3 tint_frexp(vec3 param_0) {
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_368997() {
+ vec3 arg_0 = vec3(0.0f);
+ frexp_result_vec3 res = tint_frexp(arg_0);
+}
+
+vec4 vertex_main() {
+ frexp_368997();
+ 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;
+
+struct frexp_result_vec3 {
+ vec3 sig;
+ ivec3 exp;
+};
+
+frexp_result_vec3 tint_frexp(vec3 param_0) {
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_368997() {
+ vec3 arg_0 = vec3(0.0f);
+ frexp_result_vec3 res = tint_frexp(arg_0);
+}
+
+void fragment_main() {
+ frexp_368997();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct frexp_result_vec3 {
+ vec3 sig;
+ ivec3 exp;
+};
+
+frexp_result_vec3 tint_frexp(vec3 param_0) {
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_368997() {
+ vec3 arg_0 = vec3(0.0f);
+ frexp_result_vec3 res = tint_frexp(arg_0);
+}
+
+void compute_main() {
+ frexp_368997();
+}
+
+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/frexp/368997.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.hlsl
new file mode 100644
index 0000000..59aa53a
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct frexp_result_vec3 {
+ float3 sig;
+ int3 exp;
+};
+frexp_result_vec3 tint_frexp(float3 param_0) {
+ float3 exp;
+ float3 sig = frexp(param_0, exp);
+ frexp_result_vec3 result = {sig, int3(exp)};
+ return result;
+}
+
+void frexp_368997() {
+ float3 arg_0 = (0.0f).xxx;
+ frexp_result_vec3 res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ frexp_368997();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ frexp_368997();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ frexp_368997();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl
new file mode 100644
index 0000000..a94bf96
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct frexp_result_vec3 {
+ float3 sig;
+ int3 exp;
+};
+frexp_result_vec3 tint_frexp(float3 param_0) {
+ int3 exp;
+ float3 sig = frexp(param_0, exp);
+ return {sig, exp};
+}
+
+void frexp_368997() {
+ float3 arg_0 = float3(0.0f);
+ frexp_result_vec3 res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ frexp_368997();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ frexp_368997();
+ return;
+}
+
+kernel void compute_main() {
+ frexp_368997();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm
new file mode 100644
index 0000000..020e6a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %frexp_368997 "frexp_368997"
+ OpName %arg_0 "arg_0"
+ OpName %__frexp_result_vec3 "__frexp_result_vec3"
+ OpMemberName %__frexp_result_vec3 0 "sig"
+ OpMemberName %__frexp_result_vec3 1 "exp"
+ 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
+ OpMemberDecorate %__frexp_result_vec3 0 Offset 0
+ OpMemberDecorate %__frexp_result_vec3 1 Offset 16
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+%__frexp_result_vec3 = OpTypeStruct %v3float %v3int
+%_ptr_Function___frexp_result_vec3 = OpTypePointer Function %__frexp_result_vec3
+ %25 = OpConstantNull %__frexp_result_vec3
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%frexp_368997 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function___frexp_result_vec3 Function %25
+ OpStore %arg_0 %14
+ %22 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %__frexp_result_vec3 %21 FrexpStruct %22
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %frexp_368997
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %frexp_368997
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %frexp_368997
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl
new file mode 100644
index 0000000..41b485e
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/368997.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn frexp_368997() {
+ var arg_0 = vec3<f32>();
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_368997();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_368997();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_368997();
+}
diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl
new file mode 100644
index 0000000..8dc6373
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn frexp(vec<4, f32>) -> __frexp_result_vec<4>
+fn frexp_3c4f48() {
+ var arg_0 = vec4<f32>();
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_3c4f48();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_3c4f48();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_3c4f48();
+}
diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl
new file mode 100644
index 0000000..fbee219
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct frexp_result_vec4 {
+ vec4 sig;
+ ivec4 exp;
+};
+
+frexp_result_vec4 tint_frexp(vec4 param_0) {
+ frexp_result_vec4 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_3c4f48() {
+ vec4 arg_0 = vec4(0.0f);
+ frexp_result_vec4 res = tint_frexp(arg_0);
+}
+
+vec4 vertex_main() {
+ frexp_3c4f48();
+ 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;
+
+struct frexp_result_vec4 {
+ vec4 sig;
+ ivec4 exp;
+};
+
+frexp_result_vec4 tint_frexp(vec4 param_0) {
+ frexp_result_vec4 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_3c4f48() {
+ vec4 arg_0 = vec4(0.0f);
+ frexp_result_vec4 res = tint_frexp(arg_0);
+}
+
+void fragment_main() {
+ frexp_3c4f48();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct frexp_result_vec4 {
+ vec4 sig;
+ ivec4 exp;
+};
+
+frexp_result_vec4 tint_frexp(vec4 param_0) {
+ frexp_result_vec4 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_3c4f48() {
+ vec4 arg_0 = vec4(0.0f);
+ frexp_result_vec4 res = tint_frexp(arg_0);
+}
+
+void compute_main() {
+ frexp_3c4f48();
+}
+
+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/frexp/3c4f48.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.hlsl
new file mode 100644
index 0000000..7997378
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct frexp_result_vec4 {
+ float4 sig;
+ int4 exp;
+};
+frexp_result_vec4 tint_frexp(float4 param_0) {
+ float4 exp;
+ float4 sig = frexp(param_0, exp);
+ frexp_result_vec4 result = {sig, int4(exp)};
+ return result;
+}
+
+void frexp_3c4f48() {
+ float4 arg_0 = (0.0f).xxxx;
+ frexp_result_vec4 res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ frexp_3c4f48();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ frexp_3c4f48();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ frexp_3c4f48();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl
new file mode 100644
index 0000000..a4a3e88
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct frexp_result_vec4 {
+ float4 sig;
+ int4 exp;
+};
+frexp_result_vec4 tint_frexp(float4 param_0) {
+ int4 exp;
+ float4 sig = frexp(param_0, exp);
+ return {sig, exp};
+}
+
+void frexp_3c4f48() {
+ float4 arg_0 = float4(0.0f);
+ frexp_result_vec4 res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ frexp_3c4f48();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ frexp_3c4f48();
+ return;
+}
+
+kernel void compute_main() {
+ frexp_3c4f48();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm
new file mode 100644
index 0000000..093c05c
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %frexp_3c4f48 "frexp_3c4f48"
+ OpName %arg_0 "arg_0"
+ OpName %__frexp_result_vec4 "__frexp_result_vec4"
+ OpMemberName %__frexp_result_vec4 0 "sig"
+ OpMemberName %__frexp_result_vec4 1 "exp"
+ 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
+ OpMemberDecorate %__frexp_result_vec4 0 Offset 0
+ OpMemberDecorate %__frexp_result_vec4 1 Offset 16
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+%__frexp_result_vec4 = OpTypeStruct %v4float %v4int
+%_ptr_Function___frexp_result_vec4 = OpTypePointer Function %__frexp_result_vec4
+ %23 = OpConstantNull %__frexp_result_vec4
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%frexp_3c4f48 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function___frexp_result_vec4 Function %23
+ OpStore %arg_0 %5
+ %20 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %__frexp_result_vec4 %19 FrexpStruct %20
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %frexp_3c4f48
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %frexp_3c4f48
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %frexp_3c4f48
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl
new file mode 100644
index 0000000..3123659
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/3c4f48.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn frexp_3c4f48() {
+ var arg_0 = vec4<f32>();
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_3c4f48();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_3c4f48();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_3c4f48();
+}
diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl
new file mode 100644
index 0000000..8ea6107
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn frexp(vec<2, f32>) -> __frexp_result_vec<2>
+fn frexp_4bdfc7() {
+ var arg_0 = vec2<f32>();
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_4bdfc7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_4bdfc7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_4bdfc7();
+}
diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl
new file mode 100644
index 0000000..479ea01
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct frexp_result_vec2 {
+ vec2 sig;
+ ivec2 exp;
+};
+
+frexp_result_vec2 tint_frexp(vec2 param_0) {
+ frexp_result_vec2 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_4bdfc7() {
+ vec2 arg_0 = vec2(0.0f);
+ frexp_result_vec2 res = tint_frexp(arg_0);
+}
+
+vec4 vertex_main() {
+ frexp_4bdfc7();
+ 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;
+
+struct frexp_result_vec2 {
+ vec2 sig;
+ ivec2 exp;
+};
+
+frexp_result_vec2 tint_frexp(vec2 param_0) {
+ frexp_result_vec2 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_4bdfc7() {
+ vec2 arg_0 = vec2(0.0f);
+ frexp_result_vec2 res = tint_frexp(arg_0);
+}
+
+void fragment_main() {
+ frexp_4bdfc7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct frexp_result_vec2 {
+ vec2 sig;
+ ivec2 exp;
+};
+
+frexp_result_vec2 tint_frexp(vec2 param_0) {
+ frexp_result_vec2 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_4bdfc7() {
+ vec2 arg_0 = vec2(0.0f);
+ frexp_result_vec2 res = tint_frexp(arg_0);
+}
+
+void compute_main() {
+ frexp_4bdfc7();
+}
+
+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/frexp/4bdfc7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.hlsl
new file mode 100644
index 0000000..f47aba8
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct frexp_result_vec2 {
+ float2 sig;
+ int2 exp;
+};
+frexp_result_vec2 tint_frexp(float2 param_0) {
+ float2 exp;
+ float2 sig = frexp(param_0, exp);
+ frexp_result_vec2 result = {sig, int2(exp)};
+ return result;
+}
+
+void frexp_4bdfc7() {
+ float2 arg_0 = (0.0f).xx;
+ frexp_result_vec2 res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ frexp_4bdfc7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ frexp_4bdfc7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ frexp_4bdfc7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl
new file mode 100644
index 0000000..51dac58
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct frexp_result_vec2 {
+ float2 sig;
+ int2 exp;
+};
+frexp_result_vec2 tint_frexp(float2 param_0) {
+ int2 exp;
+ float2 sig = frexp(param_0, exp);
+ return {sig, exp};
+}
+
+void frexp_4bdfc7() {
+ float2 arg_0 = float2(0.0f);
+ frexp_result_vec2 res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ frexp_4bdfc7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ frexp_4bdfc7();
+ return;
+}
+
+kernel void compute_main() {
+ frexp_4bdfc7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm
new file mode 100644
index 0000000..0b5e768
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %frexp_4bdfc7 "frexp_4bdfc7"
+ OpName %arg_0 "arg_0"
+ OpName %__frexp_result_vec2 "__frexp_result_vec2"
+ OpMemberName %__frexp_result_vec2 0 "sig"
+ OpMemberName %__frexp_result_vec2 1 "exp"
+ 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
+ OpMemberDecorate %__frexp_result_vec2 0 Offset 0
+ OpMemberDecorate %__frexp_result_vec2 1 Offset 8
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+%__frexp_result_vec2 = OpTypeStruct %v2float %v2int
+%_ptr_Function___frexp_result_vec2 = OpTypePointer Function %__frexp_result_vec2
+ %25 = OpConstantNull %__frexp_result_vec2
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%frexp_4bdfc7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function___frexp_result_vec2 Function %25
+ OpStore %arg_0 %14
+ %22 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %__frexp_result_vec2 %21 FrexpStruct %22
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %frexp_4bdfc7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %frexp_4bdfc7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %frexp_4bdfc7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl
new file mode 100644
index 0000000..757df25b
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/4bdfc7.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn frexp_4bdfc7() {
+ var arg_0 = vec2<f32>();
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_4bdfc7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_4bdfc7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_4bdfc7();
+}
diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl
new file mode 100644
index 0000000..a3b1aa4
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn frexp(f32) -> __frexp_result
+fn frexp_eabd40() {
+ var arg_0 = 1.0;
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_eabd40();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_eabd40();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_eabd40();
+}
diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl
new file mode 100644
index 0000000..6d1a1b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct frexp_result {
+ float sig;
+ int exp;
+};
+
+frexp_result tint_frexp(float param_0) {
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_eabd40() {
+ float arg_0 = 1.0f;
+ frexp_result res = tint_frexp(arg_0);
+}
+
+vec4 vertex_main() {
+ frexp_eabd40();
+ 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;
+
+struct frexp_result {
+ float sig;
+ int exp;
+};
+
+frexp_result tint_frexp(float param_0) {
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_eabd40() {
+ float arg_0 = 1.0f;
+ frexp_result res = tint_frexp(arg_0);
+}
+
+void fragment_main() {
+ frexp_eabd40();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct frexp_result {
+ float sig;
+ int exp;
+};
+
+frexp_result tint_frexp(float param_0) {
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void frexp_eabd40() {
+ float arg_0 = 1.0f;
+ frexp_result res = tint_frexp(arg_0);
+}
+
+void compute_main() {
+ frexp_eabd40();
+}
+
+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/frexp/eabd40.wgsl.expected.hlsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.hlsl
new file mode 100644
index 0000000..a3e4195
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct frexp_result {
+ float sig;
+ int exp;
+};
+frexp_result tint_frexp(float param_0) {
+ float exp;
+ float sig = frexp(param_0, exp);
+ frexp_result result = {sig, int(exp)};
+ return result;
+}
+
+void frexp_eabd40() {
+ float arg_0 = 1.0f;
+ frexp_result res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ frexp_eabd40();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ frexp_eabd40();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ frexp_eabd40();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl
new file mode 100644
index 0000000..3249522
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct frexp_result {
+ float sig;
+ int exp;
+};
+frexp_result tint_frexp(float param_0) {
+ int exp;
+ float sig = frexp(param_0, exp);
+ return {sig, exp};
+}
+
+void frexp_eabd40() {
+ float arg_0 = 1.0f;
+ frexp_result res = tint_frexp(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ frexp_eabd40();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ frexp_eabd40();
+ return;
+}
+
+kernel void compute_main() {
+ frexp_eabd40();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b0fed2
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %frexp_eabd40 "frexp_eabd40"
+ OpName %arg_0 "arg_0"
+ OpName %__frexp_result "__frexp_result"
+ OpMemberName %__frexp_result 0 "sig"
+ OpMemberName %__frexp_result 1 "exp"
+ 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
+ OpMemberDecorate %__frexp_result 0 Offset 0
+ OpMemberDecorate %__frexp_result 1 Offset 4
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %int = OpTypeInt 32 1
+%__frexp_result = OpTypeStruct %float %int
+%_ptr_Function___frexp_result = OpTypePointer Function %__frexp_result
+ %23 = OpConstantNull %__frexp_result
+ %24 = OpTypeFunction %v4float
+%frexp_eabd40 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function___frexp_result Function %23
+ OpStore %arg_0 %float_1
+ %20 = OpLoad %float %arg_0
+ %16 = OpExtInst %__frexp_result %19 FrexpStruct %20
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %frexp_eabd40
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %frexp_eabd40
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %frexp_eabd40
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl
new file mode 100644
index 0000000..746e9bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/frexp/eabd40.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn frexp_eabd40() {
+ var arg_0 = 1.0;
+ var res = frexp(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ frexp_eabd40();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ frexp_eabd40();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ frexp_eabd40();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl
new file mode 100644
index 0000000..8446a7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidth(vec<3, f32>) -> vec<3, f32>
+fn fwidth_5d1b39() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_5d1b39();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl
new file mode 100644
index 0000000..876dc56
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidth_5d1b39() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_5d1b39();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl
new file mode 100644
index 0000000..6e992c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidth_5d1b39() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_5d1b39();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl
new file mode 100644
index 0000000..1afd1e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidth_5d1b39() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidth_5d1b39();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm
new file mode 100644
index 0000000..4bd061c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidth_5d1b39 "fwidth_5d1b39"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%fwidth_5d1b39 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpFwidth %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidth_5d1b39
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl
new file mode 100644
index 0000000..eed9270
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/5d1b39.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidth_5d1b39() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_5d1b39();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl
new file mode 100644
index 0000000..abd769d
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidth(vec<2, f32>) -> vec<2, f32>
+fn fwidth_b83ebb() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_b83ebb();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl
new file mode 100644
index 0000000..fa2ef3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidth_b83ebb() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_b83ebb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl
new file mode 100644
index 0000000..7452af7
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidth_b83ebb() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_b83ebb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl
new file mode 100644
index 0000000..0d58110
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidth_b83ebb() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidth_b83ebb();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm
new file mode 100644
index 0000000..2998630
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidth_b83ebb "fwidth_b83ebb"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%fwidth_b83ebb = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpFwidth %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidth_b83ebb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl
new file mode 100644
index 0000000..091f627
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/b83ebb.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidth_b83ebb() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_b83ebb();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl
new file mode 100644
index 0000000..0f90763
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidth(vec<4, f32>) -> vec<4, f32>
+fn fwidth_d2ab9a() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_d2ab9a();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl
new file mode 100644
index 0000000..efc08b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidth_d2ab9a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_d2ab9a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl
new file mode 100644
index 0000000..7b21ef9
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidth_d2ab9a() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_d2ab9a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl
new file mode 100644
index 0000000..9da0673
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidth_d2ab9a() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidth_d2ab9a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm
new file mode 100644
index 0000000..996a65b
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidth_d2ab9a "fwidth_d2ab9a"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%fwidth_d2ab9a = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpFwidth %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidth_d2ab9a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl
new file mode 100644
index 0000000..25547c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/d2ab9a.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidth_d2ab9a() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_d2ab9a();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl
new file mode 100644
index 0000000..f1c3ab8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidth(f32) -> f32
+fn fwidth_df38ef() {
+ var arg_0 = 1.0;
+ var res: f32 = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_df38ef();
+}
diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl
new file mode 100644
index 0000000..fd90c67
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidth_df38ef() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_df38ef();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl
new file mode 100644
index 0000000..8c0b254
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidth_df38ef() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidth_df38ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl
new file mode 100644
index 0000000..45cdac6
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidth_df38ef() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidth_df38ef();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm
new file mode 100644
index 0000000..1b89aaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.spvasm
@@ -0,0 +1,34 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidth_df38ef "fwidth_df38ef"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%fwidth_df38ef = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpFwidth %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidth_df38ef
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl
new file mode 100644
index 0000000..616fc52
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidth/df38ef.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidth_df38ef() {
+ var arg_0 = 1.0;
+ var res : f32 = fwidth(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidth_df38ef();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl
new file mode 100644
index 0000000..408d3eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthCoarse(f32) -> f32
+fn fwidthCoarse_159c8a() {
+ var arg_0 = 1.0;
+ var res: f32 = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_159c8a();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl
new file mode 100644
index 0000000..7d57bbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthCoarse_159c8a() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_159c8a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl
new file mode 100644
index 0000000..37bbb25
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthCoarse_159c8a() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_159c8a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl
new file mode 100644
index 0000000..eb66e08
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthCoarse_159c8a() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthCoarse_159c8a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm
new file mode 100644
index 0000000..324f1af
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthCoarse_159c8a "fwidthCoarse_159c8a"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%fwidthCoarse_159c8a = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpFwidthCoarse %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthCoarse_159c8a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl
new file mode 100644
index 0000000..a5bb1db
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/159c8a.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthCoarse_159c8a() {
+ var arg_0 = 1.0;
+ var res : f32 = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_159c8a();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl
new file mode 100644
index 0000000..6561279
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthCoarse(vec<3, f32>) -> vec<3, f32>
+fn fwidthCoarse_1e59d9() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_1e59d9();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl
new file mode 100644
index 0000000..d856f71
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthCoarse_1e59d9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_1e59d9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl
new file mode 100644
index 0000000..8810326
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthCoarse_1e59d9() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_1e59d9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl
new file mode 100644
index 0000000..86aeda0
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthCoarse_1e59d9() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthCoarse_1e59d9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm
new file mode 100644
index 0000000..ddcd396
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthCoarse_1e59d9 "fwidthCoarse_1e59d9"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%fwidthCoarse_1e59d9 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpFwidthCoarse %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthCoarse_1e59d9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl
new file mode 100644
index 0000000..2bc3f68
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/1e59d9.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthCoarse_1e59d9() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_1e59d9();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl
new file mode 100644
index 0000000..ce9b1a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthCoarse(vec<4, f32>) -> vec<4, f32>
+fn fwidthCoarse_4e4fc4() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_4e4fc4();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl
new file mode 100644
index 0000000..ad154c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthCoarse_4e4fc4() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_4e4fc4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl
new file mode 100644
index 0000000..f010dac
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthCoarse_4e4fc4() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_4e4fc4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl
new file mode 100644
index 0000000..9d388bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthCoarse_4e4fc4() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthCoarse_4e4fc4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm
new file mode 100644
index 0000000..e4b1f93
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthCoarse_4e4fc4 "fwidthCoarse_4e4fc4"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%fwidthCoarse_4e4fc4 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpFwidthCoarse %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthCoarse_4e4fc4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl
new file mode 100644
index 0000000..2ea994e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/4e4fc4.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthCoarse_4e4fc4() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_4e4fc4();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl
new file mode 100644
index 0000000..2b51955
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthCoarse(vec<2, f32>) -> vec<2, f32>
+fn fwidthCoarse_e653f7() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_e653f7();
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl
new file mode 100644
index 0000000..585997c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthCoarse_e653f7() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_e653f7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl
new file mode 100644
index 0000000..e4fdde6
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthCoarse_e653f7() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthCoarse_e653f7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl
new file mode 100644
index 0000000..522cf8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthCoarse_e653f7() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthCoarse_e653f7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm
new file mode 100644
index 0000000..3ff087e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthCoarse_e653f7 "fwidthCoarse_e653f7"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%fwidthCoarse_e653f7 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpFwidthCoarse %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthCoarse_e653f7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl
new file mode 100644
index 0000000..a628383
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthCoarse/e653f7.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthCoarse_e653f7() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = fwidthCoarse(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthCoarse_e653f7();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl
new file mode 100644
index 0000000..156d47f
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthFine(vec<3, f32>) -> vec<3, f32>
+fn fwidthFine_523fdc() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_523fdc();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl
new file mode 100644
index 0000000..5dc1139
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthFine_523fdc() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_523fdc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl
new file mode 100644
index 0000000..48a6f0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthFine_523fdc() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_523fdc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl
new file mode 100644
index 0000000..fd137a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthFine_523fdc() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthFine_523fdc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm
new file mode 100644
index 0000000..2ba3204
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthFine_523fdc "fwidthFine_523fdc"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v3float = OpTypeVector %float 3
+ %7 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%fwidthFine_523fdc = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %7
+ %res = OpVariable %_ptr_Function_v3float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v3float %arg_0
+ %10 = OpFwidthFine %v3float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthFine_523fdc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl
new file mode 100644
index 0000000..31f63e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/523fdc.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthFine_523fdc() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_523fdc();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl
new file mode 100644
index 0000000..e9044b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthFine(vec<4, f32>) -> vec<4, f32>
+fn fwidthFine_68f4ef() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_68f4ef();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl
new file mode 100644
index 0000000..232c00e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthFine_68f4ef() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_68f4ef();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl
new file mode 100644
index 0000000..99d0ae4
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthFine_68f4ef() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_68f4ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl
new file mode 100644
index 0000000..aa405139
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthFine_68f4ef() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthFine_68f4ef();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm
new file mode 100644
index 0000000..d3a07dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthFine_68f4ef "fwidthFine_68f4ef"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+ %7 = OpConstantNull %v4float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%fwidthFine_68f4ef = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %7
+ %res = OpVariable %_ptr_Function_v4float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v4float %arg_0
+ %10 = OpFwidthFine %v4float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthFine_68f4ef
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl
new file mode 100644
index 0000000..226acfb
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/68f4ef.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthFine_68f4ef() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_68f4ef();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl
new file mode 100644
index 0000000..c614dbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthFine(f32) -> f32
+fn fwidthFine_f1742d() {
+ var arg_0 = 1.0;
+ var res: f32 = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_f1742d();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl
new file mode 100644
index 0000000..8baea1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthFine_f1742d() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_f1742d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl
new file mode 100644
index 0000000..8e2b50b
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthFine_f1742d() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_f1742d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl
new file mode 100644
index 0000000..badc5cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthFine_f1742d() {
+ float arg_0 = 1.0f;
+ float res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthFine_f1742d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm
new file mode 100644
index 0000000..a2d3e96
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthFine_f1742d "fwidthFine_f1742d"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %9 = OpConstantNull %float
+%fwidthFine_f1742d = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %9
+ %res = OpVariable %_ptr_Function_float Function %9
+ OpStore %arg_0 %float_1
+ %11 = OpLoad %float %arg_0
+ %10 = OpFwidthFine %float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthFine_f1742d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl
new file mode 100644
index 0000000..0f475d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/f1742d.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthFine_f1742d() {
+ var arg_0 = 1.0;
+ var res : f32 = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_f1742d();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl
new file mode 100644
index 0000000..e5166ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl
@@ -0,0 +1,35 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn fwidthFine(vec<2, f32>) -> vec<2, f32>
+fn fwidthFine_ff6aa0() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_ff6aa0();
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl
new file mode 100644
index 0000000..d28ae67
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.glsl
@@ -0,0 +1,16 @@
+#version 310 es
+precision mediump float;
+
+void fwidthFine_ff6aa0() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_ff6aa0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl
new file mode 100644
index 0000000..3ac7b17
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void fwidthFine_ff6aa0() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = fwidth(arg_0);
+}
+
+void fragment_main() {
+ fwidthFine_ff6aa0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl
new file mode 100644
index 0000000..857729e
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void fwidthFine_ff6aa0() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = fwidth(arg_0);
+}
+
+fragment void fragment_main() {
+ fwidthFine_ff6aa0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm
new file mode 100644
index 0000000..3bad08f
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.spvasm
@@ -0,0 +1,35 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 16
+; Schema: 0
+ OpCapability Shader
+ OpCapability DerivativeControl
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %fwidthFine_ff6aa0 "fwidthFine_ff6aa0"
+ OpName %arg_0 "arg_0"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+ %v2float = OpTypeVector %float 2
+ %7 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%fwidthFine_ff6aa0 = OpFunction %void None %1
+ %4 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %7
+ %res = OpVariable %_ptr_Function_v2float Function %7
+ OpStore %arg_0 %7
+ %11 = OpLoad %v2float %arg_0
+ %10 = OpFwidthFine %v2float %11
+ OpStore %res %10
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %1
+ %14 = OpLabel
+ %15 = OpFunctionCall %void %fwidthFine_ff6aa0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl
new file mode 100644
index 0000000..db8da89
--- /dev/null
+++ b/test/tint/builtins/gen/var/fwidthFine/ff6aa0.wgsl.expected.wgsl
@@ -0,0 +1,9 @@
+fn fwidthFine_ff6aa0() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = fwidthFine(arg_0);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ fwidthFine_ff6aa0();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl
new file mode 100644
index 0000000..d6ce9d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(vec<2, u32>, vec<2, u32>, u32, u32) -> vec<2, u32>
+fn insertBits_3c7ba5() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec2<u32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_3c7ba5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_3c7ba5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_3c7ba5();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl
new file mode 100644
index 0000000..5b8eaca
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_3c7ba5() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_3c7ba5();
+ 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;
+
+uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_3c7ba5() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_3c7ba5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec2 tint_insert_bits(uvec2 v, uvec2 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_3c7ba5() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_3c7ba5();
+}
+
+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/insertBits/3c7ba5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.hlsl
new file mode 100644
index 0000000..027a68f
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << uint2((s).xx)) & uint2((mask).xx)) | (v & uint2((~(mask)).xx)));
+}
+
+void insertBits_3c7ba5() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_3c7ba5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_3c7ba5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_3c7ba5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl
new file mode 100644
index 0000000..fb8a854
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint2 tint_insert_bits(uint2 v, uint2 n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_3c7ba5() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_3c7ba5();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_3c7ba5();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_3c7ba5();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm
new file mode 100644
index 0000000..801c089
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_3c7ba5 "insertBits_3c7ba5"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2uint = OpTypeVector %uint 2
+ %9 = OpTypeFunction %v2uint %v2uint %v2uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %29 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %36 = OpConstantNull %uint
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %v2uint None %9
+ %v = OpFunctionParameter %v2uint
+ %n = OpFunctionParameter %v2uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldInsert %v2uint %v %n %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%insertBits_3c7ba5 = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %29
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %29
+ %arg_2 = OpVariable %_ptr_Function_uint Function %36
+ %arg_3 = OpVariable %_ptr_Function_uint Function %36
+ %res = OpVariable %_ptr_Function_v2uint Function %29
+ OpStore %arg_0 %29
+ OpStore %arg_1 %29
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %39 = OpLoad %v2uint %arg_0
+ %40 = OpLoad %v2uint %arg_1
+ %41 = OpLoad %uint %arg_2
+ %42 = OpLoad %uint %arg_3
+ %38 = OpFunctionCall %v2uint %tint_insert_bits %39 %40 %41 %42
+ OpStore %res %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %insertBits_3c7ba5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %insertBits_3c7ba5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %insertBits_3c7ba5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl
new file mode 100644
index 0000000..d8fb021
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/3c7ba5.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_3c7ba5() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec2<u32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_3c7ba5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_3c7ba5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_3c7ba5();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl
new file mode 100644
index 0000000..4e97da1
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(vec<3, i32>, vec<3, i32>, u32, u32) -> vec<3, i32>
+fn insertBits_428b0b() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec3<i32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_428b0b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_428b0b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_428b0b();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl
new file mode 100644
index 0000000..1bda33f
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_428b0b() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_428b0b();
+ 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;
+
+ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_428b0b() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_428b0b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec3 tint_insert_bits(ivec3 v, ivec3 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_428b0b() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_428b0b();
+}
+
+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/insertBits/428b0b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.hlsl
new file mode 100644
index 0000000..20225c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << uint3((s).xxx)) & int3((int(mask)).xxx)) | (v & int3((int(~(mask))).xxx)));
+}
+
+void insertBits_428b0b() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_428b0b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_428b0b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_428b0b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl
new file mode 100644
index 0000000..6c8fd4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int3 tint_insert_bits(int3 v, int3 n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_428b0b() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_428b0b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_428b0b();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_428b0b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm
new file mode 100644
index 0000000..3de50bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.spvasm
@@ -0,0 +1,108 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_428b0b "insertBits_428b0b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %v3int %v3int %v3int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %26 = OpTypeFunction %void
+ %30 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %37 = OpConstantNull %uint
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %v3int None %9
+ %v = OpFunctionParameter %v3int
+ %n = OpFunctionParameter %v3int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %18 = OpLabel
+ %19 = OpExtInst %uint %20 UMin %offset %uint_32
+ %23 = OpIAdd %uint %19 %count
+ %22 = OpExtInst %uint %20 UMin %uint_32 %23
+ %25 = OpISub %uint %22 %19
+ %24 = OpBitFieldInsert %v3int %v %n %19 %25
+ OpReturnValue %24
+ OpFunctionEnd
+%insertBits_428b0b = OpFunction %void None %26
+ %29 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %30
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %30
+ %arg_2 = OpVariable %_ptr_Function_uint Function %37
+ %arg_3 = OpVariable %_ptr_Function_uint Function %37
+ %res = OpVariable %_ptr_Function_v3int Function %30
+ OpStore %arg_0 %30
+ OpStore %arg_1 %30
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %40 = OpLoad %v3int %arg_0
+ %41 = OpLoad %v3int %arg_1
+ %42 = OpLoad %uint %arg_2
+ %43 = OpLoad %uint %arg_3
+ %39 = OpFunctionCall %v3int %tint_insert_bits %40 %41 %42 %43
+ OpStore %res %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %insertBits_428b0b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %26
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %26
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %insertBits_428b0b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %26
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %insertBits_428b0b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl
new file mode 100644
index 0000000..2dbf357
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/428b0b.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_428b0b() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec3<i32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_428b0b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_428b0b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_428b0b();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl
new file mode 100644
index 0000000..0d1a93d
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(vec<4, u32>, vec<4, u32>, u32, u32) -> vec<4, u32>
+fn insertBits_51ede1() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec4<u32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_51ede1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_51ede1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_51ede1();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl
new file mode 100644
index 0000000..e2a8070
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_51ede1() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_51ede1();
+ 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;
+
+uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_51ede1() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_51ede1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec4 tint_insert_bits(uvec4 v, uvec4 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_51ede1() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_51ede1();
+}
+
+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/insertBits/51ede1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.hlsl
new file mode 100644
index 0000000..d4a9778
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << uint4((s).xxxx)) & uint4((mask).xxxx)) | (v & uint4((~(mask)).xxxx)));
+}
+
+void insertBits_51ede1() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_51ede1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_51ede1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_51ede1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl
new file mode 100644
index 0000000..7f65c99
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint4 tint_insert_bits(uint4 v, uint4 n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_51ede1() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_51ede1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_51ede1();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_51ede1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm
new file mode 100644
index 0000000..da0edfc
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_51ede1 "insertBits_51ede1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4uint = OpTypeVector %uint 4
+ %9 = OpTypeFunction %v4uint %v4uint %v4uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %29 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %36 = OpConstantNull %uint
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %v4uint None %9
+ %v = OpFunctionParameter %v4uint
+ %n = OpFunctionParameter %v4uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldInsert %v4uint %v %n %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%insertBits_51ede1 = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %29
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %29
+ %arg_2 = OpVariable %_ptr_Function_uint Function %36
+ %arg_3 = OpVariable %_ptr_Function_uint Function %36
+ %res = OpVariable %_ptr_Function_v4uint Function %29
+ OpStore %arg_0 %29
+ OpStore %arg_1 %29
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %39 = OpLoad %v4uint %arg_0
+ %40 = OpLoad %v4uint %arg_1
+ %41 = OpLoad %uint %arg_2
+ %42 = OpLoad %uint %arg_3
+ %38 = OpFunctionCall %v4uint %tint_insert_bits %39 %40 %41 %42
+ OpStore %res %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %insertBits_51ede1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %insertBits_51ede1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %insertBits_51ede1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl
new file mode 100644
index 0000000..169d426
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/51ede1.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_51ede1() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec4<u32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_51ede1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_51ede1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_51ede1();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl
new file mode 100644
index 0000000..1d9618f
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(i32, i32, u32, u32) -> i32
+fn insertBits_65468b() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: i32 = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_65468b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_65468b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_65468b();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl
new file mode 100644
index 0000000..8d9614e
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+int tint_insert_bits(int v, int n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_65468b() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_65468b();
+ 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;
+
+int tint_insert_bits(int v, int n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_65468b() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_65468b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+int tint_insert_bits(int v, int n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_65468b() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_65468b();
+}
+
+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/insertBits/65468b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.hlsl
new file mode 100644
index 0000000..f87cc19
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int tint_insert_bits(int v, int n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << s) & int(mask)) | (v & int(~(mask))));
+}
+
+void insertBits_65468b() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_65468b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_65468b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_65468b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl
new file mode 100644
index 0000000..21411f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int tint_insert_bits(int v, int n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_65468b() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_65468b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_65468b();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_65468b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm
new file mode 100644
index 0000000..3d4e69f
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.spvasm
@@ -0,0 +1,108 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_65468b "insertBits_65468b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %int %int %int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %32 = OpConstantNull %int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %37 = OpConstantNull %uint
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %int None %9
+ %v = OpFunctionParameter %int
+ %n = OpFunctionParameter %int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldInsert %int %v %n %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%insertBits_65468b = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %32
+ %arg_1 = OpVariable %_ptr_Function_int Function %32
+ %arg_2 = OpVariable %_ptr_Function_uint Function %37
+ %arg_3 = OpVariable %_ptr_Function_uint Function %37
+ %res = OpVariable %_ptr_Function_int Function %32
+ OpStore %arg_0 %int_1
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %40 = OpLoad %int %arg_0
+ %41 = OpLoad %int %arg_1
+ %42 = OpLoad %uint %arg_2
+ %43 = OpLoad %uint %arg_3
+ %39 = OpFunctionCall %int %tint_insert_bits %40 %41 %42 %43
+ OpStore %res %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %insertBits_65468b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %insertBits_65468b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %insertBits_65468b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl
new file mode 100644
index 0000000..cee6ffe
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/65468b.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_65468b() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : i32 = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_65468b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_65468b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_65468b();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl
new file mode 100644
index 0000000..6f1fca8
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(vec<3, u32>, vec<3, u32>, u32, u32) -> vec<3, u32>
+fn insertBits_87826b() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec3<u32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_87826b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_87826b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_87826b();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl
new file mode 100644
index 0000000..3c9a3ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_87826b() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_87826b();
+ 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;
+
+uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_87826b() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_87826b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uvec3 tint_insert_bits(uvec3 v, uvec3 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_87826b() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uvec3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_87826b();
+}
+
+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/insertBits/87826b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.hlsl
new file mode 100644
index 0000000..c7b4134
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << uint3((s).xxx)) & uint3((mask).xxx)) | (v & uint3((~(mask)).xxx)));
+}
+
+void insertBits_87826b() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_87826b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_87826b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_87826b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl
new file mode 100644
index 0000000..7c093e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint3 tint_insert_bits(uint3 v, uint3 n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_87826b() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint3 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_87826b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_87826b();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_87826b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm
new file mode 100644
index 0000000..397311e
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 58
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_87826b "insertBits_87826b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v3uint = OpTypeVector %uint 3
+ %9 = OpTypeFunction %v3uint %v3uint %v3uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
+ %29 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %36 = OpConstantNull %uint
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %v3uint None %9
+ %v = OpFunctionParameter %v3uint
+ %n = OpFunctionParameter %v3uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %17 = OpLabel
+ %18 = OpExtInst %uint %19 UMin %offset %uint_32
+ %22 = OpIAdd %uint %18 %count
+ %21 = OpExtInst %uint %19 UMin %uint_32 %22
+ %24 = OpISub %uint %21 %18
+ %23 = OpBitFieldInsert %v3uint %v %n %18 %24
+ OpReturnValue %23
+ OpFunctionEnd
+%insertBits_87826b = OpFunction %void None %25
+ %28 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %29
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %29
+ %arg_2 = OpVariable %_ptr_Function_uint Function %36
+ %arg_3 = OpVariable %_ptr_Function_uint Function %36
+ %res = OpVariable %_ptr_Function_v3uint Function %29
+ OpStore %arg_0 %29
+ OpStore %arg_1 %29
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %39 = OpLoad %v3uint %arg_0
+ %40 = OpLoad %v3uint %arg_1
+ %41 = OpLoad %uint %arg_2
+ %42 = OpLoad %uint %arg_3
+ %38 = OpFunctionCall %v3uint %tint_insert_bits %39 %40 %41 %42
+ OpStore %res %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %insertBits_87826b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %insertBits_87826b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %25
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %insertBits_87826b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl
new file mode 100644
index 0000000..48253d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/87826b.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_87826b() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec3<u32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_87826b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_87826b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_87826b();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl
new file mode 100644
index 0000000..db30069
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(vec<4, i32>, vec<4, i32>, u32, u32) -> vec<4, i32>
+fn insertBits_d86978() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec4<i32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_d86978();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_d86978();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_d86978();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl
new file mode 100644
index 0000000..ac28a7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_d86978() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_d86978();
+ 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;
+
+ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_d86978() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_d86978();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec4 tint_insert_bits(ivec4 v, ivec4 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_d86978() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_d86978();
+}
+
+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/insertBits/d86978.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.hlsl
new file mode 100644
index 0000000..a6689bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << uint4((s).xxxx)) & int4((int(mask)).xxxx)) | (v & int4((int(~(mask))).xxxx)));
+}
+
+void insertBits_d86978() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_d86978();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_d86978();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_d86978();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl
new file mode 100644
index 0000000..7cb5abc
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int4 tint_insert_bits(int4 v, int4 n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_d86978() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int4 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_d86978();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_d86978();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_d86978();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm
new file mode 100644
index 0000000..9591bbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.spvasm
@@ -0,0 +1,108 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_d86978 "insertBits_d86978"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v4int = OpTypeVector %int 4
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %v4int %v4int %v4int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %26 = OpTypeFunction %void
+ %30 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %37 = OpConstantNull %uint
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %v4int None %9
+ %v = OpFunctionParameter %v4int
+ %n = OpFunctionParameter %v4int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %18 = OpLabel
+ %19 = OpExtInst %uint %20 UMin %offset %uint_32
+ %23 = OpIAdd %uint %19 %count
+ %22 = OpExtInst %uint %20 UMin %uint_32 %23
+ %25 = OpISub %uint %22 %19
+ %24 = OpBitFieldInsert %v4int %v %n %19 %25
+ OpReturnValue %24
+ OpFunctionEnd
+%insertBits_d86978 = OpFunction %void None %26
+ %29 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %30
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %30
+ %arg_2 = OpVariable %_ptr_Function_uint Function %37
+ %arg_3 = OpVariable %_ptr_Function_uint Function %37
+ %res = OpVariable %_ptr_Function_v4int Function %30
+ OpStore %arg_0 %30
+ OpStore %arg_1 %30
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %40 = OpLoad %v4int %arg_0
+ %41 = OpLoad %v4int %arg_1
+ %42 = OpLoad %uint %arg_2
+ %43 = OpLoad %uint %arg_3
+ %39 = OpFunctionCall %v4int %tint_insert_bits %40 %41 %42 %43
+ OpStore %res %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %insertBits_d86978
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %26
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %26
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %insertBits_d86978
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %26
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %insertBits_d86978
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl
new file mode 100644
index 0000000..0678533
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/d86978.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_d86978() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec4<i32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_d86978();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_d86978();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_d86978();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl
new file mode 100644
index 0000000..82178dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(u32, u32, u32, u32) -> u32
+fn insertBits_e3e3a2() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: u32 = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_e3e3a2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_e3e3a2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_e3e3a2();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl
new file mode 100644
index 0000000..07f56be
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_e3e3a2() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_e3e3a2();
+ 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;
+
+uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_e3e3a2() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_e3e3a2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_e3e3a2() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_e3e3a2();
+}
+
+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/insertBits/e3e3a2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.hlsl
new file mode 100644
index 0000000..cfbbeee
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << s) & mask) | (v & ~(mask)));
+}
+
+void insertBits_e3e3a2() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_e3e3a2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_e3e3a2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_e3e3a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl
new file mode 100644
index 0000000..20a4950
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+uint tint_insert_bits(uint v, uint n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_e3e3a2() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ uint res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_e3e3a2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_e3e3a2();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_e3e3a2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm
new file mode 100644
index 0000000..17e63b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.spvasm
@@ -0,0 +1,104 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 55
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_e3e3a2 "insertBits_e3e3a2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %9 = OpTypeFunction %uint %uint %uint %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %31 = OpConstantNull %uint
+ %41 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %uint None %9
+ %v = OpFunctionParameter %uint
+ %n = OpFunctionParameter %uint
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %16 = OpLabel
+ %17 = OpExtInst %uint %18 UMin %offset %uint_32
+ %21 = OpIAdd %uint %17 %count
+ %20 = OpExtInst %uint %18 UMin %uint_32 %21
+ %23 = OpISub %uint %20 %17
+ %22 = OpBitFieldInsert %uint %v %n %17 %23
+ OpReturnValue %22
+ OpFunctionEnd
+%insertBits_e3e3a2 = OpFunction %void None %24
+ %27 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %31
+ %arg_1 = OpVariable %_ptr_Function_uint Function %31
+ %arg_2 = OpVariable %_ptr_Function_uint Function %31
+ %arg_3 = OpVariable %_ptr_Function_uint Function %31
+ %res = OpVariable %_ptr_Function_uint Function %31
+ OpStore %arg_0 %uint_1
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %36 = OpLoad %uint %arg_0
+ %37 = OpLoad %uint %arg_1
+ %38 = OpLoad %uint %arg_2
+ %39 = OpLoad %uint %arg_3
+ %35 = OpFunctionCall %uint %tint_insert_bits %36 %37 %38 %39
+ OpStore %res %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %41
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %insertBits_e3e3a2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %47
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %insertBits_e3e3a2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %24
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %insertBits_e3e3a2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl
new file mode 100644
index 0000000..a11ca1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/e3e3a2.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_e3e3a2() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : u32 = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_e3e3a2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_e3e3a2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_e3e3a2();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl
new file mode 100644
index 0000000..1d1b8b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn insertBits(vec<2, i32>, vec<2, i32>, u32, u32) -> vec<2, i32>
+fn insertBits_fe6ba6() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res: vec2<i32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_fe6ba6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_fe6ba6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_fe6ba6();
+}
diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl
new file mode 100644
index 0000000..2cfb3a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.glsl
@@ -0,0 +1,79 @@
+#version 310 es
+
+ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_fe6ba6() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ insertBits_fe6ba6();
+ 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;
+
+ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_fe6ba6() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ insertBits_fe6ba6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+ivec2 tint_insert_bits(ivec2 v, ivec2 n, uint offset, uint count) {
+ uint s = min(offset, 32u);
+ uint e = min(32u, (s + count));
+ return bitfieldInsert(v, n, int(s), int((e - s)));
+}
+
+void insertBits_fe6ba6() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ ivec2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ insertBits_fe6ba6();
+}
+
+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/insertBits/fe6ba6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.hlsl
new file mode 100644
index 0000000..c00768b
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.hlsl
@@ -0,0 +1,41 @@
+int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) {
+ const uint s = min(offset, 32u);
+ const uint e = min(32u, (s + count));
+ const uint mask = (((1u << s) - 1u) ^ ((1u << e) - 1u));
+ return (((n << uint2((s).xx)) & int2((int(mask)).xx)) | (v & int2((int(~(mask))).xx)));
+}
+
+void insertBits_fe6ba6() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ insertBits_fe6ba6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ insertBits_fe6ba6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ insertBits_fe6ba6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl
new file mode 100644
index 0000000..da47190
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.msl
@@ -0,0 +1,43 @@
+#include <metal_stdlib>
+
+using namespace metal;
+int2 tint_insert_bits(int2 v, int2 n, uint offset, uint count) {
+ uint const s = min(offset, 32u);
+ uint const e = min(32u, (s + count));
+ return insert_bits(v, n, s, (e - s));
+}
+
+void insertBits_fe6ba6() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ uint arg_2 = 1u;
+ uint arg_3 = 1u;
+ int2 res = tint_insert_bits(arg_0, arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ insertBits_fe6ba6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ insertBits_fe6ba6();
+ return;
+}
+
+kernel void compute_main() {
+ insertBits_fe6ba6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm
new file mode 100644
index 0000000..e67ff06
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.spvasm
@@ -0,0 +1,108 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %tint_insert_bits "tint_insert_bits"
+ OpName %v "v"
+ OpName %n "n"
+ OpName %offset "offset"
+ OpName %count "count"
+ OpName %insertBits_fe6ba6 "insertBits_fe6ba6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %v2int = OpTypeVector %int 2
+ %uint = OpTypeInt 32 0
+ %9 = OpTypeFunction %v2int %v2int %v2int %uint %uint
+ %uint_32 = OpConstant %uint 32
+ %void = OpTypeVoid
+ %26 = OpTypeFunction %void
+ %30 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %37 = OpConstantNull %uint
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tint_insert_bits = OpFunction %v2int None %9
+ %v = OpFunctionParameter %v2int
+ %n = OpFunctionParameter %v2int
+ %offset = OpFunctionParameter %uint
+ %count = OpFunctionParameter %uint
+ %18 = OpLabel
+ %19 = OpExtInst %uint %20 UMin %offset %uint_32
+ %23 = OpIAdd %uint %19 %count
+ %22 = OpExtInst %uint %20 UMin %uint_32 %23
+ %25 = OpISub %uint %22 %19
+ %24 = OpBitFieldInsert %v2int %v %n %19 %25
+ OpReturnValue %24
+ OpFunctionEnd
+%insertBits_fe6ba6 = OpFunction %void None %26
+ %29 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %30
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %30
+ %arg_2 = OpVariable %_ptr_Function_uint Function %37
+ %arg_3 = OpVariable %_ptr_Function_uint Function %37
+ %res = OpVariable %_ptr_Function_v2int Function %30
+ OpStore %arg_0 %30
+ OpStore %arg_1 %30
+ OpStore %arg_2 %uint_1
+ OpStore %arg_3 %uint_1
+ %40 = OpLoad %v2int %arg_0
+ %41 = OpLoad %v2int %arg_1
+ %42 = OpLoad %uint %arg_2
+ %43 = OpLoad %uint %arg_3
+ %39 = OpFunctionCall %v2int %tint_insert_bits %40 %41 %42 %43
+ OpStore %res %39
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %insertBits_fe6ba6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %26
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %26
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %insertBits_fe6ba6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %26
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %insertBits_fe6ba6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl
new file mode 100644
index 0000000..13f8c15
--- /dev/null
+++ b/test/tint/builtins/gen/var/insertBits/fe6ba6.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+fn insertBits_fe6ba6() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1u;
+ var arg_3 = 1u;
+ var res : vec2<i32> = insertBits(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ insertBits_fe6ba6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ insertBits_fe6ba6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ insertBits_fe6ba6();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl
new file mode 100644
index 0000000..a5dabf6
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(f32) -> f32
+fn inverseSqrt_84407e() {
+ var arg_0 = 1.0;
+ var res: f32 = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_84407e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_84407e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_84407e();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl
new file mode 100644
index 0000000..9ddc694
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void inverseSqrt_84407e() {
+ float arg_0 = 1.0f;
+ float res = inversesqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_84407e();
+ 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;
+
+void inverseSqrt_84407e() {
+ float arg_0 = 1.0f;
+ float res = inversesqrt(arg_0);
+}
+
+void fragment_main() {
+ inverseSqrt_84407e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_84407e() {
+ float arg_0 = 1.0f;
+ float res = inversesqrt(arg_0);
+}
+
+void compute_main() {
+ inverseSqrt_84407e();
+}
+
+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/inverseSqrt/84407e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.hlsl
new file mode 100644
index 0000000..97c63e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void inverseSqrt_84407e() {
+ float arg_0 = 1.0f;
+ float res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_84407e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_84407e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_84407e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl
new file mode 100644
index 0000000..61e9b67
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_84407e() {
+ float arg_0 = 1.0f;
+ float res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_84407e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_84407e();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_84407e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm
new file mode 100644
index 0000000..c350373
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %inverseSqrt_84407e "inverseSqrt_84407e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%inverseSqrt_84407e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 InverseSqrt %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %inverseSqrt_84407e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %inverseSqrt_84407e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %inverseSqrt_84407e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl
new file mode 100644
index 0000000..f86db02
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/84407e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_84407e() {
+ var arg_0 = 1.0;
+ var res : f32 = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_84407e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_84407e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_84407e();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl
new file mode 100644
index 0000000..2f093e92d
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(vec<2, f32>) -> vec<2, f32>
+fn inverseSqrt_8f2bd2() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_8f2bd2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_8f2bd2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_8f2bd2();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl
new file mode 100644
index 0000000..c84d6e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void inverseSqrt_8f2bd2() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = inversesqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_8f2bd2();
+ 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;
+
+void inverseSqrt_8f2bd2() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = inversesqrt(arg_0);
+}
+
+void fragment_main() {
+ inverseSqrt_8f2bd2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_8f2bd2() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = inversesqrt(arg_0);
+}
+
+void compute_main() {
+ inverseSqrt_8f2bd2();
+}
+
+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/inverseSqrt/8f2bd2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.hlsl
new file mode 100644
index 0000000..88d14d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void inverseSqrt_8f2bd2() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_8f2bd2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_8f2bd2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_8f2bd2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl
new file mode 100644
index 0000000..3d79e94
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_8f2bd2() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_8f2bd2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_8f2bd2();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_8f2bd2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm
new file mode 100644
index 0000000..36b4d361
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %inverseSqrt_8f2bd2 "inverseSqrt_8f2bd2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%inverseSqrt_8f2bd2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 InverseSqrt %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %inverseSqrt_8f2bd2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %inverseSqrt_8f2bd2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %inverseSqrt_8f2bd2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl
new file mode 100644
index 0000000..74b8db5
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/8f2bd2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_8f2bd2() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_8f2bd2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_8f2bd2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_8f2bd2();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl
new file mode 100644
index 0000000..c4b0947
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(vec<3, f32>) -> vec<3, f32>
+fn inverseSqrt_b197b1() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_b197b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_b197b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_b197b1();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl
new file mode 100644
index 0000000..f44044d
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void inverseSqrt_b197b1() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = inversesqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_b197b1();
+ 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;
+
+void inverseSqrt_b197b1() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = inversesqrt(arg_0);
+}
+
+void fragment_main() {
+ inverseSqrt_b197b1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_b197b1() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = inversesqrt(arg_0);
+}
+
+void compute_main() {
+ inverseSqrt_b197b1();
+}
+
+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/inverseSqrt/b197b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.hlsl
new file mode 100644
index 0000000..eeeabc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void inverseSqrt_b197b1() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_b197b1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_b197b1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_b197b1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl
new file mode 100644
index 0000000..d31ca3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_b197b1() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_b197b1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_b197b1();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_b197b1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm
new file mode 100644
index 0000000..aac400f
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %inverseSqrt_b197b1 "inverseSqrt_b197b1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%inverseSqrt_b197b1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 InverseSqrt %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %inverseSqrt_b197b1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %inverseSqrt_b197b1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %inverseSqrt_b197b1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl
new file mode 100644
index 0000000..092b101
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/b197b1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_b197b1() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_b197b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_b197b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_b197b1();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl
new file mode 100644
index 0000000..9fa254c
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn inverseSqrt(vec<4, f32>) -> vec<4, f32>
+fn inverseSqrt_c22347() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_c22347();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_c22347();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_c22347();
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl
new file mode 100644
index 0000000..4665d41
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void inverseSqrt_c22347() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = inversesqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ inverseSqrt_c22347();
+ 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;
+
+void inverseSqrt_c22347() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = inversesqrt(arg_0);
+}
+
+void fragment_main() {
+ inverseSqrt_c22347();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void inverseSqrt_c22347() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = inversesqrt(arg_0);
+}
+
+void compute_main() {
+ inverseSqrt_c22347();
+}
+
+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/inverseSqrt/c22347.wgsl.expected.hlsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.hlsl
new file mode 100644
index 0000000..70323e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void inverseSqrt_c22347() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_c22347();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ inverseSqrt_c22347();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ inverseSqrt_c22347();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl
new file mode 100644
index 0000000..01d5eea
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void inverseSqrt_c22347() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = rsqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ inverseSqrt_c22347();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ inverseSqrt_c22347();
+ return;
+}
+
+kernel void compute_main() {
+ inverseSqrt_c22347();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm
new file mode 100644
index 0000000..ed02dc6
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %inverseSqrt_c22347 "inverseSqrt_c22347"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%inverseSqrt_c22347 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 InverseSqrt %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %inverseSqrt_c22347
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %inverseSqrt_c22347
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %inverseSqrt_c22347
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl
new file mode 100644
index 0000000..fb2b23a
--- /dev/null
+++ b/test/tint/builtins/gen/var/inverseSqrt/c22347.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn inverseSqrt_c22347() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = inverseSqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ inverseSqrt_c22347();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ inverseSqrt_c22347();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ inverseSqrt_c22347();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl
new file mode 100644
index 0000000..0b2123a
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ldexp(vec<3, f32>, vec<3, i32>) -> vec<3, f32>
+fn ldexp_a31cdc() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<i32>();
+ var res: vec3<f32> = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_a31cdc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_a31cdc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_a31cdc();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl
new file mode 100644
index 0000000..6336a2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void ldexp_a31cdc() {
+ vec3 arg_0 = vec3(0.0f);
+ ivec3 arg_1 = ivec3(0);
+ vec3 res = ldexp(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ ldexp_a31cdc();
+ 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;
+
+void ldexp_a31cdc() {
+ vec3 arg_0 = vec3(0.0f);
+ ivec3 arg_1 = ivec3(0);
+ vec3 res = ldexp(arg_0, arg_1);
+}
+
+void fragment_main() {
+ ldexp_a31cdc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ldexp_a31cdc() {
+ vec3 arg_0 = vec3(0.0f);
+ ivec3 arg_1 = ivec3(0);
+ vec3 res = ldexp(arg_0, arg_1);
+}
+
+void compute_main() {
+ ldexp_a31cdc();
+}
+
+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/ldexp/a31cdc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.hlsl
new file mode 100644
index 0000000..206b643
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void ldexp_a31cdc() {
+ float3 arg_0 = (0.0f).xxx;
+ int3 arg_1 = (0).xxx;
+ float3 res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ldexp_a31cdc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ldexp_a31cdc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ldexp_a31cdc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl
new file mode 100644
index 0000000..1d81f5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ldexp_a31cdc() {
+ float3 arg_0 = float3(0.0f);
+ int3 arg_1 = int3(0);
+ float3 res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ldexp_a31cdc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ldexp_a31cdc();
+ return;
+}
+
+kernel void compute_main() {
+ ldexp_a31cdc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm
new file mode 100644
index 0000000..83ab21b
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ %23 = OpExtInstImport "GLSL.std.450"
+ 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 %ldexp_a31cdc "ldexp_a31cdc"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%ldexp_a31cdc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %19
+ %24 = OpLoad %v3float %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %22 = OpExtInst %v3float %23 Ldexp %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %ldexp_a31cdc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %ldexp_a31cdc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %ldexp_a31cdc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl
new file mode 100644
index 0000000..ff1f93b
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/a31cdc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn ldexp_a31cdc() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<i32>();
+ var res : vec3<f32> = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_a31cdc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_a31cdc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_a31cdc();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl
new file mode 100644
index 0000000..fa363d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ldexp(vec<2, f32>, vec<2, i32>) -> vec<2, f32>
+fn ldexp_abd718() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<i32>();
+ var res: vec2<f32> = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_abd718();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_abd718();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_abd718();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl
new file mode 100644
index 0000000..da03c14
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void ldexp_abd718() {
+ vec2 arg_0 = vec2(0.0f);
+ ivec2 arg_1 = ivec2(0);
+ vec2 res = ldexp(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ ldexp_abd718();
+ 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;
+
+void ldexp_abd718() {
+ vec2 arg_0 = vec2(0.0f);
+ ivec2 arg_1 = ivec2(0);
+ vec2 res = ldexp(arg_0, arg_1);
+}
+
+void fragment_main() {
+ ldexp_abd718();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ldexp_abd718() {
+ vec2 arg_0 = vec2(0.0f);
+ ivec2 arg_1 = ivec2(0);
+ vec2 res = ldexp(arg_0, arg_1);
+}
+
+void compute_main() {
+ ldexp_abd718();
+}
+
+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/ldexp/abd718.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.hlsl
new file mode 100644
index 0000000..5399f52
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void ldexp_abd718() {
+ float2 arg_0 = (0.0f).xx;
+ int2 arg_1 = (0).xx;
+ float2 res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ldexp_abd718();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ldexp_abd718();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ldexp_abd718();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl
new file mode 100644
index 0000000..b924eeb
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ldexp_abd718() {
+ float2 arg_0 = float2(0.0f);
+ int2 arg_1 = int2(0);
+ float2 res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ldexp_abd718();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ldexp_abd718();
+ return;
+}
+
+kernel void compute_main() {
+ ldexp_abd718();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm
new file mode 100644
index 0000000..168ae69
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ %23 = OpExtInstImport "GLSL.std.450"
+ 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 %ldexp_abd718 "ldexp_abd718"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %19 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%ldexp_abd718 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %19
+ %24 = OpLoad %v2float %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %22 = OpExtInst %v2float %23 Ldexp %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %ldexp_abd718
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %ldexp_abd718
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %ldexp_abd718
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl
new file mode 100644
index 0000000..436192c
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/abd718.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn ldexp_abd718() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<i32>();
+ var res : vec2<f32> = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_abd718();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_abd718();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_abd718();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl
new file mode 100644
index 0000000..2f89342
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ldexp(vec<4, f32>, vec<4, i32>) -> vec<4, f32>
+fn ldexp_cc9cde() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<i32>();
+ var res: vec4<f32> = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_cc9cde();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_cc9cde();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_cc9cde();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl
new file mode 100644
index 0000000..c31b73b
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void ldexp_cc9cde() {
+ vec4 arg_0 = vec4(0.0f);
+ ivec4 arg_1 = ivec4(0);
+ vec4 res = ldexp(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ ldexp_cc9cde();
+ 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;
+
+void ldexp_cc9cde() {
+ vec4 arg_0 = vec4(0.0f);
+ ivec4 arg_1 = ivec4(0);
+ vec4 res = ldexp(arg_0, arg_1);
+}
+
+void fragment_main() {
+ ldexp_cc9cde();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ldexp_cc9cde() {
+ vec4 arg_0 = vec4(0.0f);
+ ivec4 arg_1 = ivec4(0);
+ vec4 res = ldexp(arg_0, arg_1);
+}
+
+void compute_main() {
+ ldexp_cc9cde();
+}
+
+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/ldexp/cc9cde.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.hlsl
new file mode 100644
index 0000000..f922163
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void ldexp_cc9cde() {
+ float4 arg_0 = (0.0f).xxxx;
+ int4 arg_1 = (0).xxxx;
+ float4 res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ldexp_cc9cde();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ldexp_cc9cde();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ldexp_cc9cde();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl
new file mode 100644
index 0000000..93c2d23
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ldexp_cc9cde() {
+ float4 arg_0 = float4(0.0f);
+ int4 arg_1 = int4(0);
+ float4 res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ldexp_cc9cde();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ldexp_cc9cde();
+ return;
+}
+
+kernel void compute_main() {
+ ldexp_cc9cde();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm
new file mode 100644
index 0000000..3d6fe28
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %21 = OpExtInstImport "GLSL.std.450"
+ 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 %ldexp_cc9cde "ldexp_cc9cde"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %17 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%ldexp_cc9cde = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %17
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %17
+ %22 = OpLoad %v4float %arg_0
+ %23 = OpLoad %v4int %arg_1
+ %20 = OpExtInst %v4float %21 Ldexp %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %ldexp_cc9cde
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %ldexp_cc9cde
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %ldexp_cc9cde
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl
new file mode 100644
index 0000000..f24c970
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/cc9cde.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn ldexp_cc9cde() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<i32>();
+ var res : vec4<f32> = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_cc9cde();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_cc9cde();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_cc9cde();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl
new file mode 100644
index 0000000..140cef6
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn ldexp(f32, i32) -> f32
+fn ldexp_db8b49() {
+ var arg_0 = 1.0;
+ var arg_1 = 1;
+ var res: f32 = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_db8b49();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_db8b49();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_db8b49();
+}
diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl
new file mode 100644
index 0000000..72e0972
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void ldexp_db8b49() {
+ float arg_0 = 1.0f;
+ int arg_1 = 1;
+ float res = ldexp(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ ldexp_db8b49();
+ 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;
+
+void ldexp_db8b49() {
+ float arg_0 = 1.0f;
+ int arg_1 = 1;
+ float res = ldexp(arg_0, arg_1);
+}
+
+void fragment_main() {
+ ldexp_db8b49();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void ldexp_db8b49() {
+ float arg_0 = 1.0f;
+ int arg_1 = 1;
+ float res = ldexp(arg_0, arg_1);
+}
+
+void compute_main() {
+ ldexp_db8b49();
+}
+
+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/ldexp/db8b49.wgsl.expected.hlsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.hlsl
new file mode 100644
index 0000000..9f62531
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void ldexp_db8b49() {
+ float arg_0 = 1.0f;
+ int arg_1 = 1;
+ float res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ ldexp_db8b49();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ ldexp_db8b49();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ ldexp_db8b49();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl
new file mode 100644
index 0000000..e980316
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void ldexp_db8b49() {
+ float arg_0 = 1.0f;
+ int arg_1 = 1;
+ float res = ldexp(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ ldexp_db8b49();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ ldexp_db8b49();
+ return;
+}
+
+kernel void compute_main() {
+ ldexp_db8b49();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm
new file mode 100644
index 0000000..0a22486
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %22 = OpExtInstImport "GLSL.std.450"
+ 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 %ldexp_db8b49 "ldexp_db8b49"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %26 = OpTypeFunction %v4float
+%ldexp_db8b49 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %int_1
+ %23 = OpLoad %float %arg_0
+ %24 = OpLoad %int %arg_1
+ %21 = OpExtInst %float %22 Ldexp %23 %24
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %ldexp_db8b49
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %ldexp_db8b49
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %ldexp_db8b49
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl
new file mode 100644
index 0000000..764a162
--- /dev/null
+++ b/test/tint/builtins/gen/var/ldexp/db8b49.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn ldexp_db8b49() {
+ var arg_0 = 1.0;
+ var arg_1 = 1;
+ var res : f32 = ldexp(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ ldexp_db8b49();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ ldexp_db8b49();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ ldexp_db8b49();
+}
diff --git a/test/tint/builtins/gen/var/length/056071.wgsl b/test/tint/builtins/gen/var/length/056071.wgsl
new file mode 100644
index 0000000..683f511
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/056071.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn length(vec<3, f32>) -> f32
+fn length_056071() {
+ var arg_0 = vec3<f32>();
+ var res: f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_056071();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_056071();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_056071();
+}
diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl
new file mode 100644
index 0000000..f4f3920
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void length_056071() {
+ vec3 arg_0 = vec3(0.0f);
+ float res = length(arg_0);
+}
+
+vec4 vertex_main() {
+ length_056071();
+ 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;
+
+void length_056071() {
+ vec3 arg_0 = vec3(0.0f);
+ float res = length(arg_0);
+}
+
+void fragment_main() {
+ length_056071();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void length_056071() {
+ vec3 arg_0 = vec3(0.0f);
+ float res = length(arg_0);
+}
+
+void compute_main() {
+ length_056071();
+}
+
+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/length/056071.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.hlsl
new file mode 100644
index 0000000..bd540fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void length_056071() {
+ float3 arg_0 = (0.0f).xxx;
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ length_056071();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ length_056071();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ length_056071();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl
new file mode 100644
index 0000000..1727b62
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void length_056071() {
+ float3 arg_0 = float3(0.0f);
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ length_056071();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ length_056071();
+ return;
+}
+
+kernel void compute_main() {
+ length_056071();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm
new file mode 100644
index 0000000..fb485c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %length_056071 "length_056071"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%length_056071 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %float %18 Length %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %length_056071
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %length_056071
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %length_056071
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl
new file mode 100644
index 0000000..162ff85
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/056071.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn length_056071() {
+ var arg_0 = vec3<f32>();
+ var res : f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_056071();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_056071();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_056071();
+}
diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl b/test/tint/builtins/gen/var/length/602a17.wgsl
new file mode 100644
index 0000000..6460b7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/602a17.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn length(f32) -> f32
+fn length_602a17() {
+ var arg_0 = 1.0;
+ var res: f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_602a17();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_602a17();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_602a17();
+}
diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl
new file mode 100644
index 0000000..41ad408
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void length_602a17() {
+ float arg_0 = 1.0f;
+ float res = length(arg_0);
+}
+
+vec4 vertex_main() {
+ length_602a17();
+ 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;
+
+void length_602a17() {
+ float arg_0 = 1.0f;
+ float res = length(arg_0);
+}
+
+void fragment_main() {
+ length_602a17();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void length_602a17() {
+ float arg_0 = 1.0f;
+ float res = length(arg_0);
+}
+
+void compute_main() {
+ length_602a17();
+}
+
+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/length/602a17.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.hlsl
new file mode 100644
index 0000000..5f4310e
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void length_602a17() {
+ float arg_0 = 1.0f;
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ length_602a17();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ length_602a17();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ length_602a17();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl
new file mode 100644
index 0000000..a88e9ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void length_602a17() {
+ float arg_0 = 1.0f;
+ float res = fabs(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ length_602a17();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ length_602a17();
+ return;
+}
+
+kernel void compute_main() {
+ length_602a17();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm
new file mode 100644
index 0000000..7d99bcc
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %length_602a17 "length_602a17"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%length_602a17 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Length %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %length_602a17
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %length_602a17
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %length_602a17
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl
new file mode 100644
index 0000000..ad41798
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/602a17.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn length_602a17() {
+ var arg_0 = 1.0;
+ var res : f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_602a17();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_602a17();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_602a17();
+}
diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl b/test/tint/builtins/gen/var/length/afde8b.wgsl
new file mode 100644
index 0000000..ec97606
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/afde8b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn length(vec<2, f32>) -> f32
+fn length_afde8b() {
+ var arg_0 = vec2<f32>();
+ var res: f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_afde8b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_afde8b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_afde8b();
+}
diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl
new file mode 100644
index 0000000..bee8807
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void length_afde8b() {
+ vec2 arg_0 = vec2(0.0f);
+ float res = length(arg_0);
+}
+
+vec4 vertex_main() {
+ length_afde8b();
+ 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;
+
+void length_afde8b() {
+ vec2 arg_0 = vec2(0.0f);
+ float res = length(arg_0);
+}
+
+void fragment_main() {
+ length_afde8b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void length_afde8b() {
+ vec2 arg_0 = vec2(0.0f);
+ float res = length(arg_0);
+}
+
+void compute_main() {
+ length_afde8b();
+}
+
+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/length/afde8b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.hlsl
new file mode 100644
index 0000000..f1ca92a
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void length_afde8b() {
+ float2 arg_0 = (0.0f).xx;
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ length_afde8b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ length_afde8b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ length_afde8b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl
new file mode 100644
index 0000000..ebda0cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void length_afde8b() {
+ float2 arg_0 = float2(0.0f);
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ length_afde8b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ length_afde8b();
+ return;
+}
+
+kernel void compute_main() {
+ length_afde8b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm
new file mode 100644
index 0000000..975439c
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %length_afde8b "length_afde8b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%length_afde8b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %float %18 Length %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %length_afde8b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %length_afde8b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %length_afde8b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl
new file mode 100644
index 0000000..64f028d
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/afde8b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn length_afde8b() {
+ var arg_0 = vec2<f32>();
+ var res : f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_afde8b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_afde8b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_afde8b();
+}
diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl b/test/tint/builtins/gen/var/length/becebf.wgsl
new file mode 100644
index 0000000..0eb0b9d
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/becebf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn length(vec<4, f32>) -> f32
+fn length_becebf() {
+ var arg_0 = vec4<f32>();
+ var res: f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_becebf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_becebf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_becebf();
+}
diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl
new file mode 100644
index 0000000..a87cbf7
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void length_becebf() {
+ vec4 arg_0 = vec4(0.0f);
+ float res = length(arg_0);
+}
+
+vec4 vertex_main() {
+ length_becebf();
+ 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;
+
+void length_becebf() {
+ vec4 arg_0 = vec4(0.0f);
+ float res = length(arg_0);
+}
+
+void fragment_main() {
+ length_becebf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void length_becebf() {
+ vec4 arg_0 = vec4(0.0f);
+ float res = length(arg_0);
+}
+
+void compute_main() {
+ length_becebf();
+}
+
+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/length/becebf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.hlsl
new file mode 100644
index 0000000..e7760dd8
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void length_becebf() {
+ float4 arg_0 = (0.0f).xxxx;
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ length_becebf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ length_becebf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ length_becebf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl
new file mode 100644
index 0000000..6909b06
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void length_becebf() {
+ float4 arg_0 = float4(0.0f);
+ float res = length(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ length_becebf();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ length_becebf();
+ return;
+}
+
+kernel void compute_main() {
+ length_becebf();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm
new file mode 100644
index 0000000..4162c69
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %length_becebf "length_becebf"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%length_becebf = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %float %16 Length %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %length_becebf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %length_becebf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %length_becebf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl
new file mode 100644
index 0000000..c2b2472
--- /dev/null
+++ b/test/tint/builtins/gen/var/length/becebf.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn length_becebf() {
+ var arg_0 = vec4<f32>();
+ var res : f32 = length(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ length_becebf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ length_becebf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ length_becebf();
+}
diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl b/test/tint/builtins/gen/var/log/3da25a.wgsl
new file mode 100644
index 0000000..46e2e0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/3da25a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log(vec<4, f32>) -> vec<4, f32>
+fn log_3da25a() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_3da25a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_3da25a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_3da25a();
+}
diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl
new file mode 100644
index 0000000..8588b4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log_3da25a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = log(arg_0);
+}
+
+vec4 vertex_main() {
+ log_3da25a();
+ 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;
+
+void log_3da25a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = log(arg_0);
+}
+
+void fragment_main() {
+ log_3da25a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log_3da25a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = log(arg_0);
+}
+
+void compute_main() {
+ log_3da25a();
+}
+
+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/log/3da25a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.hlsl
new file mode 100644
index 0000000..59f0949
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log_3da25a() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log_3da25a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log_3da25a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log_3da25a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl
new file mode 100644
index 0000000..f075d85
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log_3da25a() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log_3da25a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log_3da25a();
+ return;
+}
+
+kernel void compute_main() {
+ log_3da25a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm
new file mode 100644
index 0000000..083d12a
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %log_3da25a "log_3da25a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %log_3da25a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Log %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %log_3da25a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %log_3da25a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %log_3da25a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl
new file mode 100644
index 0000000..c4e07fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/3da25a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log_3da25a() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_3da25a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_3da25a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_3da25a();
+}
diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl b/test/tint/builtins/gen/var/log/7114a6.wgsl
new file mode 100644
index 0000000..6acd3f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/7114a6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log(f32) -> f32
+fn log_7114a6() {
+ var arg_0 = 1.0;
+ var res: f32 = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_7114a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_7114a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_7114a6();
+}
diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl
new file mode 100644
index 0000000..cac97bf
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log_7114a6() {
+ float arg_0 = 1.0f;
+ float res = log(arg_0);
+}
+
+vec4 vertex_main() {
+ log_7114a6();
+ 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;
+
+void log_7114a6() {
+ float arg_0 = 1.0f;
+ float res = log(arg_0);
+}
+
+void fragment_main() {
+ log_7114a6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log_7114a6() {
+ float arg_0 = 1.0f;
+ float res = log(arg_0);
+}
+
+void compute_main() {
+ log_7114a6();
+}
+
+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/log/7114a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.hlsl
new file mode 100644
index 0000000..c908d84
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log_7114a6() {
+ float arg_0 = 1.0f;
+ float res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log_7114a6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log_7114a6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log_7114a6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl
new file mode 100644
index 0000000..65aab32
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log_7114a6() {
+ float arg_0 = 1.0f;
+ float res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log_7114a6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log_7114a6();
+ return;
+}
+
+kernel void compute_main() {
+ log_7114a6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm
new file mode 100644
index 0000000..0fab51b
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %log_7114a6 "log_7114a6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %log_7114a6 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Log %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %log_7114a6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %log_7114a6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %log_7114a6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl
new file mode 100644
index 0000000..1c4a1c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/7114a6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log_7114a6() {
+ var arg_0 = 1.0;
+ var res : f32 = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_7114a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_7114a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_7114a6();
+}
diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl
new file mode 100644
index 0000000..429c198
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log(vec<2, f32>) -> vec<2, f32>
+fn log_b2ce28() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_b2ce28();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_b2ce28();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_b2ce28();
+}
diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl
new file mode 100644
index 0000000..b8a85ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log_b2ce28() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = log(arg_0);
+}
+
+vec4 vertex_main() {
+ log_b2ce28();
+ 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;
+
+void log_b2ce28() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = log(arg_0);
+}
+
+void fragment_main() {
+ log_b2ce28();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log_b2ce28() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = log(arg_0);
+}
+
+void compute_main() {
+ log_b2ce28();
+}
+
+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/log/b2ce28.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.hlsl
new file mode 100644
index 0000000..26a04ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log_b2ce28() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log_b2ce28();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log_b2ce28();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log_b2ce28();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl
new file mode 100644
index 0000000..919026d
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log_b2ce28() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log_b2ce28();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log_b2ce28();
+ return;
+}
+
+kernel void compute_main() {
+ log_b2ce28();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm
new file mode 100644
index 0000000..3589004d
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %log_b2ce28 "log_b2ce28"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %log_b2ce28 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Log %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %log_b2ce28
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %log_b2ce28
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %log_b2ce28
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl
new file mode 100644
index 0000000..9a3b8f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/b2ce28.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log_b2ce28() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_b2ce28();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_b2ce28();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_b2ce28();
+}
diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl b/test/tint/builtins/gen/var/log/f4c570.wgsl
new file mode 100644
index 0000000..825c833
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/f4c570.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log(vec<3, f32>) -> vec<3, f32>
+fn log_f4c570() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_f4c570();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_f4c570();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_f4c570();
+}
diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl
new file mode 100644
index 0000000..e6be403
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log_f4c570() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = log(arg_0);
+}
+
+vec4 vertex_main() {
+ log_f4c570();
+ 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;
+
+void log_f4c570() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = log(arg_0);
+}
+
+void fragment_main() {
+ log_f4c570();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log_f4c570() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = log(arg_0);
+}
+
+void compute_main() {
+ log_f4c570();
+}
+
+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/log/f4c570.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.hlsl
new file mode 100644
index 0000000..27514fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log_f4c570() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log_f4c570();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log_f4c570();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log_f4c570();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl
new file mode 100644
index 0000000..8afbab0
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log_f4c570() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = log(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log_f4c570();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log_f4c570();
+ return;
+}
+
+kernel void compute_main() {
+ log_f4c570();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b43543
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %log_f4c570 "log_f4c570"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %log_f4c570 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Log %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %log_f4c570
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %log_f4c570
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %log_f4c570
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7b9513
--- /dev/null
+++ b/test/tint/builtins/gen/var/log/f4c570.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log_f4c570() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = log(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log_f4c570();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log_f4c570();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log_f4c570();
+}
diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl
new file mode 100644
index 0000000..b002ff5
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log2(f32) -> f32
+fn log2_4036ed() {
+ var arg_0 = 1.0;
+ var res: f32 = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_4036ed();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_4036ed();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_4036ed();
+}
diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl
new file mode 100644
index 0000000..dbd9a48
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log2_4036ed() {
+ float arg_0 = 1.0f;
+ float res = log2(arg_0);
+}
+
+vec4 vertex_main() {
+ log2_4036ed();
+ 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;
+
+void log2_4036ed() {
+ float arg_0 = 1.0f;
+ float res = log2(arg_0);
+}
+
+void fragment_main() {
+ log2_4036ed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log2_4036ed() {
+ float arg_0 = 1.0f;
+ float res = log2(arg_0);
+}
+
+void compute_main() {
+ log2_4036ed();
+}
+
+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/log2/4036ed.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.hlsl
new file mode 100644
index 0000000..bc9a7c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log2_4036ed() {
+ float arg_0 = 1.0f;
+ float res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log2_4036ed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log2_4036ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log2_4036ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl
new file mode 100644
index 0000000..d21766d
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log2_4036ed() {
+ float arg_0 = 1.0f;
+ float res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log2_4036ed();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log2_4036ed();
+ return;
+}
+
+kernel void compute_main() {
+ log2_4036ed();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm
new file mode 100644
index 0000000..14887a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %log2_4036ed "log2_4036ed"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%log2_4036ed = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Log2 %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %log2_4036ed
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %log2_4036ed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %log2_4036ed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl
new file mode 100644
index 0000000..5baca8b
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/4036ed.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log2_4036ed() {
+ var arg_0 = 1.0;
+ var res : f32 = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_4036ed();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_4036ed();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_4036ed();
+}
diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl b/test/tint/builtins/gen/var/log2/902988.wgsl
new file mode 100644
index 0000000..a0a4f8e
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/902988.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log2(vec<4, f32>) -> vec<4, f32>
+fn log2_902988() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_902988();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_902988();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_902988();
+}
diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl
new file mode 100644
index 0000000..32ef3ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log2_902988() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = log2(arg_0);
+}
+
+vec4 vertex_main() {
+ log2_902988();
+ 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;
+
+void log2_902988() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = log2(arg_0);
+}
+
+void fragment_main() {
+ log2_902988();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log2_902988() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = log2(arg_0);
+}
+
+void compute_main() {
+ log2_902988();
+}
+
+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/log2/902988.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.hlsl
new file mode 100644
index 0000000..f4564a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log2_902988() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log2_902988();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log2_902988();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log2_902988();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl
new file mode 100644
index 0000000..b24d5d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log2_902988() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log2_902988();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log2_902988();
+ return;
+}
+
+kernel void compute_main() {
+ log2_902988();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm
new file mode 100644
index 0000000..6cc4c9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %log2_902988 "log2_902988"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%log2_902988 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Log2 %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %log2_902988
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %log2_902988
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %log2_902988
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl
new file mode 100644
index 0000000..cdc40ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/902988.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log2_902988() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_902988();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_902988();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_902988();
+}
diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl b/test/tint/builtins/gen/var/log2/adb233.wgsl
new file mode 100644
index 0000000..bbf9c83
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/adb233.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log2(vec<3, f32>) -> vec<3, f32>
+fn log2_adb233() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_adb233();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_adb233();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_adb233();
+}
diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl
new file mode 100644
index 0000000..e418bf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log2_adb233() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = log2(arg_0);
+}
+
+vec4 vertex_main() {
+ log2_adb233();
+ 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;
+
+void log2_adb233() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = log2(arg_0);
+}
+
+void fragment_main() {
+ log2_adb233();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log2_adb233() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = log2(arg_0);
+}
+
+void compute_main() {
+ log2_adb233();
+}
+
+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/log2/adb233.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.hlsl
new file mode 100644
index 0000000..16c4b43
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log2_adb233() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log2_adb233();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log2_adb233();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log2_adb233();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl
new file mode 100644
index 0000000..f6e89e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log2_adb233() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log2_adb233();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log2_adb233();
+ return;
+}
+
+kernel void compute_main() {
+ log2_adb233();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm
new file mode 100644
index 0000000..7ddd436
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %log2_adb233 "log2_adb233"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%log2_adb233 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Log2 %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %log2_adb233
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %log2_adb233
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %log2_adb233
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl
new file mode 100644
index 0000000..23a4b3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/adb233.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log2_adb233() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_adb233();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_adb233();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_adb233();
+}
diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl b/test/tint/builtins/gen/var/log2/aea659.wgsl
new file mode 100644
index 0000000..88d7d76
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/aea659.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn log2(vec<2, f32>) -> vec<2, f32>
+fn log2_aea659() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_aea659();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_aea659();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_aea659();
+}
diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl
new file mode 100644
index 0000000..ec15096
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void log2_aea659() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = log2(arg_0);
+}
+
+vec4 vertex_main() {
+ log2_aea659();
+ 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;
+
+void log2_aea659() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = log2(arg_0);
+}
+
+void fragment_main() {
+ log2_aea659();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void log2_aea659() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = log2(arg_0);
+}
+
+void compute_main() {
+ log2_aea659();
+}
+
+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/log2/aea659.wgsl.expected.hlsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.hlsl
new file mode 100644
index 0000000..e24f82a
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void log2_aea659() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ log2_aea659();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ log2_aea659();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ log2_aea659();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl
new file mode 100644
index 0000000..600c740
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void log2_aea659() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = log2(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ log2_aea659();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ log2_aea659();
+ return;
+}
+
+kernel void compute_main() {
+ log2_aea659();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm
new file mode 100644
index 0000000..5ea2f4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %log2_aea659 "log2_aea659"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%log2_aea659 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Log2 %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %log2_aea659
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %log2_aea659
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %log2_aea659
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl
new file mode 100644
index 0000000..86a10f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/log2/aea659.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn log2_aea659() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = log2(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ log2_aea659();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ log2_aea659();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ log2_aea659();
+}
diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl
new file mode 100644
index 0000000..67391ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(u32, u32) -> u32
+fn max_0c0aae() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var res: u32 = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_0c0aae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_0c0aae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_0c0aae();
+}
diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl
new file mode 100644
index 0000000..de68a14
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_0c0aae() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_0c0aae();
+ 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;
+
+void max_0c0aae() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_0c0aae();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_0c0aae() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_0c0aae();
+}
+
+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/max/0c0aae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.hlsl
new file mode 100644
index 0000000..e7e8dce
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_0c0aae() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_0c0aae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_0c0aae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_0c0aae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl
new file mode 100644
index 0000000..6a31914
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_0c0aae() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_0c0aae();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_0c0aae();
+ return;
+}
+
+kernel void compute_main() {
+ max_0c0aae();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm
new file mode 100644
index 0000000..4f9f3b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_0c0aae "max_0c0aae"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_0c0aae = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %arg_1 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ OpStore %arg_1 %uint_1
+ %21 = OpLoad %uint %arg_0
+ %22 = OpLoad %uint %arg_1
+ %19 = OpExtInst %uint %20 UMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_0c0aae
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_0c0aae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_0c0aae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl
new file mode 100644
index 0000000..562bf67
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/0c0aae.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_0c0aae() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var res : u32 = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_0c0aae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_0c0aae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_0c0aae();
+}
diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl b/test/tint/builtins/gen/var/max/25eafe.wgsl
new file mode 100644
index 0000000..4d028de
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/25eafe.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<3, i32>, vec<3, i32>) -> vec<3, i32>
+fn max_25eafe() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var res: vec3<i32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_25eafe();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_25eafe();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_25eafe();
+}
diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl
new file mode 100644
index 0000000..ea6e7fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_25eafe() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_25eafe();
+ 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;
+
+void max_25eafe() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_25eafe();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_25eafe() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_25eafe();
+}
+
+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/max/25eafe.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.hlsl
new file mode 100644
index 0000000..77cc993
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_25eafe() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ int3 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_25eafe();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_25eafe();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_25eafe();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl
new file mode 100644
index 0000000..732cc47
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_25eafe() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ int3 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_25eafe();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_25eafe();
+ return;
+}
+
+kernel void compute_main() {
+ max_25eafe();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm
new file mode 100644
index 0000000..9a15372
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_25eafe "max_25eafe"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_25eafe = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v3int %arg_0
+ %22 = OpLoad %v3int %arg_1
+ %19 = OpExtInst %v3int %20 SMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_25eafe
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_25eafe
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_25eafe
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl
new file mode 100644
index 0000000..70adbd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/25eafe.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_25eafe() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var res : vec3<i32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_25eafe();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_25eafe();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_25eafe();
+}
diff --git a/test/tint/builtins/gen/var/max/320815.wgsl b/test/tint/builtins/gen/var/max/320815.wgsl
new file mode 100644
index 0000000..1b27db6
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/320815.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<2, u32>, vec<2, u32>) -> vec<2, u32>
+fn max_320815() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var res: vec2<u32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_320815();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_320815();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_320815();
+}
diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl
new file mode 100644
index 0000000..dd24fb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_320815() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_320815();
+ 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;
+
+void max_320815() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_320815();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_320815() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_320815();
+}
+
+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/max/320815.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.hlsl
new file mode 100644
index 0000000..c863bd2
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_320815() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ uint2 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_320815();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_320815();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_320815();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl
new file mode 100644
index 0000000..2022314
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_320815() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ uint2 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_320815();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_320815();
+ return;
+}
+
+kernel void compute_main() {
+ max_320815();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm
new file mode 100644
index 0000000..4035665
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_320815 "max_320815"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_320815 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v2uint %arg_0
+ %22 = OpLoad %v2uint %arg_1
+ %19 = OpExtInst %v2uint %20 UMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_320815
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_320815
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_320815
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl
new file mode 100644
index 0000000..9d47a9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/320815.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_320815() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var res : vec2<u32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_320815();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_320815();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_320815();
+}
diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl b/test/tint/builtins/gen/var/max/44a39d.wgsl
new file mode 100644
index 0000000..280f40db
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/44a39d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(f32, f32) -> f32
+fn max_44a39d() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res: f32 = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_44a39d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_44a39d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_44a39d();
+}
diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl
new file mode 100644
index 0000000..aff772a
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_44a39d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_44a39d();
+ 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;
+
+void max_44a39d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_44a39d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_44a39d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_44a39d();
+}
+
+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/max/44a39d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.hlsl
new file mode 100644
index 0000000..4435435
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_44a39d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_44a39d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_44a39d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_44a39d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl
new file mode 100644
index 0000000..da0146b
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_44a39d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = fmax(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_44a39d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_44a39d();
+ return;
+}
+
+kernel void compute_main() {
+ max_44a39d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm
new file mode 100644
index 0000000..d075c28
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %max_44a39d "max_44a39d"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %max_44a39d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ %19 = OpLoad %float %arg_0
+ %20 = OpLoad %float %arg_1
+ %17 = OpExtInst %float %18 NMax %19 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %max_44a39d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %max_44a39d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_44a39d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl
new file mode 100644
index 0000000..d7107af
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/44a39d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_44a39d() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res : f32 = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_44a39d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_44a39d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_44a39d();
+}
diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl b/test/tint/builtins/gen/var/max/453e04.wgsl
new file mode 100644
index 0000000..b8b6630
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/453e04.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<4, u32>, vec<4, u32>) -> vec<4, u32>
+fn max_453e04() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var res: vec4<u32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_453e04();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_453e04();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_453e04();
+}
diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl
new file mode 100644
index 0000000..d525546
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_453e04() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_453e04();
+ 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;
+
+void max_453e04() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_453e04();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_453e04() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_453e04();
+}
+
+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/max/453e04.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.hlsl
new file mode 100644
index 0000000..d812288
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_453e04() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ uint4 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_453e04();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_453e04();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_453e04();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl
new file mode 100644
index 0000000..a8510d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_453e04() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ uint4 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_453e04();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_453e04();
+ return;
+}
+
+kernel void compute_main() {
+ max_453e04();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm
new file mode 100644
index 0000000..caf8737
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_453e04 "max_453e04"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_453e04 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v4uint %arg_0
+ %22 = OpLoad %v4uint %arg_1
+ %19 = OpExtInst %v4uint %20 UMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_453e04
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_453e04
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_453e04
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl
new file mode 100644
index 0000000..2fd058d
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/453e04.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_453e04() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var res : vec4<u32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_453e04();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_453e04();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_453e04();
+}
diff --git a/test/tint/builtins/gen/var/max/462050.wgsl b/test/tint/builtins/gen/var/max/462050.wgsl
new file mode 100644
index 0000000..56bfaa9
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/462050.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn max_462050() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: vec2<f32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_462050();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_462050();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_462050();
+}
diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl
new file mode 100644
index 0000000..48d1a33
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_462050() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_462050();
+ 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;
+
+void max_462050() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_462050();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_462050() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_462050();
+}
+
+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/max/462050.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.hlsl
new file mode 100644
index 0000000..132a4b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_462050() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_462050();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_462050();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_462050();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl
new file mode 100644
index 0000000..8aadf35
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_462050() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 res = fmax(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_462050();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_462050();
+ return;
+}
+
+kernel void compute_main() {
+ max_462050();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b0facf
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %max_462050 "max_462050"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_462050 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %v2float %19 NMax %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %max_462050
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %max_462050
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %max_462050
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl
new file mode 100644
index 0000000..1a7c608
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/462050.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_462050() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : vec2<f32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_462050();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_462050();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_462050();
+}
diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl b/test/tint/builtins/gen/var/max/4883ac.wgsl
new file mode 100644
index 0000000..2ba5c05
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/4883ac.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn max_4883ac() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_4883ac();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_4883ac();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_4883ac();
+}
diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl
new file mode 100644
index 0000000..79b7607
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_4883ac() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_4883ac();
+ 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;
+
+void max_4883ac() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_4883ac();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_4883ac() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_4883ac();
+}
+
+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/max/4883ac.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.hlsl
new file mode 100644
index 0000000..8c577a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_4883ac() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_4883ac();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_4883ac();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_4883ac();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl
new file mode 100644
index 0000000..49ccb2a
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_4883ac() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = fmax(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_4883ac();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_4883ac();
+ return;
+}
+
+kernel void compute_main() {
+ max_4883ac();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm
new file mode 100644
index 0000000..4767d18
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %max_4883ac "max_4883ac"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_4883ac = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 NMax %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %max_4883ac
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %max_4883ac
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %max_4883ac
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl
new file mode 100644
index 0000000..2e15544
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/4883ac.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_4883ac() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_4883ac();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_4883ac();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_4883ac();
+}
diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl
new file mode 100644
index 0000000..0692e99
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<4, i32>, vec<4, i32>) -> vec<4, i32>
+fn max_85e6bc() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var res: vec4<i32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_85e6bc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_85e6bc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_85e6bc();
+}
diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl
new file mode 100644
index 0000000..e447eab
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_85e6bc() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_85e6bc();
+ 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;
+
+void max_85e6bc() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_85e6bc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_85e6bc() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_85e6bc();
+}
+
+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/max/85e6bc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.hlsl
new file mode 100644
index 0000000..4038786
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_85e6bc() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ int4 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_85e6bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_85e6bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_85e6bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl
new file mode 100644
index 0000000..3b73bf7
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_85e6bc() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ int4 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_85e6bc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_85e6bc();
+ return;
+}
+
+kernel void compute_main() {
+ max_85e6bc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm
new file mode 100644
index 0000000..8c468ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_85e6bc "max_85e6bc"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_85e6bc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v4int %arg_0
+ %22 = OpLoad %v4int %arg_1
+ %19 = OpExtInst %v4int %20 SMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_85e6bc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_85e6bc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_85e6bc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl
new file mode 100644
index 0000000..8d76787
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/85e6bc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_85e6bc() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var res : vec4<i32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_85e6bc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_85e6bc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_85e6bc();
+}
diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl b/test/tint/builtins/gen/var/max/a93419.wgsl
new file mode 100644
index 0000000..3a08c18
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/a93419.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn max_a93419() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: vec4<f32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_a93419();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_a93419();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_a93419();
+}
diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl
new file mode 100644
index 0000000..61bfbbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_a93419() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_a93419();
+ 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;
+
+void max_a93419() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_a93419();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_a93419() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_a93419();
+}
+
+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/max/a93419.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.hlsl
new file mode 100644
index 0000000..6997426
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_a93419() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_a93419();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_a93419();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_a93419();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl
new file mode 100644
index 0000000..71b826d
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_a93419() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 res = fmax(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_a93419();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_a93419();
+ return;
+}
+
+kernel void compute_main() {
+ max_a93419();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm
new file mode 100644
index 0000000..0258486
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %max_a93419 "max_a93419"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_a93419 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %v4float %17 NMax %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %max_a93419
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %max_a93419
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_a93419
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl
new file mode 100644
index 0000000..0e3d12d
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/a93419.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_a93419() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : vec4<f32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_a93419();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_a93419();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_a93419();
+}
diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl
new file mode 100644
index 0000000..b60e810
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<3, u32>, vec<3, u32>) -> vec<3, u32>
+fn max_b1b73a() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var res: vec3<u32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_b1b73a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_b1b73a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_b1b73a();
+}
diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl
new file mode 100644
index 0000000..e472bce
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_b1b73a() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_b1b73a();
+ 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;
+
+void max_b1b73a() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_b1b73a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_b1b73a() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_b1b73a();
+}
+
+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/max/b1b73a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.hlsl
new file mode 100644
index 0000000..58925ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_b1b73a() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ uint3 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_b1b73a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_b1b73a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_b1b73a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl
new file mode 100644
index 0000000..d115f99
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_b1b73a() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ uint3 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_b1b73a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_b1b73a();
+ return;
+}
+
+kernel void compute_main() {
+ max_b1b73a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm
new file mode 100644
index 0000000..3d94408
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_b1b73a "max_b1b73a"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_b1b73a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v3uint %arg_0
+ %22 = OpLoad %v3uint %arg_1
+ %19 = OpExtInst %v3uint %20 UMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_b1b73a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_b1b73a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_b1b73a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl
new file mode 100644
index 0000000..affed5f
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/b1b73a.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_b1b73a() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var res : vec3<u32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_b1b73a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_b1b73a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_b1b73a();
+}
diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl
new file mode 100644
index 0000000..3bfa94b
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(i32, i32) -> i32
+fn max_ce7c30() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var res: i32 = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_ce7c30();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_ce7c30();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_ce7c30();
+}
diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl
new file mode 100644
index 0000000..fde5bcf
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_ce7c30() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_ce7c30();
+ 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;
+
+void max_ce7c30() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_ce7c30();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_ce7c30() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_ce7c30();
+}
+
+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/max/ce7c30.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.hlsl
new file mode 100644
index 0000000..532d8ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_ce7c30() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_ce7c30();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_ce7c30();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_ce7c30();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl
new file mode 100644
index 0000000..1f01f8a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_ce7c30() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_ce7c30();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_ce7c30();
+ return;
+}
+
+kernel void compute_main() {
+ max_ce7c30();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm
new file mode 100644
index 0000000..faeb02c
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_ce7c30 "max_ce7c30"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_ce7c30 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ OpStore %arg_1 %int_1
+ %21 = OpLoad %int %arg_0
+ %22 = OpLoad %int %arg_1
+ %19 = OpExtInst %int %20 SMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_ce7c30
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_ce7c30
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_ce7c30
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl
new file mode 100644
index 0000000..389f57c
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/ce7c30.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_ce7c30() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var res : i32 = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_ce7c30();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_ce7c30();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_ce7c30();
+}
diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl b/test/tint/builtins/gen/var/max/e8192f.wgsl
new file mode 100644
index 0000000..e492084
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/e8192f.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn max(vec<2, i32>, vec<2, i32>) -> vec<2, i32>
+fn max_e8192f() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var res: vec2<i32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_e8192f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_e8192f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_e8192f();
+}
diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl
new file mode 100644
index 0000000..dd429a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void max_e8192f() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 res = max(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ max_e8192f();
+ 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;
+
+void max_e8192f() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 res = max(arg_0, arg_1);
+}
+
+void fragment_main() {
+ max_e8192f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void max_e8192f() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 res = max(arg_0, arg_1);
+}
+
+void compute_main() {
+ max_e8192f();
+}
+
+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/max/e8192f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.hlsl
new file mode 100644
index 0000000..aced4a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void max_e8192f() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ int2 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ max_e8192f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ max_e8192f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ max_e8192f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl
new file mode 100644
index 0000000..19f2872
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void max_e8192f() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ int2 res = max(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ max_e8192f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ max_e8192f();
+ return;
+}
+
+kernel void compute_main() {
+ max_e8192f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm
new file mode 100644
index 0000000..4e09cf0
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %max_e8192f "max_e8192f"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %max_e8192f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v2int %arg_0
+ %22 = OpLoad %v2int %arg_1
+ %19 = OpExtInst %v2int %20 SMax %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_e8192f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_e8192f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_e8192f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl
new file mode 100644
index 0000000..d7e94bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/max/e8192f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn max_e8192f() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var res : vec2<i32> = max(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ max_e8192f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ max_e8192f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ max_e8192f();
+}
diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl
new file mode 100644
index 0000000..c6584bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<2, i32>, vec<2, i32>) -> vec<2, i32>
+fn min_03c7e3() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var res: vec2<i32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_03c7e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_03c7e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_03c7e3();
+}
diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl
new file mode 100644
index 0000000..f406945
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_03c7e3() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_03c7e3();
+ 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;
+
+void min_03c7e3() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_03c7e3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_03c7e3() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ ivec2 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_03c7e3();
+}
+
+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/min/03c7e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.hlsl
new file mode 100644
index 0000000..af0f247
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_03c7e3() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ int2 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_03c7e3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_03c7e3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_03c7e3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl
new file mode 100644
index 0000000..b86dc3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_03c7e3() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ int2 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_03c7e3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_03c7e3();
+ return;
+}
+
+kernel void compute_main() {
+ min_03c7e3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm
new file mode 100644
index 0000000..ff14eae
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_03c7e3 "min_03c7e3"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_03c7e3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v2int %arg_0
+ %22 = OpLoad %v2int %arg_1
+ %19 = OpExtInst %v2int %20 SMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_03c7e3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_03c7e3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_03c7e3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl
new file mode 100644
index 0000000..c266d21
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/03c7e3.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_03c7e3() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var res : vec2<i32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_03c7e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_03c7e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_03c7e3();
+}
diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl b/test/tint/builtins/gen/var/min/0dc614.wgsl
new file mode 100644
index 0000000..15bd521
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/0dc614.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<4, u32>, vec<4, u32>) -> vec<4, u32>
+fn min_0dc614() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var res: vec4<u32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_0dc614();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_0dc614();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_0dc614();
+}
diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl
new file mode 100644
index 0000000..e865f03
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_0dc614() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_0dc614();
+ 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;
+
+void min_0dc614() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_0dc614();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_0dc614() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ uvec4 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_0dc614();
+}
+
+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/min/0dc614.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.hlsl
new file mode 100644
index 0000000..57486fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_0dc614() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ uint4 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_0dc614();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_0dc614();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_0dc614();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl
new file mode 100644
index 0000000..2e45112
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_0dc614() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ uint4 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_0dc614();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_0dc614();
+ return;
+}
+
+kernel void compute_main() {
+ min_0dc614();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b569aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_0dc614 "min_0dc614"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_0dc614 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v4uint %arg_0
+ %22 = OpLoad %v4uint %arg_1
+ %19 = OpExtInst %v4uint %20 UMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_0dc614
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_0dc614
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_0dc614
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl
new file mode 100644
index 0000000..6468740
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/0dc614.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_0dc614() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var res : vec4<u32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_0dc614();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_0dc614();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_0dc614();
+}
diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl b/test/tint/builtins/gen/var/min/3941e1.wgsl
new file mode 100644
index 0000000..6ffcdef
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/3941e1.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<4, i32>, vec<4, i32>) -> vec<4, i32>
+fn min_3941e1() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var res: vec4<i32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_3941e1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_3941e1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_3941e1();
+}
diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl
new file mode 100644
index 0000000..9bc4143
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_3941e1() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_3941e1();
+ 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;
+
+void min_3941e1() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_3941e1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_3941e1() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ ivec4 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_3941e1();
+}
+
+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/min/3941e1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.hlsl
new file mode 100644
index 0000000..d071ce7
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_3941e1() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ int4 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_3941e1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_3941e1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_3941e1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl
new file mode 100644
index 0000000..5bb0be9
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_3941e1() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ int4 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_3941e1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_3941e1();
+ return;
+}
+
+kernel void compute_main() {
+ min_3941e1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm
new file mode 100644
index 0000000..aa77352
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_3941e1 "min_3941e1"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_3941e1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v4int %arg_0
+ %22 = OpLoad %v4int %arg_1
+ %19 = OpExtInst %v4int %20 SMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_3941e1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_3941e1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_3941e1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl
new file mode 100644
index 0000000..e4f18a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/3941e1.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_3941e1() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var res : vec4<i32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_3941e1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_3941e1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_3941e1();
+}
diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl
new file mode 100644
index 0000000..391138e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(u32, u32) -> u32
+fn min_46c5d3() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var res: u32 = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_46c5d3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_46c5d3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_46c5d3();
+}
diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl
new file mode 100644
index 0000000..d2cce51
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_46c5d3() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_46c5d3();
+ 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;
+
+void min_46c5d3() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_46c5d3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_46c5d3() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_46c5d3();
+}
+
+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/min/46c5d3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.hlsl
new file mode 100644
index 0000000..68dfb8e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_46c5d3() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_46c5d3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_46c5d3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_46c5d3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl
new file mode 100644
index 0000000..a66228b
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_46c5d3() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ uint res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_46c5d3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_46c5d3();
+ return;
+}
+
+kernel void compute_main() {
+ min_46c5d3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm
new file mode 100644
index 0000000..f68a728
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_46c5d3 "min_46c5d3"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_46c5d3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %arg_1 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ OpStore %arg_1 %uint_1
+ %21 = OpLoad %uint %arg_0
+ %22 = OpLoad %uint %arg_1
+ %19 = OpExtInst %uint %20 UMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_46c5d3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_46c5d3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_46c5d3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl
new file mode 100644
index 0000000..82edb4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/46c5d3.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_46c5d3() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var res : u32 = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_46c5d3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_46c5d3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_46c5d3();
+}
diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl b/test/tint/builtins/gen/var/min/82b28f.wgsl
new file mode 100644
index 0000000..6ccb4e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/82b28f.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<2, u32>, vec<2, u32>) -> vec<2, u32>
+fn min_82b28f() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var res: vec2<u32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_82b28f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_82b28f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_82b28f();
+}
diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl
new file mode 100644
index 0000000..2ba2c0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_82b28f() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_82b28f();
+ 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;
+
+void min_82b28f() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_82b28f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_82b28f() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ uvec2 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_82b28f();
+}
+
+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/min/82b28f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.hlsl
new file mode 100644
index 0000000..b1f5804
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_82b28f() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ uint2 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_82b28f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_82b28f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_82b28f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl
new file mode 100644
index 0000000..ff78060
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_82b28f() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ uint2 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_82b28f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_82b28f();
+ return;
+}
+
+kernel void compute_main() {
+ min_82b28f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm
new file mode 100644
index 0000000..ced5331
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_82b28f "min_82b28f"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_82b28f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v2uint %arg_0
+ %22 = OpLoad %v2uint %arg_1
+ %19 = OpExtInst %v2uint %20 UMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_82b28f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_82b28f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_82b28f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl
new file mode 100644
index 0000000..934bd52
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/82b28f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_82b28f() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var res : vec2<u32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_82b28f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_82b28f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_82b28f();
+}
diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl
new file mode 100644
index 0000000..1fe53e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn min_93cfc4() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_93cfc4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_93cfc4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_93cfc4();
+}
diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl
new file mode 100644
index 0000000..1e45506
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_93cfc4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_93cfc4();
+ 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;
+
+void min_93cfc4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_93cfc4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_93cfc4() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_93cfc4();
+}
+
+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/min/93cfc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.hlsl
new file mode 100644
index 0000000..12c56fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_93cfc4() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_93cfc4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_93cfc4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_93cfc4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl
new file mode 100644
index 0000000..4e7ad8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_93cfc4() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = fmin(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_93cfc4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_93cfc4();
+ return;
+}
+
+kernel void compute_main() {
+ min_93cfc4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm
new file mode 100644
index 0000000..01dc20f
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %min_93cfc4 "min_93cfc4"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_93cfc4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 NMin %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %min_93cfc4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %min_93cfc4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %min_93cfc4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl
new file mode 100644
index 0000000..db17519
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/93cfc4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_93cfc4() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_93cfc4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_93cfc4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_93cfc4();
+}
diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl b/test/tint/builtins/gen/var/min/a45171.wgsl
new file mode 100644
index 0000000..8992507
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/a45171.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<3, i32>, vec<3, i32>) -> vec<3, i32>
+fn min_a45171() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var res: vec3<i32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_a45171();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_a45171();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_a45171();
+}
diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl
new file mode 100644
index 0000000..9045bae
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_a45171() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_a45171();
+ 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;
+
+void min_a45171() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_a45171();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_a45171() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ ivec3 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_a45171();
+}
+
+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/min/a45171.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.hlsl
new file mode 100644
index 0000000..4e2b89b
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_a45171() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ int3 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_a45171();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_a45171();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_a45171();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl
new file mode 100644
index 0000000..6bcbd9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_a45171() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ int3 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_a45171();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_a45171();
+ return;
+}
+
+kernel void compute_main() {
+ min_a45171();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm
new file mode 100644
index 0000000..7f6aa2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_a45171 "min_a45171"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_a45171 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v3int %arg_0
+ %22 = OpLoad %v3int %arg_1
+ %19 = OpExtInst %v3int %20 SMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_a45171
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_a45171
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_a45171
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl
new file mode 100644
index 0000000..80051cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/a45171.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_a45171() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var res : vec3<i32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_a45171();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_a45171();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_a45171();
+}
diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl
new file mode 100644
index 0000000..2b56279
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn min_aa28ad() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: vec2<f32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_aa28ad();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_aa28ad();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_aa28ad();
+}
diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl
new file mode 100644
index 0000000..a266b48
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_aa28ad() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_aa28ad();
+ 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;
+
+void min_aa28ad() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_aa28ad();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_aa28ad() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_aa28ad();
+}
+
+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/min/aa28ad.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.hlsl
new file mode 100644
index 0000000..1284c64
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_aa28ad() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_aa28ad();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_aa28ad();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_aa28ad();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl
new file mode 100644
index 0000000..a0bade4
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_aa28ad() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 res = fmin(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_aa28ad();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_aa28ad();
+ return;
+}
+
+kernel void compute_main() {
+ min_aa28ad();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm
new file mode 100644
index 0000000..6cdb88c
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %min_aa28ad "min_aa28ad"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_aa28ad = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %v2float %19 NMin %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %min_aa28ad
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %min_aa28ad
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %min_aa28ad
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl
new file mode 100644
index 0000000..f14fb39
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/aa28ad.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_aa28ad() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : vec2<f32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_aa28ad();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_aa28ad();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_aa28ad();
+}
diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl b/test/tint/builtins/gen/var/min/af326d.wgsl
new file mode 100644
index 0000000..f1bab38
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/af326d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(f32, f32) -> f32
+fn min_af326d() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res: f32 = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_af326d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_af326d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_af326d();
+}
diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl
new file mode 100644
index 0000000..070d859
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_af326d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_af326d();
+ 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;
+
+void min_af326d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_af326d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_af326d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_af326d();
+}
+
+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/min/af326d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.hlsl
new file mode 100644
index 0000000..ea481e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_af326d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_af326d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_af326d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_af326d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl
new file mode 100644
index 0000000..f7b47f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_af326d() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = fmin(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_af326d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_af326d();
+ return;
+}
+
+kernel void compute_main() {
+ min_af326d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm
new file mode 100644
index 0000000..70b60fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %min_af326d "min_af326d"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %min_af326d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ %19 = OpLoad %float %arg_0
+ %20 = OpLoad %float %arg_1
+ %17 = OpExtInst %float %18 NMin %19 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %min_af326d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %min_af326d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_af326d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl
new file mode 100644
index 0000000..dfc7c47
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/af326d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_af326d() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res : f32 = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_af326d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_af326d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_af326d();
+}
diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl
new file mode 100644
index 0000000..55582fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<3, u32>, vec<3, u32>) -> vec<3, u32>
+fn min_c70bb7() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var res: vec3<u32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_c70bb7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_c70bb7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_c70bb7();
+}
diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl
new file mode 100644
index 0000000..b8c99f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_c70bb7() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_c70bb7();
+ 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;
+
+void min_c70bb7() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_c70bb7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_c70bb7() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ uvec3 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_c70bb7();
+}
+
+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/min/c70bb7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.hlsl
new file mode 100644
index 0000000..b5e461e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_c70bb7() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ uint3 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_c70bb7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_c70bb7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_c70bb7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl
new file mode 100644
index 0000000..3f131b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_c70bb7() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ uint3 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_c70bb7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_c70bb7();
+ return;
+}
+
+kernel void compute_main() {
+ min_c70bb7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm
new file mode 100644
index 0000000..5a8530a
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_c70bb7 "min_c70bb7"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_c70bb7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ %21 = OpLoad %v3uint %arg_0
+ %22 = OpLoad %v3uint %arg_1
+ %19 = OpExtInst %v3uint %20 UMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_c70bb7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_c70bb7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_c70bb7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl
new file mode 100644
index 0000000..485ba0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c70bb7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_c70bb7() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var res : vec3<u32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_c70bb7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_c70bb7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_c70bb7();
+}
diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl b/test/tint/builtins/gen/var/min/c73147.wgsl
new file mode 100644
index 0000000..cf7c0fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c73147.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(i32, i32) -> i32
+fn min_c73147() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var res: i32 = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_c73147();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_c73147();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_c73147();
+}
diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl
new file mode 100644
index 0000000..0cf036e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_c73147() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_c73147();
+ 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;
+
+void min_c73147() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_c73147();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_c73147() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_c73147();
+}
+
+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/min/c73147.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.hlsl
new file mode 100644
index 0000000..a50a55d
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_c73147() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_c73147();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_c73147();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_c73147();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl
new file mode 100644
index 0000000..22a72c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_c73147() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ int res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_c73147();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_c73147();
+ return;
+}
+
+kernel void compute_main() {
+ min_c73147();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm
new file mode 100644
index 0000000..51ce104
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %min_c73147 "min_c73147"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_c73147 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ OpStore %arg_1 %int_1
+ %21 = OpLoad %int %arg_0
+ %22 = OpLoad %int %arg_1
+ %19 = OpExtInst %int %20 SMin %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %min_c73147
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_c73147
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %min_c73147
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl
new file mode 100644
index 0000000..8653636
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c73147.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_c73147() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var res : i32 = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_c73147();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_c73147();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_c73147();
+}
diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl
new file mode 100644
index 0000000..0665ca9
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn min(vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn min_c76fa6() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: vec4<f32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_c76fa6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_c76fa6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_c76fa6();
+}
diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl
new file mode 100644
index 0000000..c8f3d5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void min_c76fa6() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = min(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ min_c76fa6();
+ 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;
+
+void min_c76fa6() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = min(arg_0, arg_1);
+}
+
+void fragment_main() {
+ min_c76fa6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void min_c76fa6() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = min(arg_0, arg_1);
+}
+
+void compute_main() {
+ min_c76fa6();
+}
+
+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/min/c76fa6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.hlsl
new file mode 100644
index 0000000..c29c09d
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void min_c76fa6() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 res = min(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ min_c76fa6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ min_c76fa6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ min_c76fa6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl
new file mode 100644
index 0000000..698234e
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void min_c76fa6() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 res = fmin(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ min_c76fa6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ min_c76fa6();
+ return;
+}
+
+kernel void compute_main() {
+ min_c76fa6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm
new file mode 100644
index 0000000..a818f80
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %min_c76fa6 "min_c76fa6"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %min_c76fa6 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %v4float %17 NMin %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %min_c76fa6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %min_c76fa6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %min_c76fa6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl
new file mode 100644
index 0000000..2ef79b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/min/c76fa6.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn min_c76fa6() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : vec4<f32> = min(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ min_c76fa6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ min_c76fa6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ min_c76fa6();
+}
diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl
new file mode 100644
index 0000000..173a2df
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn mix_0c8c33() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res: vec3<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_0c8c33();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_0c8c33();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_0c8c33();
+}
diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl
new file mode 100644
index 0000000..46331a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_0c8c33() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_0c8c33();
+ 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;
+
+void mix_0c8c33() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_0c8c33();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_0c8c33() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_0c8c33();
+}
+
+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/mix/0c8c33.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.hlsl
new file mode 100644
index 0000000..ff0238b
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_0c8c33() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 arg_2 = (0.0f).xxx;
+ float3 res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_0c8c33();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_0c8c33();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_0c8c33();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl
new file mode 100644
index 0000000..0fe7746
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_0c8c33() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 arg_2 = float3(0.0f);
+ float3 res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_0c8c33();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_0c8c33();
+ return;
+}
+
+kernel void compute_main() {
+ mix_0c8c33();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm
new file mode 100644
index 0000000..d741ebd
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_0c8c33 "mix_0c8c33"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %mix_0c8c33 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v3float %arg_0
+ %22 = OpLoad %v3float %arg_1
+ %23 = OpLoad %v3float %arg_2
+ %19 = OpExtInst %v3float %20 FMix %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %mix_0c8c33
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %mix_0c8c33
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %mix_0c8c33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl
new file mode 100644
index 0000000..feae76a
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/0c8c33.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_0c8c33() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res : vec3<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_0c8c33();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_0c8c33();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_0c8c33();
+}
diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl
new file mode 100644
index 0000000..65b8108
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32>
+fn mix_1faeb1() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = 1.0;
+ var res: vec4<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_1faeb1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_1faeb1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_1faeb1();
+}
diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl
new file mode 100644
index 0000000..1d79c6a
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_1faeb1() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float arg_2 = 1.0f;
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_1faeb1();
+ 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;
+
+void mix_1faeb1() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float arg_2 = 1.0f;
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_1faeb1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_1faeb1() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float arg_2 = 1.0f;
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_1faeb1();
+}
+
+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/mix/1faeb1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.hlsl
new file mode 100644
index 0000000..8be22c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_1faeb1() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float arg_2 = 1.0f;
+ float4 res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_1faeb1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_1faeb1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_1faeb1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl
new file mode 100644
index 0000000..a2eb9ba
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_1faeb1() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float arg_2 = 1.0f;
+ float4 res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_1faeb1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_1faeb1();
+ return;
+}
+
+kernel void compute_main() {
+ mix_1faeb1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm
new file mode 100644
index 0000000..5cfd296
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_1faeb1 "mix_1faeb1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %27 = OpTypeFunction %v4float
+ %mix_1faeb1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %24 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %float_1
+ %21 = OpLoad %v4float %arg_0
+ %22 = OpLoad %v4float %arg_1
+ %23 = OpLoad %float %arg_2
+ %25 = OpCompositeConstruct %v4float %23 %23 %23 %23
+ %19 = OpExtInst %v4float %20 FMix %21 %22 %25
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %mix_1faeb1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %mix_1faeb1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %mix_1faeb1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl
new file mode 100644
index 0000000..3d73596
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/1faeb1.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_1faeb1() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = 1.0;
+ var res : vec4<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_1faeb1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_1faeb1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_1faeb1();
+}
diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl
new file mode 100644
index 0000000..e7ace41
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32>
+fn mix_2fadab() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = 1.0;
+ var res: vec2<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_2fadab();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_2fadab();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_2fadab();
+}
diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl
new file mode 100644
index 0000000..7e580ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_2fadab() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float arg_2 = 1.0f;
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_2fadab();
+ 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;
+
+void mix_2fadab() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float arg_2 = 1.0f;
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_2fadab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_2fadab() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float arg_2 = 1.0f;
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_2fadab();
+}
+
+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/mix/2fadab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.hlsl
new file mode 100644
index 0000000..ae442e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_2fadab() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float arg_2 = 1.0f;
+ float2 res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_2fadab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_2fadab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_2fadab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl
new file mode 100644
index 0000000..8f55a01
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_2fadab() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float arg_2 = 1.0f;
+ float2 res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_2fadab();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_2fadab();
+ return;
+}
+
+kernel void compute_main() {
+ mix_2fadab();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm
new file mode 100644
index 0000000..f5cb0c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ %22 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_2fadab "mix_2fadab"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeFunction %v4float
+ %mix_2fadab = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %26 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %float_1
+ %23 = OpLoad %v2float %arg_0
+ %24 = OpLoad %v2float %arg_1
+ %25 = OpLoad %float %arg_2
+ %27 = OpCompositeConstruct %v2float %25 %25
+ %21 = OpExtInst %v2float %22 FMix %23 %24 %27
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %mix_2fadab
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %mix_2fadab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %mix_2fadab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl
new file mode 100644
index 0000000..8f1d4f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/2fadab.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_2fadab() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = 1.0;
+ var res : vec2<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_2fadab();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_2fadab();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_2fadab();
+}
diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl b/test/tint/builtins/gen/var/mix/315264.wgsl
new file mode 100644
index 0000000..c396c01
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/315264.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32>
+fn mix_315264() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = 1.0;
+ var res: vec3<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_315264();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_315264();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_315264();
+}
diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl
new file mode 100644
index 0000000..5e3fea1
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_315264() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float arg_2 = 1.0f;
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_315264();
+ 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;
+
+void mix_315264() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float arg_2 = 1.0f;
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_315264();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_315264() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float arg_2 = 1.0f;
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_315264();
+}
+
+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/mix/315264.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.hlsl
new file mode 100644
index 0000000..d9674f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_315264() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float arg_2 = 1.0f;
+ float3 res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_315264();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_315264();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_315264();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl
new file mode 100644
index 0000000..59819cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_315264() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float arg_2 = 1.0f;
+ float3 res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_315264();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_315264();
+ return;
+}
+
+kernel void compute_main() {
+ mix_315264();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm
new file mode 100644
index 0000000..d5f96ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ %22 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_315264 "mix_315264"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeFunction %v4float
+ %mix_315264 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %26 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %float_1
+ %23 = OpLoad %v3float %arg_0
+ %24 = OpLoad %v3float %arg_1
+ %25 = OpLoad %float %arg_2
+ %27 = OpCompositeConstruct %v3float %25 %25 %25
+ %21 = OpExtInst %v3float %22 FMix %23 %24 %27
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %mix_315264
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %mix_315264
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %mix_315264
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl
new file mode 100644
index 0000000..e4f8430
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/315264.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_315264() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = 1.0;
+ var res : vec3<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_315264();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_315264();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_315264();
+}
diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl
new file mode 100644
index 0000000..4e823a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(f32, f32, f32) -> f32
+fn mix_4f0b5e() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res: f32 = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_4f0b5e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_4f0b5e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_4f0b5e();
+}
diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl
new file mode 100644
index 0000000..4c40bad
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_4f0b5e() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_4f0b5e();
+ 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;
+
+void mix_4f0b5e() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_4f0b5e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_4f0b5e() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_4f0b5e();
+}
+
+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/mix/4f0b5e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.hlsl
new file mode 100644
index 0000000..3ddc02b
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_4f0b5e() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_4f0b5e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_4f0b5e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_4f0b5e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl
new file mode 100644
index 0000000..55238da
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_4f0b5e() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_4f0b5e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_4f0b5e();
+ return;
+}
+
+kernel void compute_main() {
+ mix_4f0b5e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm
new file mode 100644
index 0000000..a307df3
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_4f0b5e "mix_4f0b5e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpTypeFunction %v4float
+ %mix_4f0b5e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ OpStore %arg_2 %float_1
+ %20 = OpLoad %float %arg_0
+ %21 = OpLoad %float %arg_1
+ %22 = OpLoad %float %arg_2
+ %18 = OpExtInst %float %19 FMix %20 %21 %22
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %mix_4f0b5e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %mix_4f0b5e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %mix_4f0b5e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl
new file mode 100644
index 0000000..295f6efc
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/4f0b5e.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_4f0b5e() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res : f32 = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_4f0b5e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_4f0b5e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_4f0b5e();
+}
diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl
new file mode 100644
index 0000000..e730990
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn mix_6f8adc() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res: vec2<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_6f8adc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_6f8adc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_6f8adc();
+}
diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl
new file mode 100644
index 0000000..a9e601d
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_6f8adc() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_6f8adc();
+ 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;
+
+void mix_6f8adc() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_6f8adc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_6f8adc() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_6f8adc();
+}
+
+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/mix/6f8adc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.hlsl
new file mode 100644
index 0000000..cdfac7b
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_6f8adc() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 arg_2 = (0.0f).xx;
+ float2 res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_6f8adc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_6f8adc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_6f8adc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl
new file mode 100644
index 0000000..8f3cf6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_6f8adc() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 arg_2 = float2(0.0f);
+ float2 res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_6f8adc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_6f8adc();
+ return;
+}
+
+kernel void compute_main() {
+ mix_6f8adc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm
new file mode 100644
index 0000000..2d989aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_6f8adc "mix_6f8adc"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %mix_6f8adc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v2float %arg_0
+ %22 = OpLoad %v2float %arg_1
+ %23 = OpLoad %v2float %arg_2
+ %19 = OpExtInst %v2float %20 FMix %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %mix_6f8adc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %mix_6f8adc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %mix_6f8adc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl
new file mode 100644
index 0000000..f29095a
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/6f8adc.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_6f8adc() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res : vec2<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_6f8adc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_6f8adc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_6f8adc();
+}
diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl
new file mode 100644
index 0000000..2f02593
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn mix(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn mix_c37ede() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res: vec4<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_c37ede();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_c37ede();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_c37ede();
+}
diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl
new file mode 100644
index 0000000..eee9b05
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void mix_c37ede() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ mix_c37ede();
+ 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;
+
+void mix_c37ede() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ mix_c37ede();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void mix_c37ede() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ mix_c37ede();
+}
+
+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/mix/c37ede.wgsl.expected.hlsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.hlsl
new file mode 100644
index 0000000..2ec722c
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void mix_c37ede() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 arg_2 = (0.0f).xxxx;
+ float4 res = lerp(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ mix_c37ede();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ mix_c37ede();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ mix_c37ede();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl
new file mode 100644
index 0000000..6ee771e
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void mix_c37ede() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 arg_2 = float4(0.0f);
+ float4 res = mix(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ mix_c37ede();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ mix_c37ede();
+ return;
+}
+
+kernel void compute_main() {
+ mix_c37ede();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm
new file mode 100644
index 0000000..cca18b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %mix_c37ede "mix_c37ede"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %mix_c37ede = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %5
+ %19 = OpLoad %v4float %arg_0
+ %20 = OpLoad %v4float %arg_1
+ %21 = OpLoad %v4float %arg_2
+ %17 = OpExtInst %v4float %18 FMix %19 %20 %21
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %mix_c37ede
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %mix_c37ede
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %mix_c37ede
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl
new file mode 100644
index 0000000..ed1e7a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/mix/c37ede.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn mix_c37ede() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res : vec4<f32> = mix(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ mix_c37ede();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ mix_c37ede();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ mix_c37ede();
+}
diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl b/test/tint/builtins/gen/var/modf/180fed.wgsl
new file mode 100644
index 0000000..aaf3f55
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/180fed.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn modf(f32) -> __modf_result
+fn modf_180fed() {
+ var arg_0 = 1.0;
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_180fed();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_180fed();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_180fed();
+}
diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl
new file mode 100644
index 0000000..c3d2897
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct modf_result {
+ float fract;
+ float whole;
+};
+
+modf_result tint_modf(float param_0) {
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_180fed() {
+ float arg_0 = 1.0f;
+ modf_result res = tint_modf(arg_0);
+}
+
+vec4 vertex_main() {
+ modf_180fed();
+ 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;
+
+struct modf_result {
+ float fract;
+ float whole;
+};
+
+modf_result tint_modf(float param_0) {
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_180fed() {
+ float arg_0 = 1.0f;
+ modf_result res = tint_modf(arg_0);
+}
+
+void fragment_main() {
+ modf_180fed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct modf_result {
+ float fract;
+ float whole;
+};
+
+modf_result tint_modf(float param_0) {
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_180fed() {
+ float arg_0 = 1.0f;
+ modf_result res = tint_modf(arg_0);
+}
+
+void compute_main() {
+ modf_180fed();
+}
+
+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/modf/180fed.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.hlsl
new file mode 100644
index 0000000..9e70752
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct modf_result {
+ float fract;
+ float whole;
+};
+modf_result tint_modf(float param_0) {
+ float whole;
+ float fract = modf(param_0, whole);
+ modf_result result = {fract, whole};
+ return result;
+}
+
+void modf_180fed() {
+ float arg_0 = 1.0f;
+ modf_result res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ modf_180fed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ modf_180fed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ modf_180fed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl
new file mode 100644
index 0000000..2dc20e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct modf_result {
+ float fract;
+ float whole;
+};
+modf_result tint_modf(float param_0) {
+ float whole;
+ float fract = modf(param_0, whole);
+ return {fract, whole};
+}
+
+void modf_180fed() {
+ float arg_0 = 1.0f;
+ modf_result res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ modf_180fed();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ modf_180fed();
+ return;
+}
+
+kernel void compute_main() {
+ modf_180fed();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm
new file mode 100644
index 0000000..67e2e30
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %modf_180fed "modf_180fed"
+ OpName %arg_0 "arg_0"
+ OpName %__modf_result "__modf_result"
+ OpMemberName %__modf_result 0 "fract"
+ OpMemberName %__modf_result 1 "whole"
+ 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
+ OpMemberDecorate %__modf_result 0 Offset 0
+ OpMemberDecorate %__modf_result 1 Offset 4
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+%__modf_result = OpTypeStruct %float %float
+%_ptr_Function___modf_result = OpTypePointer Function %__modf_result
+ %22 = OpConstantNull %__modf_result
+ %23 = OpTypeFunction %v4float
+%modf_180fed = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function___modf_result Function %22
+ OpStore %arg_0 %float_1
+ %19 = OpLoad %float %arg_0
+ %16 = OpExtInst %__modf_result %18 ModfStruct %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %modf_180fed
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %modf_180fed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %modf_180fed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl
new file mode 100644
index 0000000..e62aa59
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/180fed.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn modf_180fed() {
+ var arg_0 = 1.0;
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_180fed();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_180fed();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_180fed();
+}
diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl
new file mode 100644
index 0000000..335331a
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn modf(vec<3, f32>) -> __modf_result_vec<3>
+fn modf_9b75f7() {
+ var arg_0 = vec3<f32>();
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_9b75f7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_9b75f7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_9b75f7();
+}
diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl
new file mode 100644
index 0000000..3ad1da3
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct modf_result_vec3 {
+ vec3 fract;
+ vec3 whole;
+};
+
+modf_result_vec3 tint_modf(vec3 param_0) {
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_9b75f7() {
+ vec3 arg_0 = vec3(0.0f);
+ modf_result_vec3 res = tint_modf(arg_0);
+}
+
+vec4 vertex_main() {
+ modf_9b75f7();
+ 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;
+
+struct modf_result_vec3 {
+ vec3 fract;
+ vec3 whole;
+};
+
+modf_result_vec3 tint_modf(vec3 param_0) {
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_9b75f7() {
+ vec3 arg_0 = vec3(0.0f);
+ modf_result_vec3 res = tint_modf(arg_0);
+}
+
+void fragment_main() {
+ modf_9b75f7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct modf_result_vec3 {
+ vec3 fract;
+ vec3 whole;
+};
+
+modf_result_vec3 tint_modf(vec3 param_0) {
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_9b75f7() {
+ vec3 arg_0 = vec3(0.0f);
+ modf_result_vec3 res = tint_modf(arg_0);
+}
+
+void compute_main() {
+ modf_9b75f7();
+}
+
+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/modf/9b75f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.hlsl
new file mode 100644
index 0000000..4eacd2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct modf_result_vec3 {
+ float3 fract;
+ float3 whole;
+};
+modf_result_vec3 tint_modf(float3 param_0) {
+ float3 whole;
+ float3 fract = modf(param_0, whole);
+ modf_result_vec3 result = {fract, whole};
+ return result;
+}
+
+void modf_9b75f7() {
+ float3 arg_0 = (0.0f).xxx;
+ modf_result_vec3 res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ modf_9b75f7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ modf_9b75f7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ modf_9b75f7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl
new file mode 100644
index 0000000..704fdd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct modf_result_vec3 {
+ float3 fract;
+ float3 whole;
+};
+modf_result_vec3 tint_modf(float3 param_0) {
+ float3 whole;
+ float3 fract = modf(param_0, whole);
+ return {fract, whole};
+}
+
+void modf_9b75f7() {
+ float3 arg_0 = float3(0.0f);
+ modf_result_vec3 res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ modf_9b75f7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ modf_9b75f7();
+ return;
+}
+
+kernel void compute_main() {
+ modf_9b75f7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm
new file mode 100644
index 0000000..23f76f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %modf_9b75f7 "modf_9b75f7"
+ OpName %arg_0 "arg_0"
+ OpName %__modf_result_vec3 "__modf_result_vec3"
+ OpMemberName %__modf_result_vec3 0 "fract"
+ OpMemberName %__modf_result_vec3 1 "whole"
+ 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
+ OpMemberDecorate %__modf_result_vec3 0 Offset 0
+ OpMemberDecorate %__modf_result_vec3 1 Offset 16
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+%__modf_result_vec3 = OpTypeStruct %v3float %v3float
+%_ptr_Function___modf_result_vec3 = OpTypePointer Function %__modf_result_vec3
+ %23 = OpConstantNull %__modf_result_vec3
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%modf_9b75f7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function___modf_result_vec3 Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %__modf_result_vec3 %19 ModfStruct %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %modf_9b75f7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %modf_9b75f7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %modf_9b75f7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl
new file mode 100644
index 0000000..ce3b3d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/9b75f7.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn modf_9b75f7() {
+ var arg_0 = vec3<f32>();
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_9b75f7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_9b75f7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_9b75f7();
+}
diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl
new file mode 100644
index 0000000..bd2a298
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn modf(vec<4, f32>) -> __modf_result_vec<4>
+fn modf_ec2dbc() {
+ var arg_0 = vec4<f32>();
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_ec2dbc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_ec2dbc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_ec2dbc();
+}
diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl
new file mode 100644
index 0000000..70f8ad6
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct modf_result_vec4 {
+ vec4 fract;
+ vec4 whole;
+};
+
+modf_result_vec4 tint_modf(vec4 param_0) {
+ modf_result_vec4 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_ec2dbc() {
+ vec4 arg_0 = vec4(0.0f);
+ modf_result_vec4 res = tint_modf(arg_0);
+}
+
+vec4 vertex_main() {
+ modf_ec2dbc();
+ 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;
+
+struct modf_result_vec4 {
+ vec4 fract;
+ vec4 whole;
+};
+
+modf_result_vec4 tint_modf(vec4 param_0) {
+ modf_result_vec4 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_ec2dbc() {
+ vec4 arg_0 = vec4(0.0f);
+ modf_result_vec4 res = tint_modf(arg_0);
+}
+
+void fragment_main() {
+ modf_ec2dbc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct modf_result_vec4 {
+ vec4 fract;
+ vec4 whole;
+};
+
+modf_result_vec4 tint_modf(vec4 param_0) {
+ modf_result_vec4 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_ec2dbc() {
+ vec4 arg_0 = vec4(0.0f);
+ modf_result_vec4 res = tint_modf(arg_0);
+}
+
+void compute_main() {
+ modf_ec2dbc();
+}
+
+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/modf/ec2dbc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.hlsl
new file mode 100644
index 0000000..fa4c203
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct modf_result_vec4 {
+ float4 fract;
+ float4 whole;
+};
+modf_result_vec4 tint_modf(float4 param_0) {
+ float4 whole;
+ float4 fract = modf(param_0, whole);
+ modf_result_vec4 result = {fract, whole};
+ return result;
+}
+
+void modf_ec2dbc() {
+ float4 arg_0 = (0.0f).xxxx;
+ modf_result_vec4 res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ modf_ec2dbc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ modf_ec2dbc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ modf_ec2dbc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl
new file mode 100644
index 0000000..ee835c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct modf_result_vec4 {
+ float4 fract;
+ float4 whole;
+};
+modf_result_vec4 tint_modf(float4 param_0) {
+ float4 whole;
+ float4 fract = modf(param_0, whole);
+ return {fract, whole};
+}
+
+void modf_ec2dbc() {
+ float4 arg_0 = float4(0.0f);
+ modf_result_vec4 res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ modf_ec2dbc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ modf_ec2dbc();
+ return;
+}
+
+kernel void compute_main() {
+ modf_ec2dbc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm
new file mode 100644
index 0000000..e29d176
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %modf_ec2dbc "modf_ec2dbc"
+ OpName %arg_0 "arg_0"
+ OpName %__modf_result_vec4 "__modf_result_vec4"
+ OpMemberName %__modf_result_vec4 0 "fract"
+ OpMemberName %__modf_result_vec4 1 "whole"
+ 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
+ OpMemberDecorate %__modf_result_vec4 0 Offset 0
+ OpMemberDecorate %__modf_result_vec4 1 Offset 16
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+%__modf_result_vec4 = OpTypeStruct %v4float %v4float
+%_ptr_Function___modf_result_vec4 = OpTypePointer Function %__modf_result_vec4
+ %21 = OpConstantNull %__modf_result_vec4
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%modf_ec2dbc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function___modf_result_vec4 Function %21
+ OpStore %arg_0 %5
+ %18 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %__modf_result_vec4 %17 ModfStruct %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %modf_ec2dbc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %modf_ec2dbc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %modf_ec2dbc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl
new file mode 100644
index 0000000..47cd800
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/ec2dbc.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn modf_ec2dbc() {
+ var arg_0 = vec4<f32>();
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_ec2dbc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_ec2dbc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_ec2dbc();
+}
diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl
new file mode 100644
index 0000000..7111dba
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn modf(vec<2, f32>) -> __modf_result_vec<2>
+fn modf_f5f20d() {
+ var arg_0 = vec2<f32>();
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_f5f20d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_f5f20d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_f5f20d();
+}
diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl
new file mode 100644
index 0000000..9cff880
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.glsl
@@ -0,0 +1,88 @@
+#version 310 es
+
+struct modf_result_vec2 {
+ vec2 fract;
+ vec2 whole;
+};
+
+modf_result_vec2 tint_modf(vec2 param_0) {
+ modf_result_vec2 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_f5f20d() {
+ vec2 arg_0 = vec2(0.0f);
+ modf_result_vec2 res = tint_modf(arg_0);
+}
+
+vec4 vertex_main() {
+ modf_f5f20d();
+ 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;
+
+struct modf_result_vec2 {
+ vec2 fract;
+ vec2 whole;
+};
+
+modf_result_vec2 tint_modf(vec2 param_0) {
+ modf_result_vec2 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_f5f20d() {
+ vec2 arg_0 = vec2(0.0f);
+ modf_result_vec2 res = tint_modf(arg_0);
+}
+
+void fragment_main() {
+ modf_f5f20d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct modf_result_vec2 {
+ vec2 fract;
+ vec2 whole;
+};
+
+modf_result_vec2 tint_modf(vec2 param_0) {
+ modf_result_vec2 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void modf_f5f20d() {
+ vec2 arg_0 = vec2(0.0f);
+ modf_result_vec2 res = tint_modf(arg_0);
+}
+
+void compute_main() {
+ modf_f5f20d();
+}
+
+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/modf/f5f20d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.hlsl
new file mode 100644
index 0000000..0827e24
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.hlsl
@@ -0,0 +1,42 @@
+struct modf_result_vec2 {
+ float2 fract;
+ float2 whole;
+};
+modf_result_vec2 tint_modf(float2 param_0) {
+ float2 whole;
+ float2 fract = modf(param_0, whole);
+ modf_result_vec2 result = {fract, whole};
+ return result;
+}
+
+void modf_f5f20d() {
+ float2 arg_0 = (0.0f).xx;
+ modf_result_vec2 res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ modf_f5f20d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ modf_f5f20d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ modf_f5f20d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl
new file mode 100644
index 0000000..104caf8
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.msl
@@ -0,0 +1,45 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+struct modf_result_vec2 {
+ float2 fract;
+ float2 whole;
+};
+modf_result_vec2 tint_modf(float2 param_0) {
+ float2 whole;
+ float2 fract = modf(param_0, whole);
+ return {fract, whole};
+}
+
+void modf_f5f20d() {
+ float2 arg_0 = float2(0.0f);
+ modf_result_vec2 res = tint_modf(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ modf_f5f20d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ modf_f5f20d();
+ return;
+}
+
+kernel void compute_main() {
+ modf_f5f20d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm
new file mode 100644
index 0000000..474fced
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %modf_f5f20d "modf_f5f20d"
+ OpName %arg_0 "arg_0"
+ OpName %__modf_result_vec2 "__modf_result_vec2"
+ OpMemberName %__modf_result_vec2 0 "fract"
+ OpMemberName %__modf_result_vec2 1 "whole"
+ 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
+ OpMemberDecorate %__modf_result_vec2 0 Offset 0
+ OpMemberDecorate %__modf_result_vec2 1 Offset 8
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%__modf_result_vec2 = OpTypeStruct %v2float %v2float
+%_ptr_Function___modf_result_vec2 = OpTypePointer Function %__modf_result_vec2
+ %23 = OpConstantNull %__modf_result_vec2
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%modf_f5f20d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function___modf_result_vec2 Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %__modf_result_vec2 %19 ModfStruct %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %modf_f5f20d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %modf_f5f20d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %modf_f5f20d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl
new file mode 100644
index 0000000..b31bbf2
--- /dev/null
+++ b/test/tint/builtins/gen/var/modf/f5f20d.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn modf_f5f20d() {
+ var arg_0 = vec2<f32>();
+ var res = modf(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ modf_f5f20d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ modf_f5f20d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ modf_f5f20d();
+}
diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl
new file mode 100644
index 0000000..a4b5e1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn normalize(vec<3, f32>) -> vec<3, f32>
+fn normalize_64d8c0() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = normalize(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ normalize_64d8c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ normalize_64d8c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ normalize_64d8c0();
+}
diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl
new file mode 100644
index 0000000..3ec8eac
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void normalize_64d8c0() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = normalize(arg_0);
+}
+
+vec4 vertex_main() {
+ normalize_64d8c0();
+ 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;
+
+void normalize_64d8c0() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = normalize(arg_0);
+}
+
+void fragment_main() {
+ normalize_64d8c0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void normalize_64d8c0() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = normalize(arg_0);
+}
+
+void compute_main() {
+ normalize_64d8c0();
+}
+
+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/normalize/64d8c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.hlsl
new file mode 100644
index 0000000..973bdd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void normalize_64d8c0() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = normalize(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ normalize_64d8c0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ normalize_64d8c0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ normalize_64d8c0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl
new file mode 100644
index 0000000..c29bdaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void normalize_64d8c0() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = normalize(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ normalize_64d8c0();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ normalize_64d8c0();
+ return;
+}
+
+kernel void compute_main() {
+ normalize_64d8c0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm
new file mode 100644
index 0000000..5f6e51d
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %normalize_64d8c0 "normalize_64d8c0"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%normalize_64d8c0 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Normalize %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %normalize_64d8c0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %normalize_64d8c0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %normalize_64d8c0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl
new file mode 100644
index 0000000..189ccda
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/64d8c0.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn normalize_64d8c0() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = normalize(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ normalize_64d8c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ normalize_64d8c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ normalize_64d8c0();
+}
diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl
new file mode 100644
index 0000000..af29580
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn normalize(vec<4, f32>) -> vec<4, f32>
+fn normalize_9a0aab() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = normalize(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ normalize_9a0aab();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ normalize_9a0aab();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ normalize_9a0aab();
+}
diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl
new file mode 100644
index 0000000..1fd1f91
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void normalize_9a0aab() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = normalize(arg_0);
+}
+
+vec4 vertex_main() {
+ normalize_9a0aab();
+ 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;
+
+void normalize_9a0aab() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = normalize(arg_0);
+}
+
+void fragment_main() {
+ normalize_9a0aab();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void normalize_9a0aab() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = normalize(arg_0);
+}
+
+void compute_main() {
+ normalize_9a0aab();
+}
+
+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/normalize/9a0aab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.hlsl
new file mode 100644
index 0000000..080baf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void normalize_9a0aab() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = normalize(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ normalize_9a0aab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ normalize_9a0aab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ normalize_9a0aab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl
new file mode 100644
index 0000000..7a42fc0
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void normalize_9a0aab() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = normalize(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ normalize_9a0aab();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ normalize_9a0aab();
+ return;
+}
+
+kernel void compute_main() {
+ normalize_9a0aab();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm
new file mode 100644
index 0000000..1711dc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %normalize_9a0aab "normalize_9a0aab"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%normalize_9a0aab = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Normalize %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %normalize_9a0aab
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %normalize_9a0aab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %normalize_9a0aab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl
new file mode 100644
index 0000000..3e8d2c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/9a0aab.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn normalize_9a0aab() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = normalize(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ normalize_9a0aab();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ normalize_9a0aab();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ normalize_9a0aab();
+}
diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl
new file mode 100644
index 0000000..018f437
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn normalize(vec<2, f32>) -> vec<2, f32>
+fn normalize_fc2ef1() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = normalize(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ normalize_fc2ef1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ normalize_fc2ef1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ normalize_fc2ef1();
+}
diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl
new file mode 100644
index 0000000..a4726cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void normalize_fc2ef1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = normalize(arg_0);
+}
+
+vec4 vertex_main() {
+ normalize_fc2ef1();
+ 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;
+
+void normalize_fc2ef1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = normalize(arg_0);
+}
+
+void fragment_main() {
+ normalize_fc2ef1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void normalize_fc2ef1() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = normalize(arg_0);
+}
+
+void compute_main() {
+ normalize_fc2ef1();
+}
+
+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/normalize/fc2ef1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.hlsl
new file mode 100644
index 0000000..6ec72e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void normalize_fc2ef1() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = normalize(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ normalize_fc2ef1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ normalize_fc2ef1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ normalize_fc2ef1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl
new file mode 100644
index 0000000..88ebab8
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void normalize_fc2ef1() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = normalize(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ normalize_fc2ef1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ normalize_fc2ef1();
+ return;
+}
+
+kernel void compute_main() {
+ normalize_fc2ef1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm
new file mode 100644
index 0000000..bed8056c
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %normalize_fc2ef1 "normalize_fc2ef1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%normalize_fc2ef1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Normalize %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %normalize_fc2ef1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %normalize_fc2ef1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %normalize_fc2ef1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl
new file mode 100644
index 0000000..ccaf220
--- /dev/null
+++ b/test/tint/builtins/gen/var/normalize/fc2ef1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn normalize_fc2ef1() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = normalize(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ normalize_fc2ef1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ normalize_fc2ef1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ normalize_fc2ef1();
+}
diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl
new file mode 100644
index 0000000..7d379ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pack2x16float(vec2<f32>) -> u32
+fn pack2x16float_0e97b3() {
+ var arg_0 = vec2<f32>();
+ var res: u32 = pack2x16float(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack2x16float_0e97b3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack2x16float_0e97b3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack2x16float_0e97b3();
+}
diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl
new file mode 100644
index 0000000..ccefb26
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void pack2x16float_0e97b3() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packHalf2x16(arg_0);
+}
+
+vec4 vertex_main() {
+ pack2x16float_0e97b3();
+ 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;
+
+void pack2x16float_0e97b3() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packHalf2x16(arg_0);
+}
+
+void fragment_main() {
+ pack2x16float_0e97b3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pack2x16float_0e97b3() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packHalf2x16(arg_0);
+}
+
+void compute_main() {
+ pack2x16float_0e97b3();
+}
+
+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/pack2x16float/0e97b3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.hlsl
new file mode 100644
index 0000000..649e6f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+uint tint_pack2x16float(float2 param_0) {
+ uint2 i = f32tof16(param_0);
+ return i.x | (i.y << 16);
+}
+
+void pack2x16float_0e97b3() {
+ float2 arg_0 = (0.0f).xx;
+ uint res = tint_pack2x16float(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pack2x16float_0e97b3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pack2x16float_0e97b3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pack2x16float_0e97b3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl
new file mode 100644
index 0000000..d72649a
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pack2x16float_0e97b3() {
+ float2 arg_0 = float2(0.0f);
+ uint res = as_type<uint>(half2(arg_0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pack2x16float_0e97b3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pack2x16float_0e97b3();
+ return;
+}
+
+kernel void compute_main() {
+ pack2x16float_0e97b3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm
new file mode 100644
index 0000000..7855476
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %pack2x16float_0e97b3 "pack2x16float_0e97b3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %23 = OpConstantNull %uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%pack2x16float_0e97b3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_uint Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %uint %19 PackHalf2x16 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %pack2x16float_0e97b3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %pack2x16float_0e97b3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %pack2x16float_0e97b3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl
new file mode 100644
index 0000000..faab29a
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16float/0e97b3.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn pack2x16float_0e97b3() {
+ var arg_0 = vec2<f32>();
+ var res : u32 = pack2x16float(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack2x16float_0e97b3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack2x16float_0e97b3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack2x16float_0e97b3();
+}
diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl
new file mode 100644
index 0000000..4bba23e
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pack2x16snorm(vec2<f32>) -> u32
+fn pack2x16snorm_6c169b() {
+ var arg_0 = vec2<f32>();
+ var res: u32 = pack2x16snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack2x16snorm_6c169b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack2x16snorm_6c169b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack2x16snorm_6c169b();
+}
diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl
new file mode 100644
index 0000000..06e70da
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void pack2x16snorm_6c169b() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packSnorm2x16(arg_0);
+}
+
+vec4 vertex_main() {
+ pack2x16snorm_6c169b();
+ 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;
+
+void pack2x16snorm_6c169b() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packSnorm2x16(arg_0);
+}
+
+void fragment_main() {
+ pack2x16snorm_6c169b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pack2x16snorm_6c169b() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packSnorm2x16(arg_0);
+}
+
+void compute_main() {
+ pack2x16snorm_6c169b();
+}
+
+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/pack2x16snorm/6c169b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.hlsl
new file mode 100644
index 0000000..c9a6e51
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+uint tint_pack2x16snorm(float2 param_0) {
+ int2 i = int2(round(clamp(param_0, -1.0, 1.0) * 32767.0)) & 0xffff;
+ return asuint(i.x | i.y << 16);
+}
+
+void pack2x16snorm_6c169b() {
+ float2 arg_0 = (0.0f).xx;
+ uint res = tint_pack2x16snorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pack2x16snorm_6c169b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pack2x16snorm_6c169b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pack2x16snorm_6c169b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl
new file mode 100644
index 0000000..64c72cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pack2x16snorm_6c169b() {
+ float2 arg_0 = float2(0.0f);
+ uint res = pack_float_to_snorm2x16(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pack2x16snorm_6c169b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pack2x16snorm_6c169b();
+ return;
+}
+
+kernel void compute_main() {
+ pack2x16snorm_6c169b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm
new file mode 100644
index 0000000..daad82d
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %pack2x16snorm_6c169b "pack2x16snorm_6c169b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %23 = OpConstantNull %uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%pack2x16snorm_6c169b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_uint Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %uint %19 PackSnorm2x16 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %pack2x16snorm_6c169b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %pack2x16snorm_6c169b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %pack2x16snorm_6c169b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl
new file mode 100644
index 0000000..c3e4cd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16snorm/6c169b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn pack2x16snorm_6c169b() {
+ var arg_0 = vec2<f32>();
+ var res : u32 = pack2x16snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack2x16snorm_6c169b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack2x16snorm_6c169b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack2x16snorm_6c169b();
+}
diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl
new file mode 100644
index 0000000..e00776c
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pack2x16unorm(vec2<f32>) -> u32
+fn pack2x16unorm_0f08e4() {
+ var arg_0 = vec2<f32>();
+ var res: u32 = pack2x16unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack2x16unorm_0f08e4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack2x16unorm_0f08e4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack2x16unorm_0f08e4();
+}
diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl
new file mode 100644
index 0000000..374bacf
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void pack2x16unorm_0f08e4() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packUnorm2x16(arg_0);
+}
+
+vec4 vertex_main() {
+ pack2x16unorm_0f08e4();
+ 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;
+
+void pack2x16unorm_0f08e4() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packUnorm2x16(arg_0);
+}
+
+void fragment_main() {
+ pack2x16unorm_0f08e4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pack2x16unorm_0f08e4() {
+ vec2 arg_0 = vec2(0.0f);
+ uint res = packUnorm2x16(arg_0);
+}
+
+void compute_main() {
+ pack2x16unorm_0f08e4();
+}
+
+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/pack2x16unorm/0f08e4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.hlsl
new file mode 100644
index 0000000..3f37f6a
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+uint tint_pack2x16unorm(float2 param_0) {
+ uint2 i = uint2(round(clamp(param_0, 0.0, 1.0) * 65535.0));
+ return (i.x | i.y << 16);
+}
+
+void pack2x16unorm_0f08e4() {
+ float2 arg_0 = (0.0f).xx;
+ uint res = tint_pack2x16unorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pack2x16unorm_0f08e4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pack2x16unorm_0f08e4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pack2x16unorm_0f08e4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl
new file mode 100644
index 0000000..5433a6d
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pack2x16unorm_0f08e4() {
+ float2 arg_0 = float2(0.0f);
+ uint res = pack_float_to_unorm2x16(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pack2x16unorm_0f08e4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pack2x16unorm_0f08e4();
+ return;
+}
+
+kernel void compute_main() {
+ pack2x16unorm_0f08e4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm
new file mode 100644
index 0000000..6fd23d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %pack2x16unorm_0f08e4 "pack2x16unorm_0f08e4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %23 = OpConstantNull %uint
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%pack2x16unorm_0f08e4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_uint Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %uint %19 PackUnorm2x16 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %pack2x16unorm_0f08e4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %pack2x16unorm_0f08e4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %pack2x16unorm_0f08e4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl
new file mode 100644
index 0000000..eb131fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack2x16unorm/0f08e4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn pack2x16unorm_0f08e4() {
+ var arg_0 = vec2<f32>();
+ var res : u32 = pack2x16unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack2x16unorm_0f08e4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack2x16unorm_0f08e4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack2x16unorm_0f08e4();
+}
diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl
new file mode 100644
index 0000000..f027dfd
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pack4x8snorm(vec4<f32>) -> u32
+fn pack4x8snorm_4d22e7() {
+ var arg_0 = vec4<f32>();
+ var res: u32 = pack4x8snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack4x8snorm_4d22e7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack4x8snorm_4d22e7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack4x8snorm_4d22e7();
+}
diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl
new file mode 100644
index 0000000..d7f6483
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void pack4x8snorm_4d22e7() {
+ vec4 arg_0 = vec4(0.0f);
+ uint res = packSnorm4x8(arg_0);
+}
+
+vec4 vertex_main() {
+ pack4x8snorm_4d22e7();
+ 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;
+
+void pack4x8snorm_4d22e7() {
+ vec4 arg_0 = vec4(0.0f);
+ uint res = packSnorm4x8(arg_0);
+}
+
+void fragment_main() {
+ pack4x8snorm_4d22e7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pack4x8snorm_4d22e7() {
+ vec4 arg_0 = vec4(0.0f);
+ uint res = packSnorm4x8(arg_0);
+}
+
+void compute_main() {
+ pack4x8snorm_4d22e7();
+}
+
+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/pack4x8snorm/4d22e7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.hlsl
new file mode 100644
index 0000000..bdf414b
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+uint tint_pack4x8snorm(float4 param_0) {
+ int4 i = int4(round(clamp(param_0, -1.0, 1.0) * 127.0)) & 0xff;
+ return asuint(i.x | i.y << 8 | i.z << 16 | i.w << 24);
+}
+
+void pack4x8snorm_4d22e7() {
+ float4 arg_0 = (0.0f).xxxx;
+ uint res = tint_pack4x8snorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pack4x8snorm_4d22e7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pack4x8snorm_4d22e7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pack4x8snorm_4d22e7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl
new file mode 100644
index 0000000..5463f99
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pack4x8snorm_4d22e7() {
+ float4 arg_0 = float4(0.0f);
+ uint res = pack_float_to_snorm4x8(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pack4x8snorm_4d22e7();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pack4x8snorm_4d22e7();
+ return;
+}
+
+kernel void compute_main() {
+ pack4x8snorm_4d22e7();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm
new file mode 100644
index 0000000..74247cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %pack4x8snorm_4d22e7 "pack4x8snorm_4d22e7"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%pack4x8snorm_4d22e7 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_uint Function %21
+ OpStore %arg_0 %5
+ %18 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %uint %17 PackSnorm4x8 %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %pack4x8snorm_4d22e7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %pack4x8snorm_4d22e7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %pack4x8snorm_4d22e7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl
new file mode 100644
index 0000000..18df3db
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8snorm/4d22e7.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn pack4x8snorm_4d22e7() {
+ var arg_0 = vec4<f32>();
+ var res : u32 = pack4x8snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack4x8snorm_4d22e7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack4x8snorm_4d22e7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack4x8snorm_4d22e7();
+}
diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl
new file mode 100644
index 0000000..96dd055
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pack4x8unorm(vec4<f32>) -> u32
+fn pack4x8unorm_95c456() {
+ var arg_0 = vec4<f32>();
+ var res: u32 = pack4x8unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack4x8unorm_95c456();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack4x8unorm_95c456();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack4x8unorm_95c456();
+}
diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl
new file mode 100644
index 0000000..8e9eb90
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void pack4x8unorm_95c456() {
+ vec4 arg_0 = vec4(0.0f);
+ uint res = packUnorm4x8(arg_0);
+}
+
+vec4 vertex_main() {
+ pack4x8unorm_95c456();
+ 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;
+
+void pack4x8unorm_95c456() {
+ vec4 arg_0 = vec4(0.0f);
+ uint res = packUnorm4x8(arg_0);
+}
+
+void fragment_main() {
+ pack4x8unorm_95c456();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pack4x8unorm_95c456() {
+ vec4 arg_0 = vec4(0.0f);
+ uint res = packUnorm4x8(arg_0);
+}
+
+void compute_main() {
+ pack4x8unorm_95c456();
+}
+
+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/pack4x8unorm/95c456.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.hlsl
new file mode 100644
index 0000000..80d63c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+uint tint_pack4x8unorm(float4 param_0) {
+ uint4 i = uint4(round(clamp(param_0, 0.0, 1.0) * 255.0));
+ return (i.x | i.y << 8 | i.z << 16 | i.w << 24);
+}
+
+void pack4x8unorm_95c456() {
+ float4 arg_0 = (0.0f).xxxx;
+ uint res = tint_pack4x8unorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pack4x8unorm_95c456();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pack4x8unorm_95c456();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pack4x8unorm_95c456();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl
new file mode 100644
index 0000000..faab6f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pack4x8unorm_95c456() {
+ float4 arg_0 = float4(0.0f);
+ uint res = pack_float_to_unorm4x8(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pack4x8unorm_95c456();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pack4x8unorm_95c456();
+ return;
+}
+
+kernel void compute_main() {
+ pack4x8unorm_95c456();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm
new file mode 100644
index 0000000..cc7d9ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %pack4x8unorm_95c456 "pack4x8unorm_95c456"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint = OpTypeInt 32 0
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %21 = OpConstantNull %uint
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%pack4x8unorm_95c456 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_uint Function %21
+ OpStore %arg_0 %5
+ %18 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %uint %17 PackUnorm4x8 %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %pack4x8unorm_95c456
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %pack4x8unorm_95c456
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %pack4x8unorm_95c456
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl
new file mode 100644
index 0000000..fab95be
--- /dev/null
+++ b/test/tint/builtins/gen/var/pack4x8unorm/95c456.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn pack4x8unorm_95c456() {
+ var arg_0 = vec4<f32>();
+ var res : u32 = pack4x8unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pack4x8unorm_95c456();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pack4x8unorm_95c456();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pack4x8unorm_95c456();
+}
diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl b/test/tint/builtins/gen/var/pow/04a908.wgsl
new file mode 100644
index 0000000..884e6f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/04a908.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pow(vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn pow_04a908() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: vec4<f32> = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_04a908();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_04a908();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_04a908();
+}
diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl
new file mode 100644
index 0000000..2784abe
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void pow_04a908() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = pow(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ pow_04a908();
+ 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;
+
+void pow_04a908() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = pow(arg_0, arg_1);
+}
+
+void fragment_main() {
+ pow_04a908();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_04a908() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = pow(arg_0, arg_1);
+}
+
+void compute_main() {
+ pow_04a908();
+}
+
+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/pow/04a908.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.hlsl
new file mode 100644
index 0000000..1b851b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void pow_04a908() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_04a908();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pow_04a908();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_04a908();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl
new file mode 100644
index 0000000..4a9226d
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_04a908() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_04a908();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pow_04a908();
+ return;
+}
+
+kernel void compute_main() {
+ pow_04a908();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm
new file mode 100644
index 0000000..065f1f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %pow_04a908 "pow_04a908"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %pow_04a908 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %v4float %17 Pow %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %pow_04a908
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_04a908
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %pow_04a908
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl
new file mode 100644
index 0000000..1409845
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/04a908.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_04a908() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : vec4<f32> = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_04a908();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_04a908();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_04a908();
+}
diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl b/test/tint/builtins/gen/var/pow/46e029.wgsl
new file mode 100644
index 0000000..c2bee4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/46e029.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pow(f32, f32) -> f32
+fn pow_46e029() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res: f32 = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_46e029();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_46e029();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_46e029();
+}
diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl
new file mode 100644
index 0000000..ba9d17e
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void pow_46e029() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = pow(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ pow_46e029();
+ 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;
+
+void pow_46e029() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = pow(arg_0, arg_1);
+}
+
+void fragment_main() {
+ pow_46e029();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_46e029() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = pow(arg_0, arg_1);
+}
+
+void compute_main() {
+ pow_46e029();
+}
+
+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/pow/46e029.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.hlsl
new file mode 100644
index 0000000..82b73ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void pow_46e029() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_46e029();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pow_46e029();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_46e029();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl
new file mode 100644
index 0000000..2cac6c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_46e029() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_46e029();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pow_46e029();
+ return;
+}
+
+kernel void compute_main() {
+ pow_46e029();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm
new file mode 100644
index 0000000..cbf125f
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %pow_46e029 "pow_46e029"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+ %pow_46e029 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ %19 = OpLoad %float %arg_0
+ %20 = OpLoad %float %arg_1
+ %17 = OpExtInst %float %18 Pow %19 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %pow_46e029
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_46e029
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %pow_46e029
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl
new file mode 100644
index 0000000..85ddd37
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/46e029.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_46e029() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res : f32 = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_46e029();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_46e029();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_46e029();
+}
diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl
new file mode 100644
index 0000000..5d991fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pow(vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn pow_4a46c9() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_4a46c9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_4a46c9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_4a46c9();
+}
diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl
new file mode 100644
index 0000000..355dd52
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void pow_4a46c9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = pow(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ pow_4a46c9();
+ 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;
+
+void pow_4a46c9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = pow(arg_0, arg_1);
+}
+
+void fragment_main() {
+ pow_4a46c9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_4a46c9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = pow(arg_0, arg_1);
+}
+
+void compute_main() {
+ pow_4a46c9();
+}
+
+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/pow/4a46c9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.hlsl
new file mode 100644
index 0000000..627b2e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void pow_4a46c9() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_4a46c9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pow_4a46c9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_4a46c9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl
new file mode 100644
index 0000000..fe98d46
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_4a46c9() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_4a46c9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pow_4a46c9();
+ return;
+}
+
+kernel void compute_main() {
+ pow_4a46c9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm
new file mode 100644
index 0000000..aff9061
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %pow_4a46c9 "pow_4a46c9"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %pow_4a46c9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 Pow %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %pow_4a46c9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %pow_4a46c9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %pow_4a46c9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl
new file mode 100644
index 0000000..71bc724
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/4a46c9.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_4a46c9() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_4a46c9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_4a46c9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_4a46c9();
+}
diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl
new file mode 100644
index 0000000..2070ec8
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn pow(vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn pow_e60ea5() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: vec2<f32> = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_e60ea5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_e60ea5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_e60ea5();
+}
diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl
new file mode 100644
index 0000000..b1537ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void pow_e60ea5() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = pow(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ pow_e60ea5();
+ 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;
+
+void pow_e60ea5() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = pow(arg_0, arg_1);
+}
+
+void fragment_main() {
+ pow_e60ea5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_e60ea5() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = pow(arg_0, arg_1);
+}
+
+void compute_main() {
+ pow_e60ea5();
+}
+
+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/pow/e60ea5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.hlsl
new file mode 100644
index 0000000..696617b
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void pow_e60ea5() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_e60ea5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ pow_e60ea5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_e60ea5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl
new file mode 100644
index 0000000..a0a2d50
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_e60ea5() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 res = pow(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_e60ea5();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ pow_e60ea5();
+ return;
+}
+
+kernel void compute_main() {
+ pow_e60ea5();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm
new file mode 100644
index 0000000..0d1a493
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %pow_e60ea5 "pow_e60ea5"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %pow_e60ea5 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %v2float %19 Pow %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %pow_e60ea5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %pow_e60ea5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %pow_e60ea5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl
new file mode 100644
index 0000000..65321f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e60ea5.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_e60ea5() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : vec2<f32> = pow(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_e60ea5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ pow_e60ea5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ pow_e60ea5();
+}
diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl
new file mode 100644
index 0000000..597c22d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn radians(vec<4, f32>) -> vec<4, f32>
+fn radians_09b7fc() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_09b7fc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_09b7fc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_09b7fc();
+}
diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl
new file mode 100644
index 0000000..d0f2979
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+vec4 tint_radians(vec4 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_09b7fc() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tint_radians(arg_0);
+}
+
+vec4 vertex_main() {
+ radians_09b7fc();
+ 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;
+
+vec4 tint_radians(vec4 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_09b7fc() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tint_radians(arg_0);
+}
+
+void fragment_main() {
+ radians_09b7fc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+vec4 tint_radians(vec4 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_09b7fc() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tint_radians(arg_0);
+}
+
+void compute_main() {
+ radians_09b7fc();
+}
+
+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/radians/09b7fc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.hlsl
new file mode 100644
index 0000000..4f9b37d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float4 tint_radians(float4 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_09b7fc() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_09b7fc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ radians_09b7fc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_09b7fc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl
new file mode 100644
index 0000000..69bafde
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float4 tint_radians(float4 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_09b7fc() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_09b7fc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ radians_09b7fc();
+ return;
+}
+
+kernel void compute_main() {
+ radians_09b7fc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm
new file mode 100644
index 0000000..08873d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %radians_09b7fc "radians_09b7fc"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_09b7fc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Radians %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %radians_09b7fc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_09b7fc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_09b7fc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl
new file mode 100644
index 0000000..534b5a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/09b7fc.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_09b7fc() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_09b7fc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_09b7fc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_09b7fc();
+}
diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl b/test/tint/builtins/gen/var/radians/61687a.wgsl
new file mode 100644
index 0000000..d757077b
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/61687a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn radians(vec<2, f32>) -> vec<2, f32>
+fn radians_61687a() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_61687a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_61687a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_61687a();
+}
diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl
new file mode 100644
index 0000000..4e6f019
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+vec2 tint_radians(vec2 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_61687a() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tint_radians(arg_0);
+}
+
+vec4 vertex_main() {
+ radians_61687a();
+ 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;
+
+vec2 tint_radians(vec2 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_61687a() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tint_radians(arg_0);
+}
+
+void fragment_main() {
+ radians_61687a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+vec2 tint_radians(vec2 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_61687a() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tint_radians(arg_0);
+}
+
+void compute_main() {
+ radians_61687a();
+}
+
+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/radians/61687a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.hlsl
new file mode 100644
index 0000000..6c128af
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float2 tint_radians(float2 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_61687a() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_61687a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ radians_61687a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_61687a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl
new file mode 100644
index 0000000..8f58a4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float2 tint_radians(float2 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_61687a() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_61687a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ radians_61687a();
+ return;
+}
+
+kernel void compute_main() {
+ radians_61687a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm
new file mode 100644
index 0000000..2d21f8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %radians_61687a "radians_61687a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_61687a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Radians %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %radians_61687a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %radians_61687a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %radians_61687a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl
new file mode 100644
index 0000000..6591863
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/61687a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_61687a() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_61687a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_61687a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_61687a();
+}
diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl
new file mode 100644
index 0000000..58d83ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn radians(f32) -> f32
+fn radians_6b0ff2() {
+ var arg_0 = 1.0;
+ var res: f32 = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_6b0ff2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_6b0ff2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_6b0ff2();
+}
diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl
new file mode 100644
index 0000000..bac70b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+float tint_radians(float param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_6b0ff2() {
+ float arg_0 = 1.0f;
+ float res = tint_radians(arg_0);
+}
+
+vec4 vertex_main() {
+ radians_6b0ff2();
+ 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;
+
+float tint_radians(float param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_6b0ff2() {
+ float arg_0 = 1.0f;
+ float res = tint_radians(arg_0);
+}
+
+void fragment_main() {
+ radians_6b0ff2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+float tint_radians(float param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_6b0ff2() {
+ float arg_0 = 1.0f;
+ float res = tint_radians(arg_0);
+}
+
+void compute_main() {
+ radians_6b0ff2();
+}
+
+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/radians/6b0ff2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.hlsl
new file mode 100644
index 0000000..e10a17d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float tint_radians(float param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_6b0ff2() {
+ float arg_0 = 1.0f;
+ float res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_6b0ff2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ radians_6b0ff2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_6b0ff2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl
new file mode 100644
index 0000000..8a969a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float tint_radians(float param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_6b0ff2() {
+ float arg_0 = 1.0f;
+ float res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_6b0ff2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ radians_6b0ff2();
+ return;
+}
+
+kernel void compute_main() {
+ radians_6b0ff2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm
new file mode 100644
index 0000000..ddbe63a
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %radians_6b0ff2 "radians_6b0ff2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%radians_6b0ff2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Radians %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %radians_6b0ff2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_6b0ff2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_6b0ff2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl
new file mode 100644
index 0000000..ab1a387
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/6b0ff2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_6b0ff2() {
+ var arg_0 = 1.0;
+ var res : f32 = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_6b0ff2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_6b0ff2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_6b0ff2();
+}
diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl b/test/tint/builtins/gen/var/radians/f96258.wgsl
new file mode 100644
index 0000000..77c37c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/f96258.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn radians(vec<3, f32>) -> vec<3, f32>
+fn radians_f96258() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_f96258();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_f96258();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_f96258();
+}
diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl
new file mode 100644
index 0000000..e0d0b28
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+vec3 tint_radians(vec3 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_f96258() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tint_radians(arg_0);
+}
+
+vec4 vertex_main() {
+ radians_f96258();
+ 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;
+
+vec3 tint_radians(vec3 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_f96258() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tint_radians(arg_0);
+}
+
+void fragment_main() {
+ radians_f96258();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+vec3 tint_radians(vec3 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+
+void radians_f96258() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tint_radians(arg_0);
+}
+
+void compute_main() {
+ radians_f96258();
+}
+
+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/radians/f96258.wgsl.expected.hlsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.hlsl
new file mode 100644
index 0000000..352a0b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+float3 tint_radians(float3 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_f96258() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_f96258();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ radians_f96258();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_f96258();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl
new file mode 100644
index 0000000..eb9013e
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.msl
@@ -0,0 +1,39 @@
+#include <metal_stdlib>
+
+using namespace metal;
+
+float3 tint_radians(float3 param_0) {
+ return param_0 * 0.017453292519943295474;
+}
+
+void radians_f96258() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = tint_radians(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_f96258();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ radians_f96258();
+ return;
+}
+
+kernel void compute_main() {
+ radians_f96258();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm
new file mode 100644
index 0000000..3c05455
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %radians_f96258 "radians_f96258"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_f96258 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Radians %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %radians_f96258
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %radians_f96258
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %radians_f96258
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl
new file mode 100644
index 0000000..eaf3040
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/f96258.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_f96258() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = radians(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_f96258();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ radians_f96258();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ radians_f96258();
+}
diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl
new file mode 100644
index 0000000..4eca0e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reflect(vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn reflect_05357e() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: vec4<f32> = reflect(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reflect_05357e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reflect_05357e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reflect_05357e();
+}
diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl
new file mode 100644
index 0000000..2b9cec1
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void reflect_05357e() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = reflect(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ reflect_05357e();
+ 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;
+
+void reflect_05357e() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = reflect(arg_0, arg_1);
+}
+
+void fragment_main() {
+ reflect_05357e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reflect_05357e() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = reflect(arg_0, arg_1);
+}
+
+void compute_main() {
+ reflect_05357e();
+}
+
+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/reflect/05357e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.hlsl
new file mode 100644
index 0000000..28d8c4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void reflect_05357e() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 res = reflect(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reflect_05357e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reflect_05357e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reflect_05357e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl
new file mode 100644
index 0000000..a0c716b
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reflect_05357e() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 res = reflect(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reflect_05357e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reflect_05357e();
+ return;
+}
+
+kernel void compute_main() {
+ reflect_05357e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm
new file mode 100644
index 0000000..b3c6c7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %reflect_05357e "reflect_05357e"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reflect_05357e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %v4float %17 Reflect %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reflect_05357e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reflect_05357e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reflect_05357e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl
new file mode 100644
index 0000000..2172c63
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/05357e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn reflect_05357e() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : vec4<f32> = reflect(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reflect_05357e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reflect_05357e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reflect_05357e();
+}
diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl
new file mode 100644
index 0000000..e522b9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reflect(vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn reflect_b61e10() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: vec2<f32> = reflect(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reflect_b61e10();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reflect_b61e10();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reflect_b61e10();
+}
diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl
new file mode 100644
index 0000000..716303e
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void reflect_b61e10() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = reflect(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ reflect_b61e10();
+ 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;
+
+void reflect_b61e10() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = reflect(arg_0, arg_1);
+}
+
+void fragment_main() {
+ reflect_b61e10();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reflect_b61e10() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = reflect(arg_0, arg_1);
+}
+
+void compute_main() {
+ reflect_b61e10();
+}
+
+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/reflect/b61e10.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.hlsl
new file mode 100644
index 0000000..c653e76
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void reflect_b61e10() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 res = reflect(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reflect_b61e10();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reflect_b61e10();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reflect_b61e10();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl
new file mode 100644
index 0000000..c2fe687
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reflect_b61e10() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 res = reflect(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reflect_b61e10();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reflect_b61e10();
+ return;
+}
+
+kernel void compute_main() {
+ reflect_b61e10();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm
new file mode 100644
index 0000000..268d649
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %reflect_b61e10 "reflect_b61e10"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reflect_b61e10 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %v2float %19 Reflect %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %reflect_b61e10
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %reflect_b61e10
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %reflect_b61e10
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl
new file mode 100644
index 0000000..3fca9bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/b61e10.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn reflect_b61e10() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : vec2<f32> = reflect(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reflect_b61e10();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reflect_b61e10();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reflect_b61e10();
+}
diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl
new file mode 100644
index 0000000..2bc5f6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reflect(vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn reflect_f47fdb() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = reflect(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reflect_f47fdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reflect_f47fdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reflect_f47fdb();
+}
diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl
new file mode 100644
index 0000000..1cb8b9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void reflect_f47fdb() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = reflect(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ reflect_f47fdb();
+ 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;
+
+void reflect_f47fdb() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = reflect(arg_0, arg_1);
+}
+
+void fragment_main() {
+ reflect_f47fdb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reflect_f47fdb() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = reflect(arg_0, arg_1);
+}
+
+void compute_main() {
+ reflect_f47fdb();
+}
+
+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/reflect/f47fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.hlsl
new file mode 100644
index 0000000..bf902cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void reflect_f47fdb() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = reflect(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reflect_f47fdb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reflect_f47fdb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reflect_f47fdb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl
new file mode 100644
index 0000000..abb89d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reflect_f47fdb() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = reflect(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reflect_f47fdb();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reflect_f47fdb();
+ return;
+}
+
+kernel void compute_main() {
+ reflect_f47fdb();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm
new file mode 100644
index 0000000..db5cf48
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %reflect_f47fdb "reflect_f47fdb"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reflect_f47fdb = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 Reflect %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %reflect_f47fdb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %reflect_f47fdb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %reflect_f47fdb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl
new file mode 100644
index 0000000..57b54ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/reflect/f47fdb.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn reflect_f47fdb() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = reflect(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reflect_f47fdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reflect_f47fdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reflect_f47fdb();
+}
diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl
new file mode 100644
index 0000000..0779089
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn refract(vec<4, f32>, vec<4, f32>, f32) -> vec<4, f32>
+fn refract_7e02e6() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = 1.0;
+ var res: vec4<f32> = refract(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ refract_7e02e6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ refract_7e02e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ refract_7e02e6();
+}
diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl
new file mode 100644
index 0000000..72c750d
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void refract_7e02e6() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float arg_2 = 1.0f;
+ vec4 res = refract(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ refract_7e02e6();
+ 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;
+
+void refract_7e02e6() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float arg_2 = 1.0f;
+ vec4 res = refract(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ refract_7e02e6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void refract_7e02e6() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ float arg_2 = 1.0f;
+ vec4 res = refract(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ refract_7e02e6();
+}
+
+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/refract/7e02e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.hlsl
new file mode 100644
index 0000000..87895ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void refract_7e02e6() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float arg_2 = 1.0f;
+ float4 res = refract(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ refract_7e02e6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ refract_7e02e6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ refract_7e02e6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl
new file mode 100644
index 0000000..c0304bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void refract_7e02e6() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float arg_2 = 1.0f;
+ float4 res = refract(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ refract_7e02e6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ refract_7e02e6();
+ return;
+}
+
+kernel void compute_main() {
+ refract_7e02e6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm
new file mode 100644
index 0000000..d40bbec
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %refract_7e02e6 "refract_7e02e6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %25 = OpTypeFunction %v4float
+%refract_7e02e6 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %float_1
+ %21 = OpLoad %v4float %arg_0
+ %22 = OpLoad %v4float %arg_1
+ %23 = OpLoad %float %arg_2
+ %19 = OpExtInst %v4float %20 Refract %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %refract_7e02e6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %refract_7e02e6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %refract_7e02e6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl
new file mode 100644
index 0000000..747e992
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/7e02e6.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn refract_7e02e6() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = 1.0;
+ var res : vec4<f32> = refract(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ refract_7e02e6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ refract_7e02e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ refract_7e02e6();
+}
diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl
new file mode 100644
index 0000000..e84c072
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn refract(vec<3, f32>, vec<3, f32>, f32) -> vec<3, f32>
+fn refract_cbc1d2() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = 1.0;
+ var res: vec3<f32> = refract(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ refract_cbc1d2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ refract_cbc1d2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ refract_cbc1d2();
+}
diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl
new file mode 100644
index 0000000..248a460
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void refract_cbc1d2() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float arg_2 = 1.0f;
+ vec3 res = refract(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ refract_cbc1d2();
+ 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;
+
+void refract_cbc1d2() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float arg_2 = 1.0f;
+ vec3 res = refract(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ refract_cbc1d2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void refract_cbc1d2() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ float arg_2 = 1.0f;
+ vec3 res = refract(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ refract_cbc1d2();
+}
+
+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/refract/cbc1d2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.hlsl
new file mode 100644
index 0000000..bf241e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void refract_cbc1d2() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float arg_2 = 1.0f;
+ float3 res = refract(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ refract_cbc1d2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ refract_cbc1d2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ refract_cbc1d2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl
new file mode 100644
index 0000000..e9d61c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void refract_cbc1d2() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float arg_2 = 1.0f;
+ float3 res = refract(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ refract_cbc1d2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ refract_cbc1d2();
+ return;
+}
+
+kernel void compute_main() {
+ refract_cbc1d2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0498ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %22 = OpExtInstImport "GLSL.std.450"
+ 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 %refract_cbc1d2 "refract_cbc1d2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %27 = OpTypeFunction %v4float
+%refract_cbc1d2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %float_1
+ %23 = OpLoad %v3float %arg_0
+ %24 = OpLoad %v3float %arg_1
+ %25 = OpLoad %float %arg_2
+ %21 = OpExtInst %v3float %22 Refract %23 %24 %25
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %refract_cbc1d2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %refract_cbc1d2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %refract_cbc1d2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl
new file mode 100644
index 0000000..d71d172
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cbc1d2.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn refract_cbc1d2() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = 1.0;
+ var res : vec3<f32> = refract(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ refract_cbc1d2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ refract_cbc1d2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ refract_cbc1d2();
+}
diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl
new file mode 100644
index 0000000..50675c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn refract(vec<2, f32>, vec<2, f32>, f32) -> vec<2, f32>
+fn refract_cd905f() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = 1.0;
+ var res: vec2<f32> = refract(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ refract_cd905f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ refract_cd905f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ refract_cd905f();
+}
diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl
new file mode 100644
index 0000000..906e9f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void refract_cd905f() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float arg_2 = 1.0f;
+ vec2 res = refract(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ refract_cd905f();
+ 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;
+
+void refract_cd905f() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float arg_2 = 1.0f;
+ vec2 res = refract(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ refract_cd905f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void refract_cd905f() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ float arg_2 = 1.0f;
+ vec2 res = refract(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ refract_cd905f();
+}
+
+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/refract/cd905f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.hlsl
new file mode 100644
index 0000000..6c5ef8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void refract_cd905f() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float arg_2 = 1.0f;
+ float2 res = refract(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ refract_cd905f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ refract_cd905f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ refract_cd905f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl
new file mode 100644
index 0000000..8f9e3f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void refract_cd905f() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float arg_2 = 1.0f;
+ float2 res = refract(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ refract_cd905f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ refract_cd905f();
+ return;
+}
+
+kernel void compute_main() {
+ refract_cd905f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm
new file mode 100644
index 0000000..c062222
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ %22 = OpExtInstImport "GLSL.std.450"
+ 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 %refract_cd905f "refract_cd905f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %27 = OpTypeFunction %v4float
+%refract_cd905f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %float_1
+ %23 = OpLoad %v2float %arg_0
+ %24 = OpLoad %v2float %arg_1
+ %25 = OpLoad %float %arg_2
+ %21 = OpExtInst %v2float %22 Refract %23 %24 %25
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %refract_cd905f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %33
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %refract_cd905f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %refract_cd905f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl
new file mode 100644
index 0000000..34cfbce
--- /dev/null
+++ b/test/tint/builtins/gen/var/refract/cd905f.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn refract_cd905f() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = 1.0;
+ var res : vec2<f32> = refract(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ refract_cd905f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ refract_cd905f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ refract_cd905f();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl
new file mode 100644
index 0000000..7d2ca95
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(vec<2, i32>) -> vec<2, i32>
+fn reverseBits_222177() {
+ var arg_0 = vec2<i32>();
+ var res: vec2<i32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_222177();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_222177();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_222177();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl
new file mode 100644
index 0000000..fe39948
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_222177() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_222177();
+ 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;
+
+void reverseBits_222177() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_222177();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_222177() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_222177();
+}
+
+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/reverseBits/222177.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.hlsl
new file mode 100644
index 0000000..0e6556f
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_222177() {
+ int2 arg_0 = (0).xx;
+ int2 res = asint(reversebits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_222177();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_222177();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_222177();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl
new file mode 100644
index 0000000..f1c5c14
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_222177() {
+ int2 arg_0 = int2(0);
+ int2 res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_222177();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_222177();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_222177();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm
new file mode 100644
index 0000000..68e48e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_222177 "reverseBits_222177"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_222177 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2int %arg_0
+ %18 = OpBitReverse %v2int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_222177
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_222177
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_222177
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl
new file mode 100644
index 0000000..40ebf3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/222177.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_222177() {
+ var arg_0 = vec2<i32>();
+ var res : vec2<i32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_222177();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_222177();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_222177();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl
new file mode 100644
index 0000000..93b2e48
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(vec<4, u32>) -> vec<4, u32>
+fn reverseBits_35fea9() {
+ var arg_0 = vec4<u32>();
+ var res: vec4<u32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_35fea9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_35fea9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_35fea9();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl
new file mode 100644
index 0000000..095e3c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_35fea9() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_35fea9();
+ 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;
+
+void reverseBits_35fea9() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_35fea9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_35fea9() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_35fea9();
+}
+
+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/reverseBits/35fea9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.hlsl
new file mode 100644
index 0000000..cfe9477
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_35fea9() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 res = reversebits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_35fea9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_35fea9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_35fea9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl
new file mode 100644
index 0000000..796e673
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_35fea9() {
+ uint4 arg_0 = uint4(0u);
+ uint4 res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_35fea9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_35fea9();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_35fea9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm
new file mode 100644
index 0000000..ca17455
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_35fea9 "reverseBits_35fea9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_35fea9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4uint %arg_0
+ %18 = OpBitReverse %v4uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_35fea9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_35fea9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_35fea9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl
new file mode 100644
index 0000000..b158c68
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/35fea9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_35fea9() {
+ var arg_0 = vec4<u32>();
+ var res : vec4<u32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_35fea9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_35fea9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_35fea9();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl
new file mode 100644
index 0000000..5ab35ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(vec<4, i32>) -> vec<4, i32>
+fn reverseBits_4dbd6f() {
+ var arg_0 = vec4<i32>();
+ var res: vec4<i32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_4dbd6f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_4dbd6f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_4dbd6f();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl
new file mode 100644
index 0000000..fe23a67
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_4dbd6f() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_4dbd6f();
+ 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;
+
+void reverseBits_4dbd6f() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_4dbd6f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_4dbd6f() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_4dbd6f();
+}
+
+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/reverseBits/4dbd6f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.hlsl
new file mode 100644
index 0000000..e892945
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_4dbd6f() {
+ int4 arg_0 = (0).xxxx;
+ int4 res = asint(reversebits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_4dbd6f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_4dbd6f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_4dbd6f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl
new file mode 100644
index 0000000..04ecef0
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_4dbd6f() {
+ int4 arg_0 = int4(0);
+ int4 res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_4dbd6f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_4dbd6f();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_4dbd6f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm
new file mode 100644
index 0000000..c2d1c94
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_4dbd6f "reverseBits_4dbd6f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_4dbd6f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v4int %arg_0
+ %18 = OpBitReverse %v4int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_4dbd6f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_4dbd6f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_4dbd6f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl
new file mode 100644
index 0000000..fa97ef8
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/4dbd6f.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_4dbd6f() {
+ var arg_0 = vec4<i32>();
+ var res : vec4<i32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_4dbd6f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_4dbd6f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_4dbd6f();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl
new file mode 100644
index 0000000..9ea20f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(i32) -> i32
+fn reverseBits_7c4269() {
+ var arg_0 = 1;
+ var res: i32 = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_7c4269();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_7c4269();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_7c4269();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl
new file mode 100644
index 0000000..7f5a812
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_7c4269() {
+ int arg_0 = 1;
+ int res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_7c4269();
+ 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;
+
+void reverseBits_7c4269() {
+ int arg_0 = 1;
+ int res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_7c4269();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_7c4269() {
+ int arg_0 = 1;
+ int res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_7c4269();
+}
+
+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/reverseBits/7c4269.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.hlsl
new file mode 100644
index 0000000..c3ab61c
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_7c4269() {
+ int arg_0 = 1;
+ int res = asint(reversebits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_7c4269();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_7c4269();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_7c4269();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl
new file mode 100644
index 0000000..2fd16d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_7c4269() {
+ int arg_0 = 1;
+ int res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_7c4269();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_7c4269();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_7c4269();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm
new file mode 100644
index 0000000..bd35052
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_7c4269 "reverseBits_7c4269"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_7c4269 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ %19 = OpLoad %int %arg_0
+ %18 = OpBitReverse %int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_7c4269
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_7c4269
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_7c4269
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl
new file mode 100644
index 0000000..fdaa264
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/7c4269.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_7c4269() {
+ var arg_0 = 1;
+ var res : i32 = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_7c4269();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_7c4269();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_7c4269();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl
new file mode 100644
index 0000000..507b520
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(vec<3, u32>) -> vec<3, u32>
+fn reverseBits_a6ccd4() {
+ var arg_0 = vec3<u32>();
+ var res: vec3<u32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_a6ccd4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_a6ccd4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_a6ccd4();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl
new file mode 100644
index 0000000..cd9271e
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_a6ccd4() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_a6ccd4();
+ 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;
+
+void reverseBits_a6ccd4() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_a6ccd4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_a6ccd4() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_a6ccd4();
+}
+
+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/reverseBits/a6ccd4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.hlsl
new file mode 100644
index 0000000..7592e9c
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_a6ccd4() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 res = reversebits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_a6ccd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_a6ccd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_a6ccd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl
new file mode 100644
index 0000000..d2d54c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_a6ccd4() {
+ uint3 arg_0 = uint3(0u);
+ uint3 res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_a6ccd4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_a6ccd4();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_a6ccd4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm
new file mode 100644
index 0000000..db3b153
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_a6ccd4 "reverseBits_a6ccd4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_a6ccd4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3uint %arg_0
+ %18 = OpBitReverse %v3uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_a6ccd4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_a6ccd4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_a6ccd4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl
new file mode 100644
index 0000000..97f5879
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/a6ccd4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_a6ccd4() {
+ var arg_0 = vec3<u32>();
+ var res : vec3<u32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_a6ccd4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_a6ccd4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_a6ccd4();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl
new file mode 100644
index 0000000..8f348e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(vec<3, i32>) -> vec<3, i32>
+fn reverseBits_c21bc1() {
+ var arg_0 = vec3<i32>();
+ var res: vec3<i32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_c21bc1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_c21bc1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_c21bc1();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl
new file mode 100644
index 0000000..7ed60de
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_c21bc1() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_c21bc1();
+ 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;
+
+void reverseBits_c21bc1() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_c21bc1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_c21bc1() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_c21bc1();
+}
+
+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/reverseBits/c21bc1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.hlsl
new file mode 100644
index 0000000..1676f54
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_c21bc1() {
+ int3 arg_0 = (0).xxx;
+ int3 res = asint(reversebits(asuint(arg_0)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_c21bc1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_c21bc1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_c21bc1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl
new file mode 100644
index 0000000..3d23b80
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_c21bc1() {
+ int3 arg_0 = int3(0);
+ int3 res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_c21bc1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_c21bc1();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_c21bc1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm
new file mode 100644
index 0000000..71ecb17
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_c21bc1 "reverseBits_c21bc1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_c21bc1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v3int %arg_0
+ %18 = OpBitReverse %v3int %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_c21bc1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_c21bc1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_c21bc1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl
new file mode 100644
index 0000000..fe4a6c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/c21bc1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_c21bc1() {
+ var arg_0 = vec3<i32>();
+ var res : vec3<i32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_c21bc1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_c21bc1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_c21bc1();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl
new file mode 100644
index 0000000..5390408
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(vec<2, u32>) -> vec<2, u32>
+fn reverseBits_e1f4c1() {
+ var arg_0 = vec2<u32>();
+ var res: vec2<u32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_e1f4c1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_e1f4c1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_e1f4c1();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl
new file mode 100644
index 0000000..d59036c
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_e1f4c1() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_e1f4c1();
+ 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;
+
+void reverseBits_e1f4c1() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_e1f4c1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_e1f4c1() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_e1f4c1();
+}
+
+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/reverseBits/e1f4c1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.hlsl
new file mode 100644
index 0000000..6d4ce3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_e1f4c1() {
+ uint2 arg_0 = (0u).xx;
+ uint2 res = reversebits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_e1f4c1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_e1f4c1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_e1f4c1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl
new file mode 100644
index 0000000..c8f6c6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_e1f4c1() {
+ uint2 arg_0 = uint2(0u);
+ uint2 res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_e1f4c1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_e1f4c1();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_e1f4c1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm
new file mode 100644
index 0000000..d9a5b77
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_e1f4c1 "reverseBits_e1f4c1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_e1f4c1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %v2uint %arg_0
+ %18 = OpBitReverse %v2uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_e1f4c1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_e1f4c1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_e1f4c1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl
new file mode 100644
index 0000000..c04788b
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e1f4c1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_e1f4c1() {
+ var arg_0 = vec2<u32>();
+ var res : vec2<u32> = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_e1f4c1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_e1f4c1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_e1f4c1();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl
new file mode 100644
index 0000000..e72facb
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn reverseBits(u32) -> u32
+fn reverseBits_e31adf() {
+ var arg_0 = 1u;
+ var res: u32 = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_e31adf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_e31adf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_e31adf();
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl
new file mode 100644
index 0000000..0acaf13
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void reverseBits_e31adf() {
+ uint arg_0 = 1u;
+ uint res = bitfieldReverse(arg_0);
+}
+
+vec4 vertex_main() {
+ reverseBits_e31adf();
+ 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;
+
+void reverseBits_e31adf() {
+ uint arg_0 = 1u;
+ uint res = bitfieldReverse(arg_0);
+}
+
+void fragment_main() {
+ reverseBits_e31adf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void reverseBits_e31adf() {
+ uint arg_0 = 1u;
+ uint res = bitfieldReverse(arg_0);
+}
+
+void compute_main() {
+ reverseBits_e31adf();
+}
+
+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/reverseBits/e31adf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.hlsl
new file mode 100644
index 0000000..3574631
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void reverseBits_e31adf() {
+ uint arg_0 = 1u;
+ uint res = reversebits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ reverseBits_e31adf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ reverseBits_e31adf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ reverseBits_e31adf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl
new file mode 100644
index 0000000..5948fce
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void reverseBits_e31adf() {
+ uint arg_0 = 1u;
+ uint res = reverse_bits(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ reverseBits_e31adf();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ reverseBits_e31adf();
+ return;
+}
+
+kernel void compute_main() {
+ reverseBits_e31adf();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm
new file mode 100644
index 0000000..3dbf2b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %reverseBits_e31adf "reverseBits_e31adf"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%reverseBits_e31adf = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ %19 = OpLoad %uint %arg_0
+ %18 = OpBitReverse %uint %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %reverseBits_e31adf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %reverseBits_e31adf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %reverseBits_e31adf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl
new file mode 100644
index 0000000..9d10536
--- /dev/null
+++ b/test/tint/builtins/gen/var/reverseBits/e31adf.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn reverseBits_e31adf() {
+ var arg_0 = 1u;
+ var res : u32 = reverseBits(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ reverseBits_e31adf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ reverseBits_e31adf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ reverseBits_e31adf();
+}
diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl b/test/tint/builtins/gen/var/round/106c0b.wgsl
new file mode 100644
index 0000000..7be10c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/106c0b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn round(vec<4, f32>) -> vec<4, f32>
+fn round_106c0b() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_106c0b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_106c0b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_106c0b();
+}
diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl
new file mode 100644
index 0000000..f429459
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void round_106c0b() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = round(arg_0);
+}
+
+vec4 vertex_main() {
+ round_106c0b();
+ 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;
+
+void round_106c0b() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = round(arg_0);
+}
+
+void fragment_main() {
+ round_106c0b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void round_106c0b() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = round(arg_0);
+}
+
+void compute_main() {
+ round_106c0b();
+}
+
+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/round/106c0b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.hlsl
new file mode 100644
index 0000000..01f6555
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void round_106c0b() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = round(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ round_106c0b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ round_106c0b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ round_106c0b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl
new file mode 100644
index 0000000..ad1867f
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void round_106c0b() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = rint(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ round_106c0b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ round_106c0b();
+ return;
+}
+
+kernel void compute_main() {
+ round_106c0b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm
new file mode 100644
index 0000000..90e9744
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %round_106c0b "round_106c0b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%round_106c0b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 RoundEven %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %round_106c0b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %round_106c0b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %round_106c0b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl
new file mode 100644
index 0000000..a211720
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/106c0b.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn round_106c0b() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_106c0b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_106c0b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_106c0b();
+}
diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl b/test/tint/builtins/gen/var/round/1c7897.wgsl
new file mode 100644
index 0000000..02bb2d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/1c7897.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn round(vec<3, f32>) -> vec<3, f32>
+fn round_1c7897() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_1c7897();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_1c7897();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_1c7897();
+}
diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl
new file mode 100644
index 0000000..61d0b0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void round_1c7897() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = round(arg_0);
+}
+
+vec4 vertex_main() {
+ round_1c7897();
+ 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;
+
+void round_1c7897() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = round(arg_0);
+}
+
+void fragment_main() {
+ round_1c7897();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void round_1c7897() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = round(arg_0);
+}
+
+void compute_main() {
+ round_1c7897();
+}
+
+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/round/1c7897.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.hlsl
new file mode 100644
index 0000000..bcc74fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void round_1c7897() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = round(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ round_1c7897();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ round_1c7897();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ round_1c7897();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl
new file mode 100644
index 0000000..c528ea9
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void round_1c7897() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = rint(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ round_1c7897();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ round_1c7897();
+ return;
+}
+
+kernel void compute_main() {
+ round_1c7897();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm
new file mode 100644
index 0000000..3c068e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %round_1c7897 "round_1c7897"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%round_1c7897 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 RoundEven %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %round_1c7897
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %round_1c7897
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %round_1c7897
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl
new file mode 100644
index 0000000..07ae079
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/1c7897.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn round_1c7897() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_1c7897();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_1c7897();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_1c7897();
+}
diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl b/test/tint/builtins/gen/var/round/52c84d.wgsl
new file mode 100644
index 0000000..49ecbee
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/52c84d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn round(vec<2, f32>) -> vec<2, f32>
+fn round_52c84d() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_52c84d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_52c84d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_52c84d();
+}
diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl
new file mode 100644
index 0000000..9e6c847
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void round_52c84d() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = round(arg_0);
+}
+
+vec4 vertex_main() {
+ round_52c84d();
+ 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;
+
+void round_52c84d() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = round(arg_0);
+}
+
+void fragment_main() {
+ round_52c84d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void round_52c84d() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = round(arg_0);
+}
+
+void compute_main() {
+ round_52c84d();
+}
+
+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/round/52c84d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.hlsl
new file mode 100644
index 0000000..48b5930
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void round_52c84d() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = round(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ round_52c84d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ round_52c84d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ round_52c84d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl
new file mode 100644
index 0000000..3ebec21
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void round_52c84d() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = rint(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ round_52c84d();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ round_52c84d();
+ return;
+}
+
+kernel void compute_main() {
+ round_52c84d();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm
new file mode 100644
index 0000000..d59eb68
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %round_52c84d "round_52c84d"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%round_52c84d = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 RoundEven %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %round_52c84d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %round_52c84d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %round_52c84d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl
new file mode 100644
index 0000000..b92ade6
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/52c84d.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn round_52c84d() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_52c84d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_52c84d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_52c84d();
+}
diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl b/test/tint/builtins/gen/var/round/9edc38.wgsl
new file mode 100644
index 0000000..1c7f2e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/9edc38.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn round(f32) -> f32
+fn round_9edc38() {
+ var arg_0 = 1.0;
+ var res: f32 = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_9edc38();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_9edc38();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_9edc38();
+}
diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl
new file mode 100644
index 0000000..f675870
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void round_9edc38() {
+ float arg_0 = 1.0f;
+ float res = round(arg_0);
+}
+
+vec4 vertex_main() {
+ round_9edc38();
+ 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;
+
+void round_9edc38() {
+ float arg_0 = 1.0f;
+ float res = round(arg_0);
+}
+
+void fragment_main() {
+ round_9edc38();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void round_9edc38() {
+ float arg_0 = 1.0f;
+ float res = round(arg_0);
+}
+
+void compute_main() {
+ round_9edc38();
+}
+
+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/round/9edc38.wgsl.expected.hlsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.hlsl
new file mode 100644
index 0000000..f68cfd0
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void round_9edc38() {
+ float arg_0 = 1.0f;
+ float res = round(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ round_9edc38();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ round_9edc38();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ round_9edc38();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl
new file mode 100644
index 0000000..bee06fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void round_9edc38() {
+ float arg_0 = 1.0f;
+ float res = rint(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ round_9edc38();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ round_9edc38();
+ return;
+}
+
+kernel void compute_main() {
+ round_9edc38();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm
new file mode 100644
index 0000000..24731f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %round_9edc38 "round_9edc38"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%round_9edc38 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 RoundEven %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %round_9edc38
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %round_9edc38
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %round_9edc38
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl
new file mode 100644
index 0000000..b4d0e01
--- /dev/null
+++ b/test/tint/builtins/gen/var/round/9edc38.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn round_9edc38() {
+ var arg_0 = 1.0;
+ var res : f32 = round(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ round_9edc38();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ round_9edc38();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ round_9edc38();
+}
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl b/test/tint/builtins/gen/var/select/00b848.wgsl
new file mode 100644
index 0000000..a6fbecb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, i32>, vec<2, i32>, vec<2, bool>) -> vec<2, i32>
+fn select_00b848() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec2<bool>();
+ var res: vec2<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_00b848();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_00b848();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_00b848();
+}
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl
new file mode 100644
index 0000000..74a8fcb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_00b848() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ bvec2 arg_2 = bvec2(false);
+ ivec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_00b848();
+ 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;
+
+void select_00b848() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ bvec2 arg_2 = bvec2(false);
+ ivec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_00b848();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_00b848() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ bvec2 arg_2 = bvec2(false);
+ ivec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_00b848();
+}
+
+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/select/00b848.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.hlsl
new file mode 100644
index 0000000..c2142a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_00b848() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ bool2 arg_2 = (false).xx;
+ int2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_00b848();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_00b848();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_00b848();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl
new file mode 100644
index 0000000..a258876
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_00b848() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ bool2 arg_2 = bool2(false);
+ int2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_00b848();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_00b848();
+ return;
+}
+
+kernel void compute_main() {
+ select_00b848();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b0f2ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_00b848 "select_00b848"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %21 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_00b848 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_2 = OpVariable %_ptr_Function_v2bool Function %21
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %21
+ %25 = OpLoad %v2bool %arg_2
+ %26 = OpLoad %v2int %arg_1
+ %27 = OpLoad %v2int %arg_0
+ %24 = OpSelect %v2int %25 %26 %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_00b848
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_00b848
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_00b848
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl
new file mode 100644
index 0000000..f23e500
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/00b848.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_00b848() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec2<bool>();
+ var res : vec2<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_00b848();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_00b848();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_00b848();
+}
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl
new file mode 100644
index 0000000..e33b451
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, i32>, vec<3, i32>, vec<3, bool>) -> vec<3, i32>
+fn select_01e2cd() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec3<bool>();
+ var res: vec3<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_01e2cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_01e2cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_01e2cd();
+}
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl
new file mode 100644
index 0000000..66f69a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_01e2cd() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ bvec3 arg_2 = bvec3(false);
+ ivec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_01e2cd();
+ 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;
+
+void select_01e2cd() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ bvec3 arg_2 = bvec3(false);
+ ivec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_01e2cd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_01e2cd() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ bvec3 arg_2 = bvec3(false);
+ ivec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_01e2cd();
+}
+
+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/select/01e2cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.hlsl
new file mode 100644
index 0000000..633a711
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_01e2cd() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ bool3 arg_2 = (false).xxx;
+ int3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_01e2cd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_01e2cd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_01e2cd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl
new file mode 100644
index 0000000..baa5aae
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_01e2cd() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ bool3 arg_2 = bool3(false);
+ int3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_01e2cd();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_01e2cd();
+ return;
+}
+
+kernel void compute_main() {
+ select_01e2cd();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm
new file mode 100644
index 0000000..1025685
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_01e2cd "select_01e2cd"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %21 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_01e2cd = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_2 = OpVariable %_ptr_Function_v3bool Function %21
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %21
+ %25 = OpLoad %v3bool %arg_2
+ %26 = OpLoad %v3int %arg_1
+ %27 = OpLoad %v3int %arg_0
+ %24 = OpSelect %v3int %25 %26 %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_01e2cd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_01e2cd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_01e2cd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl
new file mode 100644
index 0000000..9e110da
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/01e2cd.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_01e2cd() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec3<bool>();
+ var res : vec3<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_01e2cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_01e2cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_01e2cd();
+}
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl b/test/tint/builtins/gen/var/select/087ea4.wgsl
new file mode 100644
index 0000000..a3c3dd7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, u32>, vec<4, u32>, bool) -> vec<4, u32>
+fn select_087ea4() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = bool();
+ var res: vec4<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_087ea4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_087ea4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_087ea4();
+}
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl
new file mode 100644
index 0000000..cd692d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_087ea4() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ bool arg_2 = false;
+ uvec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_087ea4();
+ 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;
+
+void select_087ea4() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ bool arg_2 = false;
+ uvec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_087ea4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_087ea4() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ bool arg_2 = false;
+ uvec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_087ea4();
+}
+
+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/select/087ea4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.hlsl
new file mode 100644
index 0000000..d7f5915
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_087ea4() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ bool arg_2 = false;
+ uint4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_087ea4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_087ea4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_087ea4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl
new file mode 100644
index 0000000..c42d1e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_087ea4() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ bool arg_2 = false;
+ uint4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_087ea4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_087ea4();
+ return;
+}
+
+kernel void compute_main() {
+ select_087ea4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm
new file mode 100644
index 0000000..34e1100
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; 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 %select_087ea4 "select_087ea4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v4bool = OpTypeVector %bool 4
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %30 = OpConstantNull %v4bool
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_087ea4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %28 = OpVariable %_ptr_Function_v4bool Function %30
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %v4uint %arg_1
+ %26 = OpLoad %v4uint %arg_0
+ %31 = OpCompositeConstruct %v4bool %24 %24 %24 %24
+ %23 = OpSelect %v4uint %31 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_087ea4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_087ea4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %select_087ea4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl
new file mode 100644
index 0000000..c868bbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/087ea4.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_087ea4() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = bool();
+ var res : vec4<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_087ea4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_087ea4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_087ea4();
+}
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl b/test/tint/builtins/gen/var/select/1e960b.wgsl
new file mode 100644
index 0000000..9f66b85
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, u32>, vec<2, u32>, vec<2, bool>) -> vec<2, u32>
+fn select_1e960b() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = vec2<bool>();
+ var res: vec2<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_1e960b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_1e960b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_1e960b();
+}
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl
new file mode 100644
index 0000000..535a865
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_1e960b() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ bvec2 arg_2 = bvec2(false);
+ uvec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_1e960b();
+ 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;
+
+void select_1e960b() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ bvec2 arg_2 = bvec2(false);
+ uvec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_1e960b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_1e960b() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ bvec2 arg_2 = bvec2(false);
+ uvec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_1e960b();
+}
+
+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/select/1e960b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.hlsl
new file mode 100644
index 0000000..96128cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_1e960b() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ bool2 arg_2 = (false).xx;
+ uint2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_1e960b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_1e960b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_1e960b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl
new file mode 100644
index 0000000..9f44a94
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_1e960b() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ bool2 arg_2 = bool2(false);
+ uint2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_1e960b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_1e960b();
+ return;
+}
+
+kernel void compute_main() {
+ select_1e960b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm
new file mode 100644
index 0000000..70bc86a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_1e960b "select_1e960b"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %21 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_1e960b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_v2bool Function %21
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %21
+ %25 = OpLoad %v2bool %arg_2
+ %26 = OpLoad %v2uint %arg_1
+ %27 = OpLoad %v2uint %arg_0
+ %24 = OpSelect %v2uint %25 %26 %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_1e960b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_1e960b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_1e960b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl
new file mode 100644
index 0000000..74b9532
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/1e960b.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_1e960b() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = vec2<bool>();
+ var res : vec2<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_1e960b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_1e960b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_1e960b();
+}
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl b/test/tint/builtins/gen/var/select/266aff.wgsl
new file mode 100644
index 0000000..7630dfb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, f32>, vec<2, f32>, vec<2, bool>) -> vec<2, f32>
+fn select_266aff() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<bool>();
+ var res: vec2<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_266aff();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_266aff();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_266aff();
+}
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl
new file mode 100644
index 0000000..0bc653d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_266aff() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ bvec2 arg_2 = bvec2(false);
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_266aff();
+ 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;
+
+void select_266aff() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ bvec2 arg_2 = bvec2(false);
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_266aff();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_266aff() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ bvec2 arg_2 = bvec2(false);
+ vec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_266aff();
+}
+
+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/select/266aff.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.hlsl
new file mode 100644
index 0000000..1615eb0
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_266aff() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ bool2 arg_2 = (false).xx;
+ float2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_266aff();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_266aff();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_266aff();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl
new file mode 100644
index 0000000..ed3eacc
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_266aff() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ bool2 arg_2 = bool2(false);
+ float2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_266aff();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_266aff();
+ return;
+}
+
+kernel void compute_main() {
+ select_266aff();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm
new file mode 100644
index 0000000..b4542d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; 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 %select_266aff "select_266aff"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %20 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_266aff = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v2bool Function %20
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %20
+ %24 = OpLoad %v2bool %arg_2
+ %25 = OpLoad %v2float %arg_1
+ %26 = OpLoad %v2float %arg_0
+ %23 = OpSelect %v2float %24 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %select_266aff
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_266aff
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %select_266aff
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl
new file mode 100644
index 0000000..0236878
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/266aff.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_266aff() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<bool>();
+ var res : vec2<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_266aff();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_266aff();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_266aff();
+}
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl b/test/tint/builtins/gen/var/select/28a27e.wgsl
new file mode 100644
index 0000000..f9ae32b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, u32>, vec<3, u32>, vec<3, bool>) -> vec<3, u32>
+fn select_28a27e() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = vec3<bool>();
+ var res: vec3<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_28a27e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_28a27e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_28a27e();
+}
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl
new file mode 100644
index 0000000..fb511ee3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_28a27e() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ bvec3 arg_2 = bvec3(false);
+ uvec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_28a27e();
+ 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;
+
+void select_28a27e() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ bvec3 arg_2 = bvec3(false);
+ uvec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_28a27e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_28a27e() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ bvec3 arg_2 = bvec3(false);
+ uvec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_28a27e();
+}
+
+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/select/28a27e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.hlsl
new file mode 100644
index 0000000..9528d88
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_28a27e() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ bool3 arg_2 = (false).xxx;
+ uint3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_28a27e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_28a27e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_28a27e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl
new file mode 100644
index 0000000..2ad0a43
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_28a27e() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ bool3 arg_2 = bool3(false);
+ uint3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_28a27e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_28a27e();
+ return;
+}
+
+kernel void compute_main() {
+ select_28a27e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm
new file mode 100644
index 0000000..7bf5f53
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_28a27e "select_28a27e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %21 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_28a27e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_v3bool Function %21
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %21
+ %25 = OpLoad %v3bool %arg_2
+ %26 = OpLoad %v3uint %arg_1
+ %27 = OpLoad %v3uint %arg_0
+ %24 = OpSelect %v3uint %25 %26 %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_28a27e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_28a27e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_28a27e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl
new file mode 100644
index 0000000..2aa730b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/28a27e.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_28a27e() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = vec3<bool>();
+ var res : vec3<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_28a27e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_28a27e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_28a27e();
+}
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl
new file mode 100644
index 0000000..913cb41
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, bool>, vec<3, bool>, bool) -> vec<3, bool>
+fn select_3c25ce() {
+ var arg_0 = vec3<bool>();
+ var arg_1 = vec3<bool>();
+ var arg_2 = bool();
+ var res: vec3<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_3c25ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_3c25ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_3c25ce();
+}
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl
new file mode 100644
index 0000000..d05d533
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_3c25ce() {
+ bvec3 arg_0 = bvec3(false);
+ bvec3 arg_1 = bvec3(false);
+ bool arg_2 = false;
+ bvec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_3c25ce();
+ 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;
+
+void select_3c25ce() {
+ bvec3 arg_0 = bvec3(false);
+ bvec3 arg_1 = bvec3(false);
+ bool arg_2 = false;
+ bvec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_3c25ce();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_3c25ce() {
+ bvec3 arg_0 = bvec3(false);
+ bvec3 arg_1 = bvec3(false);
+ bool arg_2 = false;
+ bvec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_3c25ce();
+}
+
+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/select/3c25ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.hlsl
new file mode 100644
index 0000000..60e232d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_3c25ce() {
+ bool3 arg_0 = (false).xxx;
+ bool3 arg_1 = (false).xxx;
+ bool arg_2 = false;
+ bool3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_3c25ce();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_3c25ce();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_3c25ce();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl
new file mode 100644
index 0000000..9a106b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_3c25ce() {
+ bool3 arg_0 = bool3(false);
+ bool3 arg_1 = bool3(false);
+ bool arg_2 = false;
+ bool3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_3c25ce();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_3c25ce();
+ return;
+}
+
+kernel void compute_main() {
+ select_3c25ce();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm
new file mode 100644
index 0000000..189d632
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_3c25ce "select_3c25ce"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %15 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %19 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_3c25ce = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3bool Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3bool Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %19
+ %26 = OpVariable %_ptr_Function_v3bool Function %15
+ %res = OpVariable %_ptr_Function_v3bool Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %19
+ %23 = OpLoad %bool %arg_2
+ %24 = OpLoad %v3bool %arg_1
+ %25 = OpLoad %v3bool %arg_0
+ %27 = OpCompositeConstruct %v3bool %23 %23 %23
+ %22 = OpSelect %v3bool %27 %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_3c25ce
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_3c25ce
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_3c25ce
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl
new file mode 100644
index 0000000..396fac0
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/3c25ce.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_3c25ce() {
+ var arg_0 = vec3<bool>();
+ var arg_1 = vec3<bool>();
+ var arg_2 = bool();
+ var res : vec3<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_3c25ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_3c25ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_3c25ce();
+}
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl b/test/tint/builtins/gen/var/select/416e14.wgsl
new file mode 100644
index 0000000..9e9c759
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(f32, f32, bool) -> f32
+fn select_416e14() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = bool();
+ var res: f32 = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_416e14();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_416e14();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_416e14();
+}
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl
new file mode 100644
index 0000000..a6b35b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_416e14() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ bool arg_2 = false;
+ float res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_416e14();
+ 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;
+
+void select_416e14() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ bool arg_2 = false;
+ float res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_416e14();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_416e14() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ bool arg_2 = false;
+ float res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_416e14();
+}
+
+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/select/416e14.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.hlsl
new file mode 100644
index 0000000..a55bde8
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_416e14() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ bool arg_2 = false;
+ float res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_416e14();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_416e14();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_416e14();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl
new file mode 100644
index 0000000..a11fa7b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_416e14() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ bool arg_2 = false;
+ float res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_416e14();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_416e14();
+ return;
+}
+
+kernel void compute_main() {
+ select_416e14();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm
new file mode 100644
index 0000000..b37cdb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; 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 %select_416e14 "select_416e14"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %bool = OpTypeBool
+ %18 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %26 = OpTypeFunction %v4float
+%select_416e14 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %arg_2 = OpVariable %_ptr_Function_bool Function %18
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ OpStore %arg_2 %18
+ %22 = OpLoad %bool %arg_2
+ %23 = OpLoad %float %arg_1
+ %24 = OpLoad %float %arg_0
+ %21 = OpSelect %float %22 %23 %24
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %select_416e14
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_416e14
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_416e14
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl
new file mode 100644
index 0000000..d35a4c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/416e14.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_416e14() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = bool();
+ var res : f32 = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_416e14();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_416e14();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_416e14();
+}
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl b/test/tint/builtins/gen/var/select/51b047.wgsl
new file mode 100644
index 0000000..aca2728
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, u32>, vec<2, u32>, bool) -> vec<2, u32>
+fn select_51b047() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = bool();
+ var res: vec2<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_51b047();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_51b047();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_51b047();
+}
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl
new file mode 100644
index 0000000..85302fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_51b047() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ bool arg_2 = false;
+ uvec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_51b047();
+ 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;
+
+void select_51b047() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ bool arg_2 = false;
+ uvec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_51b047();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_51b047() {
+ uvec2 arg_0 = uvec2(0u);
+ uvec2 arg_1 = uvec2(0u);
+ bool arg_2 = false;
+ uvec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_51b047();
+}
+
+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/select/51b047.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.hlsl
new file mode 100644
index 0000000..09f6e9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_51b047() {
+ uint2 arg_0 = (0u).xx;
+ uint2 arg_1 = (0u).xx;
+ bool arg_2 = false;
+ uint2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_51b047();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_51b047();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_51b047();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl
new file mode 100644
index 0000000..9eb0a1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_51b047() {
+ uint2 arg_0 = uint2(0u);
+ uint2 arg_1 = uint2(0u);
+ bool arg_2 = false;
+ uint2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_51b047();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_51b047();
+ return;
+}
+
+kernel void compute_main() {
+ select_51b047();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm
new file mode 100644
index 0000000..fd5e791
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; 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 %select_51b047 "select_51b047"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v2uint = OpTypeVector %uint 2
+ %15 = OpConstantNull %v2uint
+%_ptr_Function_v2uint = OpTypePointer Function %v2uint
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v2bool = OpTypeVector %bool 2
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %30 = OpConstantNull %v2bool
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_51b047 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %28 = OpVariable %_ptr_Function_v2bool Function %30
+ %res = OpVariable %_ptr_Function_v2uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %v2uint %arg_1
+ %26 = OpLoad %v2uint %arg_0
+ %31 = OpCompositeConstruct %v2bool %24 %24
+ %23 = OpSelect %v2uint %31 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_51b047
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_51b047
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %select_51b047
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl
new file mode 100644
index 0000000..dd440a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/51b047.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_51b047() {
+ var arg_0 = vec2<u32>();
+ var arg_1 = vec2<u32>();
+ var arg_2 = bool();
+ var res : vec2<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_51b047();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_51b047();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_51b047();
+}
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl b/test/tint/builtins/gen/var/select/713567.wgsl
new file mode 100644
index 0000000..f638664
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/713567.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, f32>, vec<4, f32>, bool) -> vec<4, f32>
+fn select_713567() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = bool();
+ var res: vec4<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_713567();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_713567();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_713567();
+}
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl
new file mode 100644
index 0000000..b4cb487
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_713567() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ bool arg_2 = false;
+ vec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_713567();
+ 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;
+
+void select_713567() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ bool arg_2 = false;
+ vec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_713567();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_713567() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ bool arg_2 = false;
+ vec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_713567();
+}
+
+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/select/713567.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.hlsl
new file mode 100644
index 0000000..52e5305
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_713567() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ bool arg_2 = false;
+ float4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_713567();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_713567();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_713567();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl
new file mode 100644
index 0000000..6aa0057
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_713567() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ bool arg_2 = false;
+ float4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_713567();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_713567();
+ return;
+}
+
+kernel void compute_main() {
+ select_713567();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm
new file mode 100644
index 0000000..a6ed5fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %select_713567 "select_713567"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %bool = OpTypeBool
+ %17 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v4bool = OpTypeVector %bool 4
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %27 = OpConstantNull %v4bool
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_713567 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_bool Function %17
+ %25 = OpVariable %_ptr_Function_v4bool Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %17
+ %21 = OpLoad %bool %arg_2
+ %22 = OpLoad %v4float %arg_1
+ %23 = OpLoad %v4float %arg_0
+ %28 = OpCompositeConstruct %v4bool %21 %21 %21 %21
+ %20 = OpSelect %v4float %28 %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %select_713567
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %select_713567
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_713567
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl
new file mode 100644
index 0000000..1bc9fb6
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/713567.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_713567() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = bool();
+ var res : vec4<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_713567();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_713567();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_713567();
+}
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl b/test/tint/builtins/gen/var/select/78be5f.wgsl
new file mode 100644
index 0000000..427d23e
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, f32>, vec<3, f32>, bool) -> vec<3, f32>
+fn select_78be5f() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = bool();
+ var res: vec3<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_78be5f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_78be5f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_78be5f();
+}
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl
new file mode 100644
index 0000000..562791d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_78be5f() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ bool arg_2 = false;
+ vec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_78be5f();
+ 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;
+
+void select_78be5f() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ bool arg_2 = false;
+ vec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_78be5f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_78be5f() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ bool arg_2 = false;
+ vec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_78be5f();
+}
+
+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/select/78be5f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.hlsl
new file mode 100644
index 0000000..e3bf8eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_78be5f() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ bool arg_2 = false;
+ float3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_78be5f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_78be5f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_78be5f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl
new file mode 100644
index 0000000..fa69529
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_78be5f() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ bool arg_2 = false;
+ float3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_78be5f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_78be5f();
+ return;
+}
+
+kernel void compute_main() {
+ select_78be5f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm
new file mode 100644
index 0000000..1581ba4
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.spvasm
@@ -0,0 +1,86 @@
+; 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 %select_78be5f "select_78be5f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %bool = OpTypeBool
+ %19 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v3bool = OpTypeVector %bool 3
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %29 = OpConstantNull %v3bool
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_78be5f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_bool Function %19
+ %27 = OpVariable %_ptr_Function_v3bool Function %29
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %19
+ %23 = OpLoad %bool %arg_2
+ %24 = OpLoad %v3float %arg_1
+ %25 = OpLoad %v3float %arg_0
+ %30 = OpCompositeConstruct %v3bool %23 %23 %23
+ %22 = OpSelect %v3float %30 %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_78be5f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_78be5f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %select_78be5f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl
new file mode 100644
index 0000000..71f76b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/78be5f.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_78be5f() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = bool();
+ var res : vec3<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_78be5f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_78be5f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_78be5f();
+}
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl
new file mode 100644
index 0000000..cffeddc
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, bool>, vec<3, bool>, vec<3, bool>) -> vec<3, bool>
+fn select_80a9a9() {
+ var arg_0 = vec3<bool>();
+ var arg_1 = vec3<bool>();
+ var arg_2 = vec3<bool>();
+ var res: vec3<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_80a9a9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_80a9a9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_80a9a9();
+}
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl
new file mode 100644
index 0000000..47f6301
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_80a9a9() {
+ bvec3 arg_0 = bvec3(false);
+ bvec3 arg_1 = bvec3(false);
+ bvec3 arg_2 = bvec3(false);
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_80a9a9();
+ 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;
+
+void select_80a9a9() {
+ bvec3 arg_0 = bvec3(false);
+ bvec3 arg_1 = bvec3(false);
+ bvec3 arg_2 = bvec3(false);
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_80a9a9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_80a9a9() {
+ bvec3 arg_0 = bvec3(false);
+ bvec3 arg_1 = bvec3(false);
+ bvec3 arg_2 = bvec3(false);
+ bvec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_80a9a9();
+}
+
+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/select/80a9a9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.hlsl
new file mode 100644
index 0000000..b9c340c
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_80a9a9() {
+ bool3 arg_0 = (false).xxx;
+ bool3 arg_1 = (false).xxx;
+ bool3 arg_2 = (false).xxx;
+ bool3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_80a9a9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_80a9a9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_80a9a9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl
new file mode 100644
index 0000000..3bc0c23
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_80a9a9() {
+ bool3 arg_0 = bool3(false);
+ bool3 arg_1 = bool3(false);
+ bool3 arg_2 = bool3(false);
+ bool3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_80a9a9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_80a9a9();
+ return;
+}
+
+kernel void compute_main() {
+ select_80a9a9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm
new file mode 100644
index 0000000..73f1cdb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; 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 %select_80a9a9 "select_80a9a9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %15 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_80a9a9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3bool Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3bool Function %15
+ %arg_2 = OpVariable %_ptr_Function_v3bool Function %15
+ %res = OpVariable %_ptr_Function_v3bool Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %21 = OpLoad %v3bool %arg_2
+ %22 = OpLoad %v3bool %arg_1
+ %23 = OpLoad %v3bool %arg_0
+ %20 = OpSelect %v3bool %21 %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %select_80a9a9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_80a9a9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_80a9a9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl
new file mode 100644
index 0000000..a49c335
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/80a9a9.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_80a9a9() {
+ var arg_0 = vec3<bool>();
+ var arg_1 = vec3<bool>();
+ var arg_2 = vec3<bool>();
+ var res : vec3<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_80a9a9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_80a9a9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_80a9a9();
+}
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl
new file mode 100644
index 0000000..c222014
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, i32>, vec<3, i32>, bool) -> vec<3, i32>
+fn select_8fa62c() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = bool();
+ var res: vec3<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_8fa62c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_8fa62c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_8fa62c();
+}
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl
new file mode 100644
index 0000000..fd4e04d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_8fa62c() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ bool arg_2 = false;
+ ivec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_8fa62c();
+ 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;
+
+void select_8fa62c() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ bool arg_2 = false;
+ ivec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_8fa62c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_8fa62c() {
+ ivec3 arg_0 = ivec3(0);
+ ivec3 arg_1 = ivec3(0);
+ bool arg_2 = false;
+ ivec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_8fa62c();
+}
+
+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/select/8fa62c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.hlsl
new file mode 100644
index 0000000..2ea69af
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_8fa62c() {
+ int3 arg_0 = (0).xxx;
+ int3 arg_1 = (0).xxx;
+ bool arg_2 = false;
+ int3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_8fa62c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_8fa62c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_8fa62c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl
new file mode 100644
index 0000000..4cd6e75
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_8fa62c() {
+ int3 arg_0 = int3(0);
+ int3 arg_1 = int3(0);
+ bool arg_2 = false;
+ int3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_8fa62c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_8fa62c();
+ return;
+}
+
+kernel void compute_main() {
+ select_8fa62c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm
new file mode 100644
index 0000000..e3a3e50
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; 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 %select_8fa62c "select_8fa62c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %15 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v3bool = OpTypeVector %bool 3
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %30 = OpConstantNull %v3bool
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_8fa62c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %28 = OpVariable %_ptr_Function_v3bool Function %30
+ %res = OpVariable %_ptr_Function_v3int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v3int %arg_0
+ %31 = OpCompositeConstruct %v3bool %24 %24 %24
+ %23 = OpSelect %v3int %31 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_8fa62c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_8fa62c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %select_8fa62c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl
new file mode 100644
index 0000000..3cd2a56
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/8fa62c.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_8fa62c() {
+ var arg_0 = vec3<i32>();
+ var arg_1 = vec3<i32>();
+ var arg_2 = bool();
+ var res : vec3<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_8fa62c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_8fa62c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_8fa62c();
+}
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl b/test/tint/builtins/gen/var/select/99f883.wgsl
new file mode 100644
index 0000000..8b8549d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(u32, u32, bool) -> u32
+fn select_99f883() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = bool();
+ var res: u32 = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_99f883();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_99f883();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_99f883();
+}
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl
new file mode 100644
index 0000000..6075d92
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_99f883() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ bool arg_2 = false;
+ uint res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_99f883();
+ 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;
+
+void select_99f883() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ bool arg_2 = false;
+ uint res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_99f883();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_99f883() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ bool arg_2 = false;
+ uint res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_99f883();
+}
+
+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/select/99f883.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.hlsl
new file mode 100644
index 0000000..c6f25eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_99f883() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ bool arg_2 = false;
+ uint res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_99f883();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_99f883();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_99f883();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl
new file mode 100644
index 0000000..7e9341a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_99f883() {
+ uint arg_0 = 1u;
+ uint arg_1 = 1u;
+ bool arg_2 = false;
+ uint res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_99f883();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_99f883();
+ return;
+}
+
+kernel void compute_main() {
+ select_99f883();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm
new file mode 100644
index 0000000..1de620b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; 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 %select_99f883 "select_99f883"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_99f883 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %arg_1 = OpVariable %_ptr_Function_uint Function %17
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %res = OpVariable %_ptr_Function_uint Function %17
+ OpStore %arg_0 %uint_1
+ OpStore %arg_1 %uint_1
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %uint %arg_1
+ %26 = OpLoad %uint %arg_0
+ %23 = OpSelect %uint %24 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %select_99f883
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_99f883
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %select_99f883
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl
new file mode 100644
index 0000000..c92d6c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/99f883.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_99f883() {
+ var arg_0 = 1u;
+ var arg_1 = 1u;
+ var arg_2 = bool();
+ var res : u32 = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_99f883();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_99f883();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_99f883();
+}
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl b/test/tint/builtins/gen/var/select/a2860e.wgsl
new file mode 100644
index 0000000..18b2545
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, i32>, vec<4, i32>, vec<4, bool>) -> vec<4, i32>
+fn select_a2860e() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = vec4<bool>();
+ var res: vec4<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_a2860e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_a2860e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_a2860e();
+}
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl
new file mode 100644
index 0000000..791a44f
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_a2860e() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ bvec4 arg_2 = bvec4(false);
+ ivec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_a2860e();
+ 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;
+
+void select_a2860e() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ bvec4 arg_2 = bvec4(false);
+ ivec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_a2860e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_a2860e() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ bvec4 arg_2 = bvec4(false);
+ ivec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_a2860e();
+}
+
+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/select/a2860e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.hlsl
new file mode 100644
index 0000000..bc3e47e
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_a2860e() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ bool4 arg_2 = (false).xxxx;
+ int4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_a2860e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_a2860e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_a2860e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl
new file mode 100644
index 0000000..bbc4266
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_a2860e() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ bool4 arg_2 = bool4(false);
+ int4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_a2860e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_a2860e();
+ return;
+}
+
+kernel void compute_main() {
+ select_a2860e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm
new file mode 100644
index 0000000..30c8e3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_a2860e "select_a2860e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %21 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_a2860e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_2 = OpVariable %_ptr_Function_v4bool Function %21
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %21
+ %25 = OpLoad %v4bool %arg_2
+ %26 = OpLoad %v4int %arg_1
+ %27 = OpLoad %v4int %arg_0
+ %24 = OpSelect %v4int %25 %26 %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_a2860e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_a2860e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_a2860e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl
new file mode 100644
index 0000000..c665d80
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/a2860e.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_a2860e() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = vec4<bool>();
+ var res : vec4<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_a2860e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_a2860e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_a2860e();
+}
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl b/test/tint/builtins/gen/var/select/ab069f.wgsl
new file mode 100644
index 0000000..0defb64
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, i32>, vec<4, i32>, bool) -> vec<4, i32>
+fn select_ab069f() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = bool();
+ var res: vec4<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_ab069f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_ab069f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_ab069f();
+}
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl
new file mode 100644
index 0000000..837dc43
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_ab069f() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ bool arg_2 = false;
+ ivec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_ab069f();
+ 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;
+
+void select_ab069f() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ bool arg_2 = false;
+ ivec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_ab069f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_ab069f() {
+ ivec4 arg_0 = ivec4(0);
+ ivec4 arg_1 = ivec4(0);
+ bool arg_2 = false;
+ ivec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_ab069f();
+}
+
+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/select/ab069f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.hlsl
new file mode 100644
index 0000000..0fb1845
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_ab069f() {
+ int4 arg_0 = (0).xxxx;
+ int4 arg_1 = (0).xxxx;
+ bool arg_2 = false;
+ int4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_ab069f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_ab069f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_ab069f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl
new file mode 100644
index 0000000..415cb8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_ab069f() {
+ int4 arg_0 = int4(0);
+ int4 arg_1 = int4(0);
+ bool arg_2 = false;
+ int4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_ab069f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_ab069f();
+ return;
+}
+
+kernel void compute_main() {
+ select_ab069f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm
new file mode 100644
index 0000000..738b788
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; 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 %select_ab069f "select_ab069f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v4int = OpTypeVector %int 4
+ %15 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v4bool = OpTypeVector %bool 4
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %30 = OpConstantNull %v4bool
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_ab069f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4int Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %28 = OpVariable %_ptr_Function_v4bool Function %30
+ %res = OpVariable %_ptr_Function_v4int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %v4int %arg_1
+ %26 = OpLoad %v4int %arg_0
+ %31 = OpCompositeConstruct %v4bool %24 %24 %24 %24
+ %23 = OpSelect %v4int %31 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_ab069f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_ab069f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %select_ab069f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl
new file mode 100644
index 0000000..c3c395f
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ab069f.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_ab069f() {
+ var arg_0 = vec4<i32>();
+ var arg_1 = vec4<i32>();
+ var arg_2 = bool();
+ var res : vec4<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_ab069f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_ab069f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_ab069f();
+}
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl b/test/tint/builtins/gen/var/select/b04721.wgsl
new file mode 100644
index 0000000..21b2378
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, u32>, vec<3, u32>, bool) -> vec<3, u32>
+fn select_b04721() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = bool();
+ var res: vec3<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_b04721();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_b04721();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_b04721();
+}
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl
new file mode 100644
index 0000000..526024d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_b04721() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ bool arg_2 = false;
+ uvec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_b04721();
+ 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;
+
+void select_b04721() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ bool arg_2 = false;
+ uvec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_b04721();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_b04721() {
+ uvec3 arg_0 = uvec3(0u);
+ uvec3 arg_1 = uvec3(0u);
+ bool arg_2 = false;
+ uvec3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_b04721();
+}
+
+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/select/b04721.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.hlsl
new file mode 100644
index 0000000..c96cebe
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_b04721() {
+ uint3 arg_0 = (0u).xxx;
+ uint3 arg_1 = (0u).xxx;
+ bool arg_2 = false;
+ uint3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_b04721();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_b04721();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_b04721();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl
new file mode 100644
index 0000000..594d892
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_b04721() {
+ uint3 arg_0 = uint3(0u);
+ uint3 arg_1 = uint3(0u);
+ bool arg_2 = false;
+ uint3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_b04721();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_b04721();
+ return;
+}
+
+kernel void compute_main() {
+ select_b04721();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm
new file mode 100644
index 0000000..e22cbc3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; 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 %select_b04721 "select_b04721"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v3uint = OpTypeVector %uint 3
+ %15 = OpConstantNull %v3uint
+%_ptr_Function_v3uint = OpTypePointer Function %v3uint
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v3bool = OpTypeVector %bool 3
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %30 = OpConstantNull %v3bool
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_b04721 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v3uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %28 = OpVariable %_ptr_Function_v3bool Function %30
+ %res = OpVariable %_ptr_Function_v3uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %v3uint %arg_1
+ %26 = OpLoad %v3uint %arg_0
+ %31 = OpCompositeConstruct %v3bool %24 %24 %24
+ %23 = OpSelect %v3uint %31 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_b04721
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_b04721
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %select_b04721
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl
new file mode 100644
index 0000000..5f57eca
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/b04721.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_b04721() {
+ var arg_0 = vec3<u32>();
+ var arg_1 = vec3<u32>();
+ var arg_2 = bool();
+ var res : vec3<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_b04721();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_b04721();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_b04721();
+}
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl b/test/tint/builtins/gen/var/select/bb447f.wgsl
new file mode 100644
index 0000000..0a966ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, i32>, vec<2, i32>, bool) -> vec<2, i32>
+fn select_bb447f() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = bool();
+ var res: vec2<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_bb447f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_bb447f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_bb447f();
+}
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl
new file mode 100644
index 0000000..481243d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_bb447f() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ bool arg_2 = false;
+ ivec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_bb447f();
+ 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;
+
+void select_bb447f() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ bool arg_2 = false;
+ ivec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_bb447f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_bb447f() {
+ ivec2 arg_0 = ivec2(0);
+ ivec2 arg_1 = ivec2(0);
+ bool arg_2 = false;
+ ivec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_bb447f();
+}
+
+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/select/bb447f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.hlsl
new file mode 100644
index 0000000..d442881
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_bb447f() {
+ int2 arg_0 = (0).xx;
+ int2 arg_1 = (0).xx;
+ bool arg_2 = false;
+ int2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_bb447f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_bb447f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_bb447f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl
new file mode 100644
index 0000000..69d0161
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_bb447f() {
+ int2 arg_0 = int2(0);
+ int2 arg_1 = int2(0);
+ bool arg_2 = false;
+ int2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_bb447f();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_bb447f();
+ return;
+}
+
+kernel void compute_main() {
+ select_bb447f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm
new file mode 100644
index 0000000..bf6642a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; 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 %select_bb447f "select_bb447f"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %15 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v2bool = OpTypeVector %bool 2
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %30 = OpConstantNull %v2bool
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_bb447f = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %28 = OpVariable %_ptr_Function_v2bool Function %30
+ %res = OpVariable %_ptr_Function_v2int Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v2int %arg_0
+ %31 = OpCompositeConstruct %v2bool %24 %24
+ %23 = OpSelect %v2int %31 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_bb447f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %select_bb447f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %select_bb447f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl
new file mode 100644
index 0000000..78571c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb447f.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_bb447f() {
+ var arg_0 = vec2<i32>();
+ var arg_1 = vec2<i32>();
+ var arg_2 = bool();
+ var res : vec2<i32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_bb447f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_bb447f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_bb447f();
+}
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl
new file mode 100644
index 0000000..ca9c182
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, f32>, vec<4, f32>, vec<4, bool>) -> vec<4, f32>
+fn select_bb8aae() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<bool>();
+ var res: vec4<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_bb8aae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_bb8aae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_bb8aae();
+}
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl
new file mode 100644
index 0000000..0db6750
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_bb8aae() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ bvec4 arg_2 = bvec4(false);
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_bb8aae();
+ 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;
+
+void select_bb8aae() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ bvec4 arg_2 = bvec4(false);
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_bb8aae();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_bb8aae() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ bvec4 arg_2 = bvec4(false);
+ vec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_bb8aae();
+}
+
+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/select/bb8aae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.hlsl
new file mode 100644
index 0000000..fd3ff61
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_bb8aae() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ bool4 arg_2 = (false).xxxx;
+ float4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_bb8aae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_bb8aae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_bb8aae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl
new file mode 100644
index 0000000..c12dc41
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_bb8aae() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ bool4 arg_2 = bool4(false);
+ float4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_bb8aae();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_bb8aae();
+ return;
+}
+
+kernel void compute_main() {
+ select_bb8aae();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm
new file mode 100644
index 0000000..4edc18f
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; 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 %select_bb8aae "select_bb8aae"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %18 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_bb8aae = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_v4bool Function %18
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %18
+ %22 = OpLoad %v4bool %arg_2
+ %23 = OpLoad %v4float %arg_1
+ %24 = OpLoad %v4float %arg_0
+ %21 = OpSelect %v4float %22 %23 %24
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %select_bb8aae
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %select_bb8aae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_bb8aae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl
new file mode 100644
index 0000000..0ee6a28
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bb8aae.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_bb8aae() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<bool>();
+ var res : vec4<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_bb8aae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_bb8aae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_bb8aae();
+}
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl
new file mode 100644
index 0000000..d778c46
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, f32>, vec<2, f32>, bool) -> vec<2, f32>
+fn select_bf3d29() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = bool();
+ var res: vec2<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_bf3d29();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_bf3d29();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_bf3d29();
+}
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl
new file mode 100644
index 0000000..e2e29fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_bf3d29() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ bool arg_2 = false;
+ vec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_bf3d29();
+ 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;
+
+void select_bf3d29() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ bool arg_2 = false;
+ vec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_bf3d29();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_bf3d29() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ bool arg_2 = false;
+ vec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_bf3d29();
+}
+
+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/select/bf3d29.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.hlsl
new file mode 100644
index 0000000..a486274
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_bf3d29() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ bool arg_2 = false;
+ float2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_bf3d29();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_bf3d29();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_bf3d29();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl
new file mode 100644
index 0000000..4e87006
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_bf3d29() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ bool arg_2 = false;
+ float2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_bf3d29();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_bf3d29();
+ return;
+}
+
+kernel void compute_main() {
+ select_bf3d29();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b9f6ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.spvasm
@@ -0,0 +1,86 @@
+; 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 %select_bf3d29 "select_bf3d29"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %bool = OpTypeBool
+ %19 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %v2bool = OpTypeVector %bool 2
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %29 = OpConstantNull %v2bool
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_bf3d29 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_bool Function %19
+ %27 = OpVariable %_ptr_Function_v2bool Function %29
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %19
+ %23 = OpLoad %bool %arg_2
+ %24 = OpLoad %v2float %arg_1
+ %25 = OpLoad %v2float %arg_0
+ %30 = OpCompositeConstruct %v2bool %23 %23
+ %22 = OpSelect %v2float %30 %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_bf3d29
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_bf3d29
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %select_bf3d29
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl
new file mode 100644
index 0000000..e058445
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/bf3d29.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_bf3d29() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = bool();
+ var res : vec2<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_bf3d29();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_bf3d29();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_bf3d29();
+}
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl
new file mode 100644
index 0000000..555869b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(bool, bool, bool) -> bool
+fn select_c31f9e() {
+ var arg_0 = bool();
+ var arg_1 = bool();
+ var arg_2 = bool();
+ var res: bool = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_c31f9e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_c31f9e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_c31f9e();
+}
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl
new file mode 100644
index 0000000..27b14d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_c31f9e() {
+ bool arg_0 = false;
+ bool arg_1 = false;
+ bool arg_2 = false;
+ bool res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_c31f9e();
+ 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;
+
+void select_c31f9e() {
+ bool arg_0 = false;
+ bool arg_1 = false;
+ bool arg_2 = false;
+ bool res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_c31f9e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_c31f9e() {
+ bool arg_0 = false;
+ bool arg_1 = false;
+ bool arg_2 = false;
+ bool res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_c31f9e();
+}
+
+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/select/c31f9e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.hlsl
new file mode 100644
index 0000000..c47c75a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_c31f9e() {
+ bool arg_0 = false;
+ bool arg_1 = false;
+ bool arg_2 = false;
+ bool res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_c31f9e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_c31f9e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_c31f9e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl
new file mode 100644
index 0000000..8ff1e0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_c31f9e() {
+ bool arg_0 = false;
+ bool arg_1 = false;
+ bool arg_2 = false;
+ bool res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_c31f9e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_c31f9e();
+ return;
+}
+
+kernel void compute_main() {
+ select_c31f9e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm
new file mode 100644
index 0000000..6c8a03d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; 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 %select_c31f9e "select_c31f9e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %14 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_c31f9e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_bool Function %14
+ %arg_1 = OpVariable %_ptr_Function_bool Function %14
+ %arg_2 = OpVariable %_ptr_Function_bool Function %14
+ %res = OpVariable %_ptr_Function_bool Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %20 = OpLoad %bool %arg_2
+ %21 = OpLoad %bool %arg_1
+ %22 = OpLoad %bool %arg_0
+ %19 = OpSelect %bool %20 %21 %22
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %select_c31f9e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %select_c31f9e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %select_c31f9e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl
new file mode 100644
index 0000000..1e57746
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c31f9e.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_c31f9e() {
+ var arg_0 = bool();
+ var arg_1 = bool();
+ var arg_2 = bool();
+ var res : bool = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_c31f9e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_c31f9e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_c31f9e();
+}
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl
new file mode 100644
index 0000000..64817eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, bool>, vec<4, bool>, bool) -> vec<4, bool>
+fn select_c41bd1() {
+ var arg_0 = vec4<bool>();
+ var arg_1 = vec4<bool>();
+ var arg_2 = bool();
+ var res: vec4<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_c41bd1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_c41bd1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_c41bd1();
+}
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl
new file mode 100644
index 0000000..a24ce06
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_c41bd1() {
+ bvec4 arg_0 = bvec4(false);
+ bvec4 arg_1 = bvec4(false);
+ bool arg_2 = false;
+ bvec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_c41bd1();
+ 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;
+
+void select_c41bd1() {
+ bvec4 arg_0 = bvec4(false);
+ bvec4 arg_1 = bvec4(false);
+ bool arg_2 = false;
+ bvec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_c41bd1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_c41bd1() {
+ bvec4 arg_0 = bvec4(false);
+ bvec4 arg_1 = bvec4(false);
+ bool arg_2 = false;
+ bvec4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_c41bd1();
+}
+
+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/select/c41bd1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.hlsl
new file mode 100644
index 0000000..09571cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_c41bd1() {
+ bool4 arg_0 = (false).xxxx;
+ bool4 arg_1 = (false).xxxx;
+ bool arg_2 = false;
+ bool4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_c41bd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_c41bd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_c41bd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl
new file mode 100644
index 0000000..b2e7ba2
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_c41bd1() {
+ bool4 arg_0 = bool4(false);
+ bool4 arg_1 = bool4(false);
+ bool arg_2 = false;
+ bool4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_c41bd1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_c41bd1();
+ return;
+}
+
+kernel void compute_main() {
+ select_c41bd1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm
new file mode 100644
index 0000000..b160641
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_c41bd1 "select_c41bd1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %15 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %19 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_c41bd1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4bool Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4bool Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %19
+ %26 = OpVariable %_ptr_Function_v4bool Function %15
+ %res = OpVariable %_ptr_Function_v4bool Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %19
+ %23 = OpLoad %bool %arg_2
+ %24 = OpLoad %v4bool %arg_1
+ %25 = OpLoad %v4bool %arg_0
+ %27 = OpCompositeConstruct %v4bool %23 %23 %23 %23
+ %22 = OpSelect %v4bool %27 %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_c41bd1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_c41bd1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_c41bd1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl
new file mode 100644
index 0000000..68857ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c41bd1.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_c41bd1() {
+ var arg_0 = vec4<bool>();
+ var arg_1 = vec4<bool>();
+ var arg_2 = bool();
+ var res : vec4<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_c41bd1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_c41bd1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_c41bd1();
+}
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl
new file mode 100644
index 0000000..a81e6df
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, u32>, vec<4, u32>, vec<4, bool>) -> vec<4, u32>
+fn select_c4a4ef() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = vec4<bool>();
+ var res: vec4<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_c4a4ef();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_c4a4ef();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_c4a4ef();
+}
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl
new file mode 100644
index 0000000..d20e19f
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_c4a4ef() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ bvec4 arg_2 = bvec4(false);
+ uvec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_c4a4ef();
+ 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;
+
+void select_c4a4ef() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ bvec4 arg_2 = bvec4(false);
+ uvec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_c4a4ef();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_c4a4ef() {
+ uvec4 arg_0 = uvec4(0u);
+ uvec4 arg_1 = uvec4(0u);
+ bvec4 arg_2 = bvec4(false);
+ uvec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_c4a4ef();
+}
+
+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/select/c4a4ef.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.hlsl
new file mode 100644
index 0000000..640511b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_c4a4ef() {
+ uint4 arg_0 = (0u).xxxx;
+ uint4 arg_1 = (0u).xxxx;
+ bool4 arg_2 = (false).xxxx;
+ uint4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_c4a4ef();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_c4a4ef();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_c4a4ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl
new file mode 100644
index 0000000..0c1ae54
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_c4a4ef() {
+ uint4 arg_0 = uint4(0u);
+ uint4 arg_1 = uint4(0u);
+ bool4 arg_2 = bool4(false);
+ uint4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_c4a4ef();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_c4a4ef();
+ return;
+}
+
+kernel void compute_main() {
+ select_c4a4ef();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm
new file mode 100644
index 0000000..43b65fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_c4a4ef "select_c4a4ef"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %v4uint = OpTypeVector %uint 4
+ %15 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %21 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_c4a4ef = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4uint Function %15
+ %arg_2 = OpVariable %_ptr_Function_v4bool Function %21
+ %res = OpVariable %_ptr_Function_v4uint Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %21
+ %25 = OpLoad %v4bool %arg_2
+ %26 = OpLoad %v4uint %arg_1
+ %27 = OpLoad %v4uint %arg_0
+ %24 = OpSelect %v4uint %25 %26 %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_c4a4ef
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_c4a4ef
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_c4a4ef
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl
new file mode 100644
index 0000000..843cfc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/c4a4ef.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_c4a4ef() {
+ var arg_0 = vec4<u32>();
+ var arg_1 = vec4<u32>();
+ var arg_2 = vec4<bool>();
+ var res : vec4<u32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_c4a4ef();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_c4a4ef();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_c4a4ef();
+}
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl b/test/tint/builtins/gen/var/select/cb9301.wgsl
new file mode 100644
index 0000000..0adf8d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, bool>, vec<2, bool>, vec<2, bool>) -> vec<2, bool>
+fn select_cb9301() {
+ var arg_0 = vec2<bool>();
+ var arg_1 = vec2<bool>();
+ var arg_2 = vec2<bool>();
+ var res: vec2<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_cb9301();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_cb9301();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_cb9301();
+}
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl
new file mode 100644
index 0000000..83f3e76
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_cb9301() {
+ bvec2 arg_0 = bvec2(false);
+ bvec2 arg_1 = bvec2(false);
+ bvec2 arg_2 = bvec2(false);
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_cb9301();
+ 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;
+
+void select_cb9301() {
+ bvec2 arg_0 = bvec2(false);
+ bvec2 arg_1 = bvec2(false);
+ bvec2 arg_2 = bvec2(false);
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_cb9301();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_cb9301() {
+ bvec2 arg_0 = bvec2(false);
+ bvec2 arg_1 = bvec2(false);
+ bvec2 arg_2 = bvec2(false);
+ bvec2 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_cb9301();
+}
+
+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/select/cb9301.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.hlsl
new file mode 100644
index 0000000..712794e
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_cb9301() {
+ bool2 arg_0 = (false).xx;
+ bool2 arg_1 = (false).xx;
+ bool2 arg_2 = (false).xx;
+ bool2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_cb9301();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_cb9301();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_cb9301();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl
new file mode 100644
index 0000000..f3fd18c
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_cb9301() {
+ bool2 arg_0 = bool2(false);
+ bool2 arg_1 = bool2(false);
+ bool2 arg_2 = bool2(false);
+ bool2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_cb9301();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_cb9301();
+ return;
+}
+
+kernel void compute_main() {
+ select_cb9301();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm
new file mode 100644
index 0000000..13598e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; 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 %select_cb9301 "select_cb9301"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %15 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_cb9301 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2bool Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2bool Function %15
+ %arg_2 = OpVariable %_ptr_Function_v2bool Function %15
+ %res = OpVariable %_ptr_Function_v2bool Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %21 = OpLoad %v2bool %arg_2
+ %22 = OpLoad %v2bool %arg_1
+ %23 = OpLoad %v2bool %arg_0
+ %20 = OpSelect %v2bool %21 %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %select_cb9301
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_cb9301
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_cb9301
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl
new file mode 100644
index 0000000..aa7f2a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/cb9301.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_cb9301() {
+ var arg_0 = vec2<bool>();
+ var arg_1 = vec2<bool>();
+ var arg_2 = vec2<bool>();
+ var res : vec2<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_cb9301();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_cb9301();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_cb9301();
+}
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl b/test/tint/builtins/gen/var/select/e3e028.wgsl
new file mode 100644
index 0000000..f0ed31a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<4, bool>, vec<4, bool>, vec<4, bool>) -> vec<4, bool>
+fn select_e3e028() {
+ var arg_0 = vec4<bool>();
+ var arg_1 = vec4<bool>();
+ var arg_2 = vec4<bool>();
+ var res: vec4<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_e3e028();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_e3e028();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_e3e028();
+}
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl
new file mode 100644
index 0000000..f7c42e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_e3e028() {
+ bvec4 arg_0 = bvec4(false);
+ bvec4 arg_1 = bvec4(false);
+ bvec4 arg_2 = bvec4(false);
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_e3e028();
+ 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;
+
+void select_e3e028() {
+ bvec4 arg_0 = bvec4(false);
+ bvec4 arg_1 = bvec4(false);
+ bvec4 arg_2 = bvec4(false);
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_e3e028();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_e3e028() {
+ bvec4 arg_0 = bvec4(false);
+ bvec4 arg_1 = bvec4(false);
+ bvec4 arg_2 = bvec4(false);
+ bvec4 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_e3e028();
+}
+
+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/select/e3e028.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.hlsl
new file mode 100644
index 0000000..1f55573
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_e3e028() {
+ bool4 arg_0 = (false).xxxx;
+ bool4 arg_1 = (false).xxxx;
+ bool4 arg_2 = (false).xxxx;
+ bool4 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_e3e028();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_e3e028();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_e3e028();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl
new file mode 100644
index 0000000..ad607f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_e3e028() {
+ bool4 arg_0 = bool4(false);
+ bool4 arg_1 = bool4(false);
+ bool4 arg_2 = bool4(false);
+ bool4 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_e3e028();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_e3e028();
+ return;
+}
+
+kernel void compute_main() {
+ select_e3e028();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm
new file mode 100644
index 0000000..7397e7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; 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 %select_e3e028 "select_e3e028"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v4bool = OpTypeVector %bool 4
+ %15 = OpConstantNull %v4bool
+%_ptr_Function_v4bool = OpTypePointer Function %v4bool
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_e3e028 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4bool Function %15
+ %arg_1 = OpVariable %_ptr_Function_v4bool Function %15
+ %arg_2 = OpVariable %_ptr_Function_v4bool Function %15
+ %res = OpVariable %_ptr_Function_v4bool Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %15
+ %21 = OpLoad %v4bool %arg_2
+ %22 = OpLoad %v4bool %arg_1
+ %23 = OpLoad %v4bool %arg_0
+ %20 = OpSelect %v4bool %21 %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %select_e3e028
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %select_e3e028
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_e3e028
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl
new file mode 100644
index 0000000..fa2243a
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/e3e028.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_e3e028() {
+ var arg_0 = vec4<bool>();
+ var arg_1 = vec4<bool>();
+ var arg_2 = vec4<bool>();
+ var res : vec4<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_e3e028();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_e3e028();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_e3e028();
+}
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl
new file mode 100644
index 0000000..8ca2585
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<3, f32>, vec<3, f32>, vec<3, bool>) -> vec<3, f32>
+fn select_ebfea2() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<bool>();
+ var res: vec3<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_ebfea2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_ebfea2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_ebfea2();
+}
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl
new file mode 100644
index 0000000..de4df3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_ebfea2() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ bvec3 arg_2 = bvec3(false);
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ select_ebfea2();
+ 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;
+
+void select_ebfea2() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ bvec3 arg_2 = bvec3(false);
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ select_ebfea2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_ebfea2() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ bvec3 arg_2 = bvec3(false);
+ vec3 res = mix(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ select_ebfea2();
+}
+
+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/select/ebfea2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.hlsl
new file mode 100644
index 0000000..e7f7af2
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_ebfea2() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ bool3 arg_2 = (false).xxx;
+ float3 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_ebfea2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_ebfea2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_ebfea2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl
new file mode 100644
index 0000000..a4bf795
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_ebfea2() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ bool3 arg_2 = bool3(false);
+ float3 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_ebfea2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_ebfea2();
+ return;
+}
+
+kernel void compute_main() {
+ select_ebfea2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm
new file mode 100644
index 0000000..17e6912
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; 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 %select_ebfea2 "select_ebfea2"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+ %20 = OpConstantNull %v3bool
+%_ptr_Function_v3bool = OpTypePointer Function %v3bool
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_ebfea2 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v3bool Function %20
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %20
+ %24 = OpLoad %v3bool %arg_2
+ %25 = OpLoad %v3float %arg_1
+ %26 = OpLoad %v3float %arg_0
+ %23 = OpSelect %v3float %24 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %select_ebfea2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_ebfea2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %select_ebfea2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl
new file mode 100644
index 0000000..e6ab17b
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ebfea2.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_ebfea2() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<bool>();
+ var res : vec3<f32> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_ebfea2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_ebfea2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_ebfea2();
+}
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl
new file mode 100644
index 0000000..450eac3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(i32, i32, bool) -> i32
+fn select_ed8a15() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var arg_2 = bool();
+ var res: i32 = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_ed8a15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_ed8a15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_ed8a15();
+}
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl
new file mode 100644
index 0000000..b8a1787
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_ed8a15() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ bool arg_2 = false;
+ int res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_ed8a15();
+ 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;
+
+void select_ed8a15() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ bool arg_2 = false;
+ int res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_ed8a15();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_ed8a15() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ bool arg_2 = false;
+ int res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_ed8a15();
+}
+
+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/select/ed8a15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.hlsl
new file mode 100644
index 0000000..9c3ec95
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_ed8a15() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ bool arg_2 = false;
+ int res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_ed8a15();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_ed8a15();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_ed8a15();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl
new file mode 100644
index 0000000..f28caa9
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_ed8a15() {
+ int arg_0 = 1;
+ int arg_1 = 1;
+ bool arg_2 = false;
+ int res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_ed8a15();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_ed8a15();
+ return;
+}
+
+kernel void compute_main() {
+ select_ed8a15();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm
new file mode 100644
index 0000000..1479e66
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; 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 %select_ed8a15 "select_ed8a15"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %17 = OpConstantNull %int
+ %bool = OpTypeBool
+ %20 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_ed8a15 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_int Function %17
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %arg_2 = OpVariable %_ptr_Function_bool Function %20
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_0 %int_1
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %20
+ %24 = OpLoad %bool %arg_2
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %int %arg_0
+ %23 = OpSelect %int %24 %25 %26
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %select_ed8a15
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %select_ed8a15
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %select_ed8a15
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl
new file mode 100644
index 0000000..7f1c4d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/ed8a15.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_ed8a15() {
+ var arg_0 = 1;
+ var arg_1 = 1;
+ var arg_2 = bool();
+ var res : i32 = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_ed8a15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_ed8a15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_ed8a15();
+}
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl
new file mode 100644
index 0000000..14fc5b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn select(vec<2, bool>, vec<2, bool>, bool) -> vec<2, bool>
+fn select_fb7e53() {
+ var arg_0 = vec2<bool>();
+ var arg_1 = vec2<bool>();
+ var arg_2 = bool();
+ var res: vec2<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_fb7e53();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_fb7e53();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_fb7e53();
+}
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl
new file mode 100644
index 0000000..af24c00
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void select_fb7e53() {
+ bvec2 arg_0 = bvec2(false);
+ bvec2 arg_1 = bvec2(false);
+ bool arg_2 = false;
+ bvec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+vec4 vertex_main() {
+ select_fb7e53();
+ 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;
+
+void select_fb7e53() {
+ bvec2 arg_0 = bvec2(false);
+ bvec2 arg_1 = bvec2(false);
+ bool arg_2 = false;
+ bvec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void fragment_main() {
+ select_fb7e53();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void select_fb7e53() {
+ bvec2 arg_0 = bvec2(false);
+ bvec2 arg_1 = bvec2(false);
+ bool arg_2 = false;
+ bvec2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+void compute_main() {
+ select_fb7e53();
+}
+
+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/select/fb7e53.wgsl.expected.hlsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.hlsl
new file mode 100644
index 0000000..c5056e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void select_fb7e53() {
+ bool2 arg_0 = (false).xx;
+ bool2 arg_1 = (false).xx;
+ bool arg_2 = false;
+ bool2 res = (arg_2 ? arg_1 : arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ select_fb7e53();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ select_fb7e53();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ select_fb7e53();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl
new file mode 100644
index 0000000..f5c62b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void select_fb7e53() {
+ bool2 arg_0 = bool2(false);
+ bool2 arg_1 = bool2(false);
+ bool arg_2 = false;
+ bool2 res = select(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ select_fb7e53();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ select_fb7e53();
+ return;
+}
+
+kernel void compute_main() {
+ select_fb7e53();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm
new file mode 100644
index 0000000..ea49de4
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %select_fb7e53 "select_fb7e53"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %bool = OpTypeBool
+ %v2bool = OpTypeVector %bool 2
+ %15 = OpConstantNull %v2bool
+%_ptr_Function_v2bool = OpTypePointer Function %v2bool
+ %19 = OpConstantNull %bool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%select_fb7e53 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2bool Function %15
+ %arg_1 = OpVariable %_ptr_Function_v2bool Function %15
+ %arg_2 = OpVariable %_ptr_Function_bool Function %19
+ %26 = OpVariable %_ptr_Function_v2bool Function %15
+ %res = OpVariable %_ptr_Function_v2bool Function %15
+ OpStore %arg_0 %15
+ OpStore %arg_1 %15
+ OpStore %arg_2 %19
+ %23 = OpLoad %bool %arg_2
+ %24 = OpLoad %v2bool %arg_1
+ %25 = OpLoad %v2bool %arg_0
+ %27 = OpCompositeConstruct %v2bool %23 %23
+ %22 = OpSelect %v2bool %27 %24 %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %select_fb7e53
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %35
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %select_fb7e53
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %select_fb7e53
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl
new file mode 100644
index 0000000..125fabf
--- /dev/null
+++ b/test/tint/builtins/gen/var/select/fb7e53.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn select_fb7e53() {
+ var arg_0 = vec2<bool>();
+ var arg_1 = vec2<bool>();
+ var arg_2 = bool();
+ var res : vec2<bool> = select(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ select_fb7e53();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ select_fb7e53();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ select_fb7e53();
+}
diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl b/test/tint/builtins/gen/var/sign/159665.wgsl
new file mode 100644
index 0000000..9b02104
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/159665.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sign(vec<3, f32>) -> vec<3, f32>
+fn sign_159665() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_159665();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_159665();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_159665();
+}
diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl
new file mode 100644
index 0000000..9427bed
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sign_159665() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sign(arg_0);
+}
+
+vec4 vertex_main() {
+ sign_159665();
+ 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;
+
+void sign_159665() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sign(arg_0);
+}
+
+void fragment_main() {
+ sign_159665();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sign_159665() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sign(arg_0);
+}
+
+void compute_main() {
+ sign_159665();
+}
+
+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/sign/159665.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.hlsl
new file mode 100644
index 0000000..6c8fde0
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sign_159665() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sign_159665();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sign_159665();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sign_159665();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl
new file mode 100644
index 0000000..38383b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_159665() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sign_159665();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sign_159665();
+ return;
+}
+
+kernel void compute_main() {
+ sign_159665();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm
new file mode 100644
index 0000000..9bc6977
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sign_159665 "sign_159665"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sign_159665 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 FSign %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sign_159665
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sign_159665
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sign_159665
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl
new file mode 100644
index 0000000..139cee0
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/159665.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_159665() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_159665();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_159665();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_159665();
+}
diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl
new file mode 100644
index 0000000..f4473c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sign(vec<4, f32>) -> vec<4, f32>
+fn sign_b8f634() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_b8f634();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_b8f634();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_b8f634();
+}
diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl
new file mode 100644
index 0000000..18bb2b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sign_b8f634() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sign(arg_0);
+}
+
+vec4 vertex_main() {
+ sign_b8f634();
+ 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;
+
+void sign_b8f634() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sign(arg_0);
+}
+
+void fragment_main() {
+ sign_b8f634();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sign_b8f634() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sign(arg_0);
+}
+
+void compute_main() {
+ sign_b8f634();
+}
+
+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/sign/b8f634.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.hlsl
new file mode 100644
index 0000000..19c3470
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sign_b8f634() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sign_b8f634();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sign_b8f634();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sign_b8f634();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl
new file mode 100644
index 0000000..3dc4473
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_b8f634() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sign_b8f634();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sign_b8f634();
+ return;
+}
+
+kernel void compute_main() {
+ sign_b8f634();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm
new file mode 100644
index 0000000..27635d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %sign_b8f634 "sign_b8f634"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sign_b8f634 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 FSign %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %sign_b8f634
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sign_b8f634
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sign_b8f634
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl
new file mode 100644
index 0000000..cd37c6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/b8f634.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_b8f634() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_b8f634();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_b8f634();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_b8f634();
+}
diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl
new file mode 100644
index 0000000..ad538d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sign(vec<2, f32>) -> vec<2, f32>
+fn sign_d065d8() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_d065d8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_d065d8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_d065d8();
+}
diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl
new file mode 100644
index 0000000..e98d5e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sign_d065d8() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sign(arg_0);
+}
+
+vec4 vertex_main() {
+ sign_d065d8();
+ 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;
+
+void sign_d065d8() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sign(arg_0);
+}
+
+void fragment_main() {
+ sign_d065d8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sign_d065d8() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sign(arg_0);
+}
+
+void compute_main() {
+ sign_d065d8();
+}
+
+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/sign/d065d8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.hlsl
new file mode 100644
index 0000000..9abf6c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sign_d065d8() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sign_d065d8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sign_d065d8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sign_d065d8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl
new file mode 100644
index 0000000..ddcf621
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_d065d8() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sign_d065d8();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sign_d065d8();
+ return;
+}
+
+kernel void compute_main() {
+ sign_d065d8();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm
new file mode 100644
index 0000000..dfdb7fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sign_d065d8 "sign_d065d8"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sign_d065d8 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 FSign %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sign_d065d8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sign_d065d8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sign_d065d8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl
new file mode 100644
index 0000000..9b3d127
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/d065d8.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_d065d8() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_d065d8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_d065d8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_d065d8();
+}
diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl
new file mode 100644
index 0000000..f381540
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sign(f32) -> f32
+fn sign_dd790e() {
+ var arg_0 = 1.0;
+ var res: f32 = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_dd790e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_dd790e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_dd790e();
+}
diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl
new file mode 100644
index 0000000..a347670
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sign_dd790e() {
+ float arg_0 = 1.0f;
+ float res = sign(arg_0);
+}
+
+vec4 vertex_main() {
+ sign_dd790e();
+ 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;
+
+void sign_dd790e() {
+ float arg_0 = 1.0f;
+ float res = sign(arg_0);
+}
+
+void fragment_main() {
+ sign_dd790e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sign_dd790e() {
+ float arg_0 = 1.0f;
+ float res = sign(arg_0);
+}
+
+void compute_main() {
+ sign_dd790e();
+}
+
+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/sign/dd790e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.hlsl
new file mode 100644
index 0000000..d0ef005
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sign_dd790e() {
+ float arg_0 = 1.0f;
+ float res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sign_dd790e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sign_dd790e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sign_dd790e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl
new file mode 100644
index 0000000..8f79ad2
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sign_dd790e() {
+ float arg_0 = 1.0f;
+ float res = sign(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sign_dd790e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sign_dd790e();
+ return;
+}
+
+kernel void compute_main() {
+ sign_dd790e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm
new file mode 100644
index 0000000..8ef69f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %sign_dd790e "sign_dd790e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%sign_dd790e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 FSign %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %sign_dd790e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sign_dd790e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sign_dd790e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl
new file mode 100644
index 0000000..b6b8bb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/sign/dd790e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sign_dd790e() {
+ var arg_0 = 1.0;
+ var res : f32 = sign(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sign_dd790e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sign_dd790e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sign_dd790e();
+}
diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl b/test/tint/builtins/gen/var/sin/01f241.wgsl
new file mode 100644
index 0000000..533a83a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/01f241.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sin(vec<3, f32>) -> vec<3, f32>
+fn sin_01f241() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_01f241();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_01f241();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_01f241();
+}
diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl
new file mode 100644
index 0000000..f9b8981
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sin_01f241() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sin(arg_0);
+}
+
+vec4 vertex_main() {
+ sin_01f241();
+ 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;
+
+void sin_01f241() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sin(arg_0);
+}
+
+void fragment_main() {
+ sin_01f241();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sin_01f241() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sin(arg_0);
+}
+
+void compute_main() {
+ sin_01f241();
+}
+
+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/sin/01f241.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.hlsl
new file mode 100644
index 0000000..d2419e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sin_01f241() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sin_01f241();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sin_01f241();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sin_01f241();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl
new file mode 100644
index 0000000..4beab98
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sin_01f241() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sin_01f241();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sin_01f241();
+ return;
+}
+
+kernel void compute_main() {
+ sin_01f241();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm
new file mode 100644
index 0000000..53fbcbd
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sin_01f241 "sin_01f241"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %sin_01f241 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Sin %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sin_01f241
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sin_01f241
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sin_01f241
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl
new file mode 100644
index 0000000..dac1cf6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/01f241.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sin_01f241() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_01f241();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_01f241();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_01f241();
+}
diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl
new file mode 100644
index 0000000..5ae4b3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sin(vec<4, f32>) -> vec<4, f32>
+fn sin_4e3979() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_4e3979();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_4e3979();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_4e3979();
+}
diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl
new file mode 100644
index 0000000..201e133
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sin_4e3979() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sin(arg_0);
+}
+
+vec4 vertex_main() {
+ sin_4e3979();
+ 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;
+
+void sin_4e3979() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sin(arg_0);
+}
+
+void fragment_main() {
+ sin_4e3979();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sin_4e3979() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sin(arg_0);
+}
+
+void compute_main() {
+ sin_4e3979();
+}
+
+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/sin/4e3979.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.hlsl
new file mode 100644
index 0000000..17d1855
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sin_4e3979() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sin_4e3979();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sin_4e3979();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sin_4e3979();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl
new file mode 100644
index 0000000..5d7e8fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sin_4e3979() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sin_4e3979();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sin_4e3979();
+ return;
+}
+
+kernel void compute_main() {
+ sin_4e3979();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm
new file mode 100644
index 0000000..f8e43b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %sin_4e3979 "sin_4e3979"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %sin_4e3979 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Sin %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %sin_4e3979
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sin_4e3979
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sin_4e3979
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl
new file mode 100644
index 0000000..b588d0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/4e3979.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sin_4e3979() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_4e3979();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_4e3979();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_4e3979();
+}
diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl
new file mode 100644
index 0000000..23a08d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sin(f32) -> f32
+fn sin_b78c91() {
+ var arg_0 = 1.0;
+ var res: f32 = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_b78c91();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_b78c91();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_b78c91();
+}
diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl
new file mode 100644
index 0000000..97f9d76
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sin_b78c91() {
+ float arg_0 = 1.0f;
+ float res = sin(arg_0);
+}
+
+vec4 vertex_main() {
+ sin_b78c91();
+ 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;
+
+void sin_b78c91() {
+ float arg_0 = 1.0f;
+ float res = sin(arg_0);
+}
+
+void fragment_main() {
+ sin_b78c91();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sin_b78c91() {
+ float arg_0 = 1.0f;
+ float res = sin(arg_0);
+}
+
+void compute_main() {
+ sin_b78c91();
+}
+
+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/sin/b78c91.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.hlsl
new file mode 100644
index 0000000..001dc1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sin_b78c91() {
+ float arg_0 = 1.0f;
+ float res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sin_b78c91();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sin_b78c91();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sin_b78c91();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl
new file mode 100644
index 0000000..8aaa9f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sin_b78c91() {
+ float arg_0 = 1.0f;
+ float res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sin_b78c91();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sin_b78c91();
+ return;
+}
+
+kernel void compute_main() {
+ sin_b78c91();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b31113
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %sin_b78c91 "sin_b78c91"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %sin_b78c91 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Sin %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %sin_b78c91
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sin_b78c91
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sin_b78c91
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl
new file mode 100644
index 0000000..b736ea8
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/b78c91.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sin_b78c91() {
+ var arg_0 = 1.0;
+ var res : f32 = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_b78c91();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_b78c91();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_b78c91();
+}
diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl
new file mode 100644
index 0000000..66ad20a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sin(vec<2, f32>) -> vec<2, f32>
+fn sin_fc8bc4() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_fc8bc4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_fc8bc4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_fc8bc4();
+}
diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl
new file mode 100644
index 0000000..d5071ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sin_fc8bc4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sin(arg_0);
+}
+
+vec4 vertex_main() {
+ sin_fc8bc4();
+ 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;
+
+void sin_fc8bc4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sin(arg_0);
+}
+
+void fragment_main() {
+ sin_fc8bc4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sin_fc8bc4() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sin(arg_0);
+}
+
+void compute_main() {
+ sin_fc8bc4();
+}
+
+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/sin/fc8bc4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.hlsl
new file mode 100644
index 0000000..a06c569
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sin_fc8bc4() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sin_fc8bc4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sin_fc8bc4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sin_fc8bc4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl
new file mode 100644
index 0000000..602c005
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sin_fc8bc4() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = sin(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sin_fc8bc4();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sin_fc8bc4();
+ return;
+}
+
+kernel void compute_main() {
+ sin_fc8bc4();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm
new file mode 100644
index 0000000..e7dff32
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sin_fc8bc4 "sin_fc8bc4"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %sin_fc8bc4 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Sin %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sin_fc8bc4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sin_fc8bc4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sin_fc8bc4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl
new file mode 100644
index 0000000..0168f26
--- /dev/null
+++ b/test/tint/builtins/gen/var/sin/fc8bc4.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sin_fc8bc4() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = sin(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sin_fc8bc4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sin_fc8bc4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sin_fc8bc4();
+}
diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl
new file mode 100644
index 0000000..aedfe3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sinh(vec<4, f32>) -> vec<4, f32>
+fn sinh_445e33() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_445e33();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_445e33();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_445e33();
+}
diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl
new file mode 100644
index 0000000..474189b
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sinh_445e33() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sinh(arg_0);
+}
+
+vec4 vertex_main() {
+ sinh_445e33();
+ 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;
+
+void sinh_445e33() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sinh(arg_0);
+}
+
+void fragment_main() {
+ sinh_445e33();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sinh_445e33() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sinh(arg_0);
+}
+
+void compute_main() {
+ sinh_445e33();
+}
+
+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/sinh/445e33.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.hlsl
new file mode 100644
index 0000000..7ae5522
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sinh_445e33() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sinh_445e33();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sinh_445e33();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sinh_445e33();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl
new file mode 100644
index 0000000..20a5830
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sinh_445e33() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sinh_445e33();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sinh_445e33();
+ return;
+}
+
+kernel void compute_main() {
+ sinh_445e33();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm
new file mode 100644
index 0000000..0bf452a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %sinh_445e33 "sinh_445e33"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sinh_445e33 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Sinh %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %sinh_445e33
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sinh_445e33
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sinh_445e33
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl
new file mode 100644
index 0000000..5b1e2a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/445e33.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sinh_445e33() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_445e33();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_445e33();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_445e33();
+}
diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl
new file mode 100644
index 0000000..0075c04
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sinh(f32) -> f32
+fn sinh_7bb598() {
+ var arg_0 = 1.0;
+ var res: f32 = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_7bb598();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_7bb598();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_7bb598();
+}
diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl
new file mode 100644
index 0000000..90e5597
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sinh_7bb598() {
+ float arg_0 = 1.0f;
+ float res = sinh(arg_0);
+}
+
+vec4 vertex_main() {
+ sinh_7bb598();
+ 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;
+
+void sinh_7bb598() {
+ float arg_0 = 1.0f;
+ float res = sinh(arg_0);
+}
+
+void fragment_main() {
+ sinh_7bb598();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sinh_7bb598() {
+ float arg_0 = 1.0f;
+ float res = sinh(arg_0);
+}
+
+void compute_main() {
+ sinh_7bb598();
+}
+
+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/sinh/7bb598.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.hlsl
new file mode 100644
index 0000000..1aeb0cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sinh_7bb598() {
+ float arg_0 = 1.0f;
+ float res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sinh_7bb598();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sinh_7bb598();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sinh_7bb598();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl
new file mode 100644
index 0000000..f78c11e
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sinh_7bb598() {
+ float arg_0 = 1.0f;
+ float res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sinh_7bb598();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sinh_7bb598();
+ return;
+}
+
+kernel void compute_main() {
+ sinh_7bb598();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm
new file mode 100644
index 0000000..bd605b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %sinh_7bb598 "sinh_7bb598"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%sinh_7bb598 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Sinh %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %sinh_7bb598
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sinh_7bb598
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sinh_7bb598
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl
new file mode 100644
index 0000000..1d5be8c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/7bb598.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sinh_7bb598() {
+ var arg_0 = 1.0;
+ var res : f32 = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_7bb598();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_7bb598();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_7bb598();
+}
diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl
new file mode 100644
index 0000000..530c423
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sinh(vec<2, f32>) -> vec<2, f32>
+fn sinh_b9860e() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_b9860e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_b9860e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_b9860e();
+}
diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl
new file mode 100644
index 0000000..ad6e3fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sinh_b9860e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sinh(arg_0);
+}
+
+vec4 vertex_main() {
+ sinh_b9860e();
+ 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;
+
+void sinh_b9860e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sinh(arg_0);
+}
+
+void fragment_main() {
+ sinh_b9860e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sinh_b9860e() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sinh(arg_0);
+}
+
+void compute_main() {
+ sinh_b9860e();
+}
+
+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/sinh/b9860e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.hlsl
new file mode 100644
index 0000000..f1a64f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sinh_b9860e() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sinh_b9860e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sinh_b9860e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sinh_b9860e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl
new file mode 100644
index 0000000..13cb06a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sinh_b9860e() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sinh_b9860e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sinh_b9860e();
+ return;
+}
+
+kernel void compute_main() {
+ sinh_b9860e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm
new file mode 100644
index 0000000..5dbdbeb
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sinh_b9860e "sinh_b9860e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sinh_b9860e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Sinh %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sinh_b9860e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sinh_b9860e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sinh_b9860e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl
new file mode 100644
index 0000000..d1153b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/b9860e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sinh_b9860e() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_b9860e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_b9860e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_b9860e();
+}
diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl
new file mode 100644
index 0000000..94f38dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sinh(vec<3, f32>) -> vec<3, f32>
+fn sinh_c9a5eb() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_c9a5eb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_c9a5eb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_c9a5eb();
+}
diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl
new file mode 100644
index 0000000..d8de41d
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sinh_c9a5eb() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sinh(arg_0);
+}
+
+vec4 vertex_main() {
+ sinh_c9a5eb();
+ 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;
+
+void sinh_c9a5eb() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sinh(arg_0);
+}
+
+void fragment_main() {
+ sinh_c9a5eb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sinh_c9a5eb() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sinh(arg_0);
+}
+
+void compute_main() {
+ sinh_c9a5eb();
+}
+
+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/sinh/c9a5eb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.hlsl
new file mode 100644
index 0000000..b600a69
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sinh_c9a5eb() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sinh_c9a5eb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sinh_c9a5eb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sinh_c9a5eb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl
new file mode 100644
index 0000000..6903d34
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sinh_c9a5eb() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = sinh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sinh_c9a5eb();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sinh_c9a5eb();
+ return;
+}
+
+kernel void compute_main() {
+ sinh_c9a5eb();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm
new file mode 100644
index 0000000..06720a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sinh_c9a5eb "sinh_c9a5eb"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sinh_c9a5eb = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Sinh %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sinh_c9a5eb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sinh_c9a5eb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sinh_c9a5eb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd5b007
--- /dev/null
+++ b/test/tint/builtins/gen/var/sinh/c9a5eb.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sinh_c9a5eb() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = sinh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sinh_c9a5eb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sinh_c9a5eb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sinh_c9a5eb();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl
new file mode 100644
index 0000000..3b00111
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn smoothstep(vec<2, f32>, vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn smoothstep_392c19() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res: vec2<f32> = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_392c19();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_392c19();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_392c19();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl
new file mode 100644
index 0000000..37a5da9
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void smoothstep_392c19() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ smoothstep_392c19();
+ 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;
+
+void smoothstep_392c19() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ smoothstep_392c19();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void smoothstep_392c19() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 arg_2 = vec2(0.0f);
+ vec2 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ smoothstep_392c19();
+}
+
+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/smoothstep/392c19.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.hlsl
new file mode 100644
index 0000000..1d57c73
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void smoothstep_392c19() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 arg_2 = (0.0f).xx;
+ float2 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ smoothstep_392c19();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ smoothstep_392c19();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ smoothstep_392c19();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl
new file mode 100644
index 0000000..38ba87c
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void smoothstep_392c19() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 arg_2 = float2(0.0f);
+ float2 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ smoothstep_392c19();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ smoothstep_392c19();
+ return;
+}
+
+kernel void compute_main() {
+ smoothstep_392c19();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm
new file mode 100644
index 0000000..b41e51a
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %smoothstep_392c19 "smoothstep_392c19"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%smoothstep_392c19 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v2float %arg_0
+ %22 = OpLoad %v2float %arg_1
+ %23 = OpLoad %v2float %arg_2
+ %19 = OpExtInst %v2float %20 SmoothStep %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %smoothstep_392c19
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %smoothstep_392c19
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %smoothstep_392c19
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl
new file mode 100644
index 0000000..06beb1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/392c19.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn smoothstep_392c19() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var arg_2 = vec2<f32>();
+ var res : vec2<f32> = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_392c19();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_392c19();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_392c19();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl
new file mode 100644
index 0000000..898791a
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn smoothstep(vec<4, f32>, vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn smoothstep_40864c() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res: vec4<f32> = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_40864c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_40864c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_40864c();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl
new file mode 100644
index 0000000..1a3e2c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void smoothstep_40864c() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ smoothstep_40864c();
+ 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;
+
+void smoothstep_40864c() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ smoothstep_40864c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void smoothstep_40864c() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 arg_2 = vec4(0.0f);
+ vec4 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ smoothstep_40864c();
+}
+
+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/smoothstep/40864c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.hlsl
new file mode 100644
index 0000000..e9f0a25
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void smoothstep_40864c() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 arg_2 = (0.0f).xxxx;
+ float4 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ smoothstep_40864c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ smoothstep_40864c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ smoothstep_40864c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl
new file mode 100644
index 0000000..dff1a8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void smoothstep_40864c() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 arg_2 = float4(0.0f);
+ float4 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ smoothstep_40864c();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ smoothstep_40864c();
+ return;
+}
+
+kernel void compute_main() {
+ smoothstep_40864c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm
new file mode 100644
index 0000000..b85bcaf
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %smoothstep_40864c "smoothstep_40864c"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%smoothstep_40864c = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ OpStore %arg_2 %5
+ %19 = OpLoad %v4float %arg_0
+ %20 = OpLoad %v4float %arg_1
+ %21 = OpLoad %v4float %arg_2
+ %17 = OpExtInst %v4float %18 SmoothStep %19 %20 %21
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %smoothstep_40864c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %smoothstep_40864c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %smoothstep_40864c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl
new file mode 100644
index 0000000..6fbfc2a
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/40864c.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn smoothstep_40864c() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var arg_2 = vec4<f32>();
+ var res : vec4<f32> = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_40864c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_40864c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_40864c();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl
new file mode 100644
index 0000000..c8483cc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn smoothstep(f32, f32, f32) -> f32
+fn smoothstep_6c4975() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res: f32 = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_6c4975();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_6c4975();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_6c4975();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl
new file mode 100644
index 0000000..1358850
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void smoothstep_6c4975() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ smoothstep_6c4975();
+ 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;
+
+void smoothstep_6c4975() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ smoothstep_6c4975();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void smoothstep_6c4975() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ smoothstep_6c4975();
+}
+
+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/smoothstep/6c4975.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.hlsl
new file mode 100644
index 0000000..b0bcfc6
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void smoothstep_6c4975() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ smoothstep_6c4975();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ smoothstep_6c4975();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ smoothstep_6c4975();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl
new file mode 100644
index 0000000..0a4293c
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void smoothstep_6c4975() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float arg_2 = 1.0f;
+ float res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ smoothstep_6c4975();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ smoothstep_6c4975();
+ return;
+}
+
+kernel void compute_main() {
+ smoothstep_6c4975();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm
new file mode 100644
index 0000000..e82372d
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %smoothstep_6c4975 "smoothstep_6c4975"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpTypeFunction %v4float
+%smoothstep_6c4975 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %arg_2 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ OpStore %arg_2 %float_1
+ %20 = OpLoad %float %arg_0
+ %21 = OpLoad %float %arg_1
+ %22 = OpLoad %float %arg_2
+ %18 = OpExtInst %float %19 SmoothStep %20 %21 %22
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %smoothstep_6c4975
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %smoothstep_6c4975
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %smoothstep_6c4975
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl
new file mode 100644
index 0000000..ce4b2bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/6c4975.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn smoothstep_6c4975() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var arg_2 = 1.0;
+ var res : f32 = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_6c4975();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_6c4975();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_6c4975();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl
new file mode 100644
index 0000000..1efd98f
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn smoothstep(vec<3, f32>, vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn smoothstep_aad1db() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res: vec3<f32> = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_aad1db();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_aad1db();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_aad1db();
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl
new file mode 100644
index 0000000..ae71ee9
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+void smoothstep_aad1db() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ smoothstep_aad1db();
+ 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;
+
+void smoothstep_aad1db() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ smoothstep_aad1db();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void smoothstep_aad1db() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 arg_2 = vec3(0.0f);
+ vec3 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ smoothstep_aad1db();
+}
+
+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/smoothstep/aad1db.wgsl.expected.hlsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.hlsl
new file mode 100644
index 0000000..c8e7d3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.hlsl
@@ -0,0 +1,33 @@
+void smoothstep_aad1db() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 arg_2 = (0.0f).xxx;
+ float3 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ smoothstep_aad1db();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ smoothstep_aad1db();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ smoothstep_aad1db();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl
new file mode 100644
index 0000000..4f27d5d
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void smoothstep_aad1db() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 arg_2 = float3(0.0f);
+ float3 res = smoothstep(arg_0, arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ smoothstep_aad1db();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ smoothstep_aad1db();
+ return;
+}
+
+kernel void compute_main() {
+ smoothstep_aad1db();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm
new file mode 100644
index 0000000..0fa5077
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %smoothstep_aad1db "smoothstep_aad1db"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%smoothstep_aad1db = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ OpStore %arg_2 %14
+ %21 = OpLoad %v3float %arg_0
+ %22 = OpLoad %v3float %arg_1
+ %23 = OpLoad %v3float %arg_2
+ %19 = OpExtInst %v3float %20 SmoothStep %21 %22 %23
+ OpStore %res %19
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %smoothstep_aad1db
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %smoothstep_aad1db
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %smoothstep_aad1db
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl
new file mode 100644
index 0000000..6b730b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/smoothstep/aad1db.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+fn smoothstep_aad1db() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var arg_2 = vec3<f32>();
+ var res : vec3<f32> = smoothstep(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ smoothstep_aad1db();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ smoothstep_aad1db();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ smoothstep_aad1db();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl
new file mode 100644
index 0000000..86b17d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sqrt(f32) -> f32
+fn sqrt_20c74e() {
+ var arg_0 = 1.0;
+ var res: f32 = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_20c74e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_20c74e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_20c74e();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl
new file mode 100644
index 0000000..73ac8a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sqrt_20c74e() {
+ float arg_0 = 1.0f;
+ float res = sqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ sqrt_20c74e();
+ 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;
+
+void sqrt_20c74e() {
+ float arg_0 = 1.0f;
+ float res = sqrt(arg_0);
+}
+
+void fragment_main() {
+ sqrt_20c74e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sqrt_20c74e() {
+ float arg_0 = 1.0f;
+ float res = sqrt(arg_0);
+}
+
+void compute_main() {
+ sqrt_20c74e();
+}
+
+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/sqrt/20c74e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.hlsl
new file mode 100644
index 0000000..6db93fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sqrt_20c74e() {
+ float arg_0 = 1.0f;
+ float res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sqrt_20c74e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sqrt_20c74e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sqrt_20c74e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl
new file mode 100644
index 0000000..7f9093d
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sqrt_20c74e() {
+ float arg_0 = 1.0f;
+ float res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sqrt_20c74e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sqrt_20c74e();
+ return;
+}
+
+kernel void compute_main() {
+ sqrt_20c74e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm
new file mode 100644
index 0000000..e7b4506
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %sqrt_20c74e "sqrt_20c74e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%sqrt_20c74e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Sqrt %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %sqrt_20c74e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sqrt_20c74e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sqrt_20c74e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl
new file mode 100644
index 0000000..84e54f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/20c74e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sqrt_20c74e() {
+ var arg_0 = 1.0;
+ var res : f32 = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_20c74e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_20c74e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_20c74e();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl
new file mode 100644
index 0000000..db384b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sqrt(vec<2, f32>) -> vec<2, f32>
+fn sqrt_8c7024() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_8c7024();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_8c7024();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_8c7024();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl
new file mode 100644
index 0000000..b0ab296
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sqrt_8c7024() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ sqrt_8c7024();
+ 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;
+
+void sqrt_8c7024() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sqrt(arg_0);
+}
+
+void fragment_main() {
+ sqrt_8c7024();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sqrt_8c7024() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = sqrt(arg_0);
+}
+
+void compute_main() {
+ sqrt_8c7024();
+}
+
+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/sqrt/8c7024.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.hlsl
new file mode 100644
index 0000000..3d8ed56
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sqrt_8c7024() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sqrt_8c7024();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sqrt_8c7024();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sqrt_8c7024();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl
new file mode 100644
index 0000000..d829aec
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sqrt_8c7024() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sqrt_8c7024();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sqrt_8c7024();
+ return;
+}
+
+kernel void compute_main() {
+ sqrt_8c7024();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm
new file mode 100644
index 0000000..dcc06b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sqrt_8c7024 "sqrt_8c7024"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sqrt_8c7024 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Sqrt %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sqrt_8c7024
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sqrt_8c7024
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sqrt_8c7024
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl
new file mode 100644
index 0000000..4e6fba0
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/8c7024.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sqrt_8c7024() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_8c7024();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_8c7024();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_8c7024();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl
new file mode 100644
index 0000000..84a347d
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sqrt(vec<4, f32>) -> vec<4, f32>
+fn sqrt_aa0d7a() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_aa0d7a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_aa0d7a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_aa0d7a();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl
new file mode 100644
index 0000000..52c73ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sqrt_aa0d7a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ sqrt_aa0d7a();
+ 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;
+
+void sqrt_aa0d7a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sqrt(arg_0);
+}
+
+void fragment_main() {
+ sqrt_aa0d7a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sqrt_aa0d7a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = sqrt(arg_0);
+}
+
+void compute_main() {
+ sqrt_aa0d7a();
+}
+
+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/sqrt/aa0d7a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.hlsl
new file mode 100644
index 0000000..5534c3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sqrt_aa0d7a() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sqrt_aa0d7a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sqrt_aa0d7a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sqrt_aa0d7a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl
new file mode 100644
index 0000000..25da1a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sqrt_aa0d7a() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sqrt_aa0d7a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sqrt_aa0d7a();
+ return;
+}
+
+kernel void compute_main() {
+ sqrt_aa0d7a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm
new file mode 100644
index 0000000..62b5d48
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %sqrt_aa0d7a "sqrt_aa0d7a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sqrt_aa0d7a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Sqrt %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %sqrt_aa0d7a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %sqrt_aa0d7a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %sqrt_aa0d7a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl
new file mode 100644
index 0000000..7d32a51
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/aa0d7a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sqrt_aa0d7a() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_aa0d7a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_aa0d7a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_aa0d7a();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl
new file mode 100644
index 0000000..16827fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn sqrt(vec<3, f32>) -> vec<3, f32>
+fn sqrt_f8c59a() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_f8c59a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_f8c59a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_f8c59a();
+}
diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl
new file mode 100644
index 0000000..d62a3b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void sqrt_f8c59a() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sqrt(arg_0);
+}
+
+vec4 vertex_main() {
+ sqrt_f8c59a();
+ 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;
+
+void sqrt_f8c59a() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sqrt(arg_0);
+}
+
+void fragment_main() {
+ sqrt_f8c59a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void sqrt_f8c59a() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = sqrt(arg_0);
+}
+
+void compute_main() {
+ sqrt_f8c59a();
+}
+
+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/sqrt/f8c59a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.hlsl
new file mode 100644
index 0000000..d57de15
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void sqrt_f8c59a() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ sqrt_f8c59a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ sqrt_f8c59a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ sqrt_f8c59a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl
new file mode 100644
index 0000000..4f3289a
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void sqrt_f8c59a() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = sqrt(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ sqrt_f8c59a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ sqrt_f8c59a();
+ return;
+}
+
+kernel void compute_main() {
+ sqrt_f8c59a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm
new file mode 100644
index 0000000..ac3f688
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %sqrt_f8c59a "sqrt_f8c59a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%sqrt_f8c59a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Sqrt %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %sqrt_f8c59a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %sqrt_f8c59a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %sqrt_f8c59a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl
new file mode 100644
index 0000000..ff31cee
--- /dev/null
+++ b/test/tint/builtins/gen/var/sqrt/f8c59a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn sqrt_f8c59a() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = sqrt(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ sqrt_f8c59a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ sqrt_f8c59a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ sqrt_f8c59a();
+}
diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl b/test/tint/builtins/gen/var/step/0b073b.wgsl
new file mode 100644
index 0000000..815380d
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/0b073b.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn step(f32, f32) -> f32
+fn step_0b073b() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res: f32 = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_0b073b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_0b073b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_0b073b();
+}
diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl
new file mode 100644
index 0000000..3708760
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void step_0b073b() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = step(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ step_0b073b();
+ 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;
+
+void step_0b073b() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = step(arg_0, arg_1);
+}
+
+void fragment_main() {
+ step_0b073b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void step_0b073b() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = step(arg_0, arg_1);
+}
+
+void compute_main() {
+ step_0b073b();
+}
+
+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/step/0b073b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.hlsl
new file mode 100644
index 0000000..19c85c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void step_0b073b() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ step_0b073b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ step_0b073b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ step_0b073b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl
new file mode 100644
index 0000000..275ddb6
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void step_0b073b() {
+ float arg_0 = 1.0f;
+ float arg_1 = 1.0f;
+ float res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ step_0b073b();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ step_0b073b();
+ return;
+}
+
+kernel void compute_main() {
+ step_0b073b();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm
new file mode 100644
index 0000000..a9e8e76
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %step_0b073b "step_0b073b"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %22 = OpTypeFunction %v4float
+%step_0b073b = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %arg_1 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ OpStore %arg_1 %float_1
+ %19 = OpLoad %float %arg_0
+ %20 = OpLoad %float %arg_1
+ %17 = OpExtInst %float %18 Step %19 %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %step_0b073b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %step_0b073b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %step_0b073b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl
new file mode 100644
index 0000000..1c7f7e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/0b073b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn step_0b073b() {
+ var arg_0 = 1.0;
+ var arg_1 = 1.0;
+ var res : f32 = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_0b073b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_0b073b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_0b073b();
+}
diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl b/test/tint/builtins/gen/var/step/19accd.wgsl
new file mode 100644
index 0000000..57a56e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/19accd.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn step(vec<2, f32>, vec<2, f32>) -> vec<2, f32>
+fn step_19accd() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res: vec2<f32> = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_19accd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_19accd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_19accd();
+}
diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl
new file mode 100644
index 0000000..5d65aab
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void step_19accd() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = step(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ step_19accd();
+ 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;
+
+void step_19accd() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = step(arg_0, arg_1);
+}
+
+void fragment_main() {
+ step_19accd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void step_19accd() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 arg_1 = vec2(0.0f);
+ vec2 res = step(arg_0, arg_1);
+}
+
+void compute_main() {
+ step_19accd();
+}
+
+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/step/19accd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.hlsl
new file mode 100644
index 0000000..f94d6d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void step_19accd() {
+ float2 arg_0 = (0.0f).xx;
+ float2 arg_1 = (0.0f).xx;
+ float2 res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ step_19accd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ step_19accd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ step_19accd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl
new file mode 100644
index 0000000..e1fbd2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void step_19accd() {
+ float2 arg_0 = float2(0.0f);
+ float2 arg_1 = float2(0.0f);
+ float2 res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ step_19accd();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ step_19accd();
+ return;
+}
+
+kernel void compute_main() {
+ step_19accd();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm
new file mode 100644
index 0000000..fd5d449
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %step_19accd "step_19accd"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%step_19accd = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v2float %arg_0
+ %21 = OpLoad %v2float %arg_1
+ %18 = OpExtInst %v2float %19 Step %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %step_19accd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %step_19accd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %step_19accd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd11983
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/19accd.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn step_19accd() {
+ var arg_0 = vec2<f32>();
+ var arg_1 = vec2<f32>();
+ var res : vec2<f32> = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_19accd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_19accd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_19accd();
+}
diff --git a/test/tint/builtins/gen/var/step/334303.wgsl b/test/tint/builtins/gen/var/step/334303.wgsl
new file mode 100644
index 0000000..5bddc72
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/334303.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn step(vec<3, f32>, vec<3, f32>) -> vec<3, f32>
+fn step_334303() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res: vec3<f32> = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_334303();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_334303();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_334303();
+}
diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl
new file mode 100644
index 0000000..46aa17e
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void step_334303() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = step(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ step_334303();
+ 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;
+
+void step_334303() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = step(arg_0, arg_1);
+}
+
+void fragment_main() {
+ step_334303();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void step_334303() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 arg_1 = vec3(0.0f);
+ vec3 res = step(arg_0, arg_1);
+}
+
+void compute_main() {
+ step_334303();
+}
+
+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/step/334303.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.hlsl
new file mode 100644
index 0000000..df6ff2a
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void step_334303() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 arg_1 = (0.0f).xxx;
+ float3 res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ step_334303();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ step_334303();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ step_334303();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl
new file mode 100644
index 0000000..8deefd8
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void step_334303() {
+ float3 arg_0 = float3(0.0f);
+ float3 arg_1 = float3(0.0f);
+ float3 res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ step_334303();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ step_334303();
+ return;
+}
+
+kernel void compute_main() {
+ step_334303();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm
new file mode 100644
index 0000000..37a7b9d
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %step_334303 "step_334303"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%step_334303 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %arg_1 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ OpStore %arg_1 %14
+ %20 = OpLoad %v3float %arg_0
+ %21 = OpLoad %v3float %arg_1
+ %18 = OpExtInst %v3float %19 Step %20 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %step_334303
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %step_334303
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %step_334303
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl
new file mode 100644
index 0000000..71667c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/334303.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn step_334303() {
+ var arg_0 = vec3<f32>();
+ var arg_1 = vec3<f32>();
+ var res : vec3<f32> = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_334303();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_334303();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_334303();
+}
diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl b/test/tint/builtins/gen/var/step/e2b337.wgsl
new file mode 100644
index 0000000..1aa6b52
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/e2b337.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn step(vec<4, f32>, vec<4, f32>) -> vec<4, f32>
+fn step_e2b337() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res: vec4<f32> = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_e2b337();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_e2b337();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_e2b337();
+}
diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl
new file mode 100644
index 0000000..ac7f19f
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+void step_e2b337() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = step(arg_0, arg_1);
+}
+
+vec4 vertex_main() {
+ step_e2b337();
+ 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;
+
+void step_e2b337() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = step(arg_0, arg_1);
+}
+
+void fragment_main() {
+ step_e2b337();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void step_e2b337() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 arg_1 = vec4(0.0f);
+ vec4 res = step(arg_0, arg_1);
+}
+
+void compute_main() {
+ step_e2b337();
+}
+
+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/step/e2b337.wgsl.expected.hlsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.hlsl
new file mode 100644
index 0000000..94366a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.hlsl
@@ -0,0 +1,32 @@
+void step_e2b337() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 arg_1 = (0.0f).xxxx;
+ float4 res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ step_e2b337();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ step_e2b337();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ step_e2b337();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl
new file mode 100644
index 0000000..8ec4bc3
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void step_e2b337() {
+ float4 arg_0 = float4(0.0f);
+ float4 arg_1 = float4(0.0f);
+ float4 res = step(arg_0, arg_1);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ step_e2b337();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ step_e2b337();
+ return;
+}
+
+kernel void compute_main() {
+ step_e2b337();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm
new file mode 100644
index 0000000..c97dcc7
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %step_e2b337 "step_e2b337"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%step_e2b337 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %arg_1 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ OpStore %arg_1 %5
+ %18 = OpLoad %v4float %arg_0
+ %19 = OpLoad %v4float %arg_1
+ %16 = OpExtInst %v4float %17 Step %18 %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %step_e2b337
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %step_e2b337
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %step_e2b337
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl
new file mode 100644
index 0000000..370bb45
--- /dev/null
+++ b/test/tint/builtins/gen/var/step/e2b337.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn step_e2b337() {
+ var arg_0 = vec4<f32>();
+ var arg_1 = vec4<f32>();
+ var res : vec4<f32> = step(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ step_e2b337();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ step_e2b337();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ step_e2b337();
+}
diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl
new file mode 100644
index 0000000..5306f6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl
@@ -0,0 +1,34 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn storageBarrier()
+fn storageBarrier_d87211() {
+ storageBarrier();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ storageBarrier_d87211();
+}
diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl
new file mode 100644
index 0000000..025e85c
--- /dev/null
+++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.glsl
@@ -0,0 +1,15 @@
+#version 310 es
+
+void storageBarrier_d87211() {
+ { barrier(); memoryBarrierBuffer(); };
+}
+
+void compute_main() {
+ storageBarrier_d87211();
+}
+
+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/storageBarrier/d87211.wgsl.expected.hlsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.hlsl
new file mode 100644
index 0000000..8fb7cf9
--- /dev/null
+++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void storageBarrier_d87211() {
+ DeviceMemoryBarrierWithGroupSync();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ storageBarrier_d87211();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl
new file mode 100644
index 0000000..53da747
--- /dev/null
+++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void storageBarrier_d87211() {
+ threadgroup_barrier(mem_flags::mem_device);
+}
+
+kernel void compute_main() {
+ storageBarrier_d87211();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm
new file mode 100644
index 0000000..79f2372
--- /dev/null
+++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %storageBarrier_d87211 "storageBarrier_d87211"
+ OpName %compute_main "compute_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+ %uint_72 = OpConstant %uint 72
+%storageBarrier_d87211 = OpFunction %void None %1
+ %4 = OpLabel
+ OpControlBarrier %uint_2 %uint_2 %uint_72
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %storageBarrier_d87211
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl
new file mode 100644
index 0000000..4c87708
--- /dev/null
+++ b/test/tint/builtins/gen/var/storageBarrier/d87211.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+fn storageBarrier_d87211() {
+ storageBarrier();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ storageBarrier_d87211();
+}
diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl
new file mode 100644
index 0000000..a124869
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tan(vec<4, f32>) -> vec<4, f32>
+fn tan_244e2a() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_244e2a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_244e2a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_244e2a();
+}
diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl
new file mode 100644
index 0000000..69b8156
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tan_244e2a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tan(arg_0);
+}
+
+vec4 vertex_main() {
+ tan_244e2a();
+ 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;
+
+void tan_244e2a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tan(arg_0);
+}
+
+void fragment_main() {
+ tan_244e2a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tan_244e2a() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tan(arg_0);
+}
+
+void compute_main() {
+ tan_244e2a();
+}
+
+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/tan/244e2a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.hlsl
new file mode 100644
index 0000000..bec2384
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tan_244e2a() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tan_244e2a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tan_244e2a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tan_244e2a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl
new file mode 100644
index 0000000..8d4d8a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tan_244e2a() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tan_244e2a();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tan_244e2a();
+ return;
+}
+
+kernel void compute_main() {
+ tan_244e2a();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm
new file mode 100644
index 0000000..c36cf98
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %tan_244e2a "tan_244e2a"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %tan_244e2a = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Tan %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %tan_244e2a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %tan_244e2a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %tan_244e2a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl
new file mode 100644
index 0000000..35bfc66
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/244e2a.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tan_244e2a() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_244e2a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_244e2a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_244e2a();
+}
diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl
new file mode 100644
index 0000000..2cdb41f
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tan(f32) -> f32
+fn tan_2f030e() {
+ var arg_0 = 1.0;
+ var res: f32 = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_2f030e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_2f030e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_2f030e();
+}
diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl
new file mode 100644
index 0000000..5075b83
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tan_2f030e() {
+ float arg_0 = 1.0f;
+ float res = tan(arg_0);
+}
+
+vec4 vertex_main() {
+ tan_2f030e();
+ 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;
+
+void tan_2f030e() {
+ float arg_0 = 1.0f;
+ float res = tan(arg_0);
+}
+
+void fragment_main() {
+ tan_2f030e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tan_2f030e() {
+ float arg_0 = 1.0f;
+ float res = tan(arg_0);
+}
+
+void compute_main() {
+ tan_2f030e();
+}
+
+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/tan/2f030e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.hlsl
new file mode 100644
index 0000000..b3863b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tan_2f030e() {
+ float arg_0 = 1.0f;
+ float res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tan_2f030e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tan_2f030e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tan_2f030e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl
new file mode 100644
index 0000000..ca719b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tan_2f030e() {
+ float arg_0 = 1.0f;
+ float res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tan_2f030e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tan_2f030e();
+ return;
+}
+
+kernel void compute_main() {
+ tan_2f030e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm
new file mode 100644
index 0000000..57d1c9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %tan_2f030e "tan_2f030e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+ %tan_2f030e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Tan %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %tan_2f030e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %tan_2f030e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %tan_2f030e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl
new file mode 100644
index 0000000..fac4849
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/2f030e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tan_2f030e() {
+ var arg_0 = 1.0;
+ var res : f32 = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_2f030e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_2f030e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_2f030e();
+}
diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl
new file mode 100644
index 0000000..220629c
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tan(vec<3, f32>) -> vec<3, f32>
+fn tan_7ea104() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_7ea104();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_7ea104();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_7ea104();
+}
diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl
new file mode 100644
index 0000000..61146c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tan_7ea104() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tan(arg_0);
+}
+
+vec4 vertex_main() {
+ tan_7ea104();
+ 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;
+
+void tan_7ea104() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tan(arg_0);
+}
+
+void fragment_main() {
+ tan_7ea104();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tan_7ea104() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tan(arg_0);
+}
+
+void compute_main() {
+ tan_7ea104();
+}
+
+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/tan/7ea104.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.hlsl
new file mode 100644
index 0000000..1dec135
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tan_7ea104() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tan_7ea104();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tan_7ea104();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tan_7ea104();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl
new file mode 100644
index 0000000..8edef08
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tan_7ea104() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tan_7ea104();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tan_7ea104();
+ return;
+}
+
+kernel void compute_main() {
+ tan_7ea104();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm
new file mode 100644
index 0000000..da69cee
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tan_7ea104 "tan_7ea104"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %tan_7ea104 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Tan %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %tan_7ea104
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %tan_7ea104
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %tan_7ea104
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc85409
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/7ea104.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tan_7ea104() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_7ea104();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_7ea104();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_7ea104();
+}
diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl
new file mode 100644
index 0000000..8a415d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tan(vec<2, f32>) -> vec<2, f32>
+fn tan_8ce3e9() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_8ce3e9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_8ce3e9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_8ce3e9();
+}
diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl
new file mode 100644
index 0000000..211831f
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tan_8ce3e9() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tan(arg_0);
+}
+
+vec4 vertex_main() {
+ tan_8ce3e9();
+ 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;
+
+void tan_8ce3e9() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tan(arg_0);
+}
+
+void fragment_main() {
+ tan_8ce3e9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tan_8ce3e9() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tan(arg_0);
+}
+
+void compute_main() {
+ tan_8ce3e9();
+}
+
+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/tan/8ce3e9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.hlsl
new file mode 100644
index 0000000..935530e
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tan_8ce3e9() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tan_8ce3e9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tan_8ce3e9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tan_8ce3e9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl
new file mode 100644
index 0000000..4584e1a
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tan_8ce3e9() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = tan(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tan_8ce3e9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tan_8ce3e9();
+ return;
+}
+
+kernel void compute_main() {
+ tan_8ce3e9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm
new file mode 100644
index 0000000..20a817e
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tan_8ce3e9 "tan_8ce3e9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+ %tan_8ce3e9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Tan %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %tan_8ce3e9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %tan_8ce3e9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %tan_8ce3e9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl
new file mode 100644
index 0000000..4fef31c
--- /dev/null
+++ b/test/tint/builtins/gen/var/tan/8ce3e9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tan_8ce3e9() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = tan(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tan_8ce3e9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tan_8ce3e9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tan_8ce3e9();
+}
diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl
new file mode 100644
index 0000000..f136742
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tanh(vec<4, f32>) -> vec<4, f32>
+fn tanh_5663c5() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_5663c5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_5663c5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_5663c5();
+}
diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl
new file mode 100644
index 0000000..cfa0783
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tanh_5663c5() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tanh(arg_0);
+}
+
+vec4 vertex_main() {
+ tanh_5663c5();
+ 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;
+
+void tanh_5663c5() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tanh(arg_0);
+}
+
+void fragment_main() {
+ tanh_5663c5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tanh_5663c5() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = tanh(arg_0);
+}
+
+void compute_main() {
+ tanh_5663c5();
+}
+
+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/tanh/5663c5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.hlsl
new file mode 100644
index 0000000..3860bf4
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tanh_5663c5() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tanh_5663c5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tanh_5663c5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tanh_5663c5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl
new file mode 100644
index 0000000..7e0c6cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tanh_5663c5() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tanh_5663c5();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tanh_5663c5();
+ return;
+}
+
+kernel void compute_main() {
+ tanh_5663c5();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm
new file mode 100644
index 0000000..8cad240
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %tanh_5663c5 "tanh_5663c5"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tanh_5663c5 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Tanh %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %tanh_5663c5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %tanh_5663c5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %tanh_5663c5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl
new file mode 100644
index 0000000..68b3e22
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5663c5.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tanh_5663c5() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_5663c5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_5663c5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_5663c5();
+}
diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl
new file mode 100644
index 0000000..a09c5dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tanh(vec<2, f32>) -> vec<2, f32>
+fn tanh_5724b3() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_5724b3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_5724b3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_5724b3();
+}
diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl
new file mode 100644
index 0000000..febcb14
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tanh_5724b3() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tanh(arg_0);
+}
+
+vec4 vertex_main() {
+ tanh_5724b3();
+ 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;
+
+void tanh_5724b3() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tanh(arg_0);
+}
+
+void fragment_main() {
+ tanh_5724b3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tanh_5724b3() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = tanh(arg_0);
+}
+
+void compute_main() {
+ tanh_5724b3();
+}
+
+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/tanh/5724b3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.hlsl
new file mode 100644
index 0000000..be9254c
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tanh_5724b3() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tanh_5724b3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tanh_5724b3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tanh_5724b3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl
new file mode 100644
index 0000000..d384399
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tanh_5724b3() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tanh_5724b3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tanh_5724b3();
+ return;
+}
+
+kernel void compute_main() {
+ tanh_5724b3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm
new file mode 100644
index 0000000..a30467b
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tanh_5724b3 "tanh_5724b3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tanh_5724b3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Tanh %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %tanh_5724b3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %tanh_5724b3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %tanh_5724b3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl
new file mode 100644
index 0000000..4ba6039
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/5724b3.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tanh_5724b3() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_5724b3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_5724b3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_5724b3();
+}
diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl
new file mode 100644
index 0000000..3ef2e2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tanh(vec<3, f32>) -> vec<3, f32>
+fn tanh_9f9fb9() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_9f9fb9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_9f9fb9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_9f9fb9();
+}
diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl
new file mode 100644
index 0000000..15f66f7
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tanh_9f9fb9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tanh(arg_0);
+}
+
+vec4 vertex_main() {
+ tanh_9f9fb9();
+ 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;
+
+void tanh_9f9fb9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tanh(arg_0);
+}
+
+void fragment_main() {
+ tanh_9f9fb9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tanh_9f9fb9() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = tanh(arg_0);
+}
+
+void compute_main() {
+ tanh_9f9fb9();
+}
+
+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/tanh/9f9fb9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.hlsl
new file mode 100644
index 0000000..2687494
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tanh_9f9fb9() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tanh_9f9fb9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tanh_9f9fb9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tanh_9f9fb9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl
new file mode 100644
index 0000000..4e5e4a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tanh_9f9fb9() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tanh_9f9fb9();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tanh_9f9fb9();
+ return;
+}
+
+kernel void compute_main() {
+ tanh_9f9fb9();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm
new file mode 100644
index 0000000..2e2d6bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %tanh_9f9fb9 "tanh_9f9fb9"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%tanh_9f9fb9 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Tanh %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %tanh_9f9fb9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %tanh_9f9fb9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %tanh_9f9fb9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl
new file mode 100644
index 0000000..2cf169f
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/9f9fb9.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tanh_9f9fb9() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_9f9fb9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_9f9fb9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_9f9fb9();
+}
diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl
new file mode 100644
index 0000000..a0e4a5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn tanh(f32) -> f32
+fn tanh_c15fdb() {
+ var arg_0 = 1.0;
+ var res: f32 = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_c15fdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_c15fdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_c15fdb();
+}
diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl
new file mode 100644
index 0000000..5682daf
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void tanh_c15fdb() {
+ float arg_0 = 1.0f;
+ float res = tanh(arg_0);
+}
+
+vec4 vertex_main() {
+ tanh_c15fdb();
+ 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;
+
+void tanh_c15fdb() {
+ float arg_0 = 1.0f;
+ float res = tanh(arg_0);
+}
+
+void fragment_main() {
+ tanh_c15fdb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void tanh_c15fdb() {
+ float arg_0 = 1.0f;
+ float res = tanh(arg_0);
+}
+
+void compute_main() {
+ tanh_c15fdb();
+}
+
+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/tanh/c15fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.hlsl
new file mode 100644
index 0000000..38d4981
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void tanh_c15fdb() {
+ float arg_0 = 1.0f;
+ float res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ tanh_c15fdb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ tanh_c15fdb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ tanh_c15fdb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl
new file mode 100644
index 0000000..81b4924
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void tanh_c15fdb() {
+ float arg_0 = 1.0f;
+ float res = tanh(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ tanh_c15fdb();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ tanh_c15fdb();
+ return;
+}
+
+kernel void compute_main() {
+ tanh_c15fdb();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm
new file mode 100644
index 0000000..8722def
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %tanh_c15fdb "tanh_c15fdb"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%tanh_c15fdb = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Tanh %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %tanh_c15fdb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %tanh_c15fdb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %tanh_c15fdb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl
new file mode 100644
index 0000000..0831fee
--- /dev/null
+++ b/test/tint/builtins/gen/var/tanh/c15fdb.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn tanh_c15fdb() {
+ var arg_0 = 1.0;
+ var res : f32 = tanh(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ tanh_c15fdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ tanh_c15fdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ tanh_c15fdb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl
new file mode 100644
index 0000000..b93721f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureDimensions(texture: texture_1d<f32>) -> i32
+fn textureDimensions_002b2a() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_002b2a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_002b2a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_002b2a();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl
new file mode 100644
index 0000000..9ee3490
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureDimensions_002b2a() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_002b2a();
+ 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 textureDimensions_002b2a() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_002b2a();
+}
+
+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 textureDimensions_002b2a() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_002b2a();
+}
+
+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/textureDimensions/002b2a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.hlsl
new file mode 100644
index 0000000..29d0c12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_002b2a() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_002b2a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_002b2a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_002b2a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl
new file mode 100644
index 0000000..b5b2121
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_002b2a(texture1d<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureDimensions_002b2a(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)]]) {
+ textureDimensions_002b2a(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_002b2a(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm
new file mode 100644
index 0000000..178d73b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_002b2a "textureDimensions_002b2a"
+ 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_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_002b2a = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySizeLod %int %18 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_002b2a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_002b2a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_002b2a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl
new file mode 100644
index 0000000..a21a8c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/002b2a.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureDimensions_002b2a() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_002b2a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_002b2a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_002b2a();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl
new file mode 100644
index 0000000..d011596
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<r32sint, write>) -> vec2<i32>
+fn textureDimensions_012b82() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_012b82();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_012b82();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_012b82();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl
new file mode 100644
index 0000000..9ae3c1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_012b82() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_012b82();
+ 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 textureDimensions_012b82() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_012b82();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_012b82() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_012b82();
+}
+
+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/textureDimensions/012b82.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.hlsl
new file mode 100644
index 0000000..56fb818
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_012b82() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_012b82();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_012b82();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_012b82();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl
new file mode 100644
index 0000000..f53807b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_012b82(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureDimensions_012b82(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)]]) {
+ textureDimensions_012b82(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_012b82(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm
new file mode 100644
index 0000000..4e8d502
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_012b82 "textureDimensions_012b82"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_012b82 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_012b82
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_012b82
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_012b82
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl
new file mode 100644
index 0000000..7ebcab6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/012b82.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureDimensions_012b82() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_012b82();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_012b82();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_012b82();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl
new file mode 100644
index 0000000..4e071a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba16sint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba16sint, write>) -> i32
+fn textureDimensions_08753d() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_08753d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_08753d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_08753d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl
new file mode 100644
index 0000000..0b0f9e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_08753d() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_08753d();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba16i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_08753d() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_08753d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_08753d() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_08753d();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl
new file mode 100644
index 0000000..83011ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_08753d() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_08753d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_08753d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_08753d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl
new file mode 100644
index 0000000..a1fa2f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_08753d(texture1d<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureDimensions_08753d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_08753d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_08753d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm
new file mode 100644
index 0000000..8854f38
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_08753d "textureDimensions_08753d"
+ 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 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 1D 0 0 0 2 Rgba16i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_08753d = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_08753d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_08753d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_08753d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl
new file mode 100644
index 0000000..45dce4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/08753d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba16sint, write>;
+
+fn textureDimensions_08753d() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_08753d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_08753d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_08753d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl
new file mode 100644
index 0000000..3acce51
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba16float, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba16float, write>) -> vec3<i32>
+fn textureDimensions_0c4772() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0c4772();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0c4772();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0c4772();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl
new file mode 100644
index 0000000..f58182c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image3D arg_0;
+void textureDimensions_0c4772() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_0c4772();
+ 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 image3D arg_0;
+void textureDimensions_0c4772() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_0c4772();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image3D arg_0;
+void textureDimensions_0c4772() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_0c4772();
+}
+
+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/textureDimensions/0c4772.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.hlsl
new file mode 100644
index 0000000..3de620c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_0c4772() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_0c4772();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_0c4772();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_0c4772();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl
new file mode 100644
index 0000000..cc675e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_0c4772(texture3d<float, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureDimensions_0c4772(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_0c4772(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_0c4772(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm
new file mode 100644
index 0000000..77d91d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_0c4772 "textureDimensions_0c4772"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_0c4772 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v3int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_0c4772
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_0c4772
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_0c4772
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc5fc35
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0c4772.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba16float, write>;
+
+fn textureDimensions_0c4772() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0c4772();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0c4772();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0c4772();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl
new file mode 100644
index 0000000..410f924
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<r32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<r32sint, write>) -> i32
+fn textureDimensions_0cce40() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0cce40();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0cce40();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0cce40();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl
new file mode 100644
index 0000000..a0df901
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_0cce40() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_0cce40();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(r32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_0cce40() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_0cce40();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_0cce40() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_0cce40();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl
new file mode 100644
index 0000000..e10fdf6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_0cce40() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_0cce40();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_0cce40();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_0cce40();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl
new file mode 100644
index 0000000..e955048
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_0cce40(texture1d<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureDimensions_0cce40(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_0cce40(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_0cce40(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm
new file mode 100644
index 0000000..51c3c14
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_0cce40 "textureDimensions_0cce40"
+ 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 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 1D 0 0 0 2 R32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_0cce40 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_0cce40
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_0cce40
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_0cce40
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl
new file mode 100644
index 0000000..04b0e24
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cce40.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<r32sint, write>;
+
+fn textureDimensions_0cce40() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0cce40();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0cce40();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0cce40();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl
new file mode 100644
index 0000000..4ca0928
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba16uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba16uint, write>) -> vec2<i32>
+fn textureDimensions_0cf2ff() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0cf2ff();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0cf2ff();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0cf2ff();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl
new file mode 100644
index 0000000..d91c9db
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_0cf2ff() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_0cf2ff();
+ 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 uimage2D arg_0;
+void textureDimensions_0cf2ff() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_0cf2ff();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_0cf2ff() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_0cf2ff();
+}
+
+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/textureDimensions/0cf2ff.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.hlsl
new file mode 100644
index 0000000..3b9fd52
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_0cf2ff() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_0cf2ff();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_0cf2ff();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_0cf2ff();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl
new file mode 100644
index 0000000..875a388
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_0cf2ff(texture2d<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureDimensions_0cf2ff(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_0cf2ff(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_0cf2ff(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm
new file mode 100644
index 0000000..aece9956
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_0cf2ff "textureDimensions_0cf2ff"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_0cf2ff = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_0cf2ff
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_0cf2ff
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_0cf2ff
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl
new file mode 100644
index 0000000..36e3e61
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0cf2ff.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba16uint, write>;
+
+fn textureDimensions_0cf2ff() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0cf2ff();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0cf2ff();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0cf2ff();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl
new file mode 100644
index 0000000..6927776
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<r32uint, write>) -> vec2<i32>
+fn textureDimensions_0d8b7e() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0d8b7e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0d8b7e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0d8b7e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl
new file mode 100644
index 0000000..19bb91a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_0d8b7e() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_0d8b7e();
+ 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 textureDimensions_0d8b7e() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_0d8b7e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_0d8b7e() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_0d8b7e();
+}
+
+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/textureDimensions/0d8b7e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.hlsl
new file mode 100644
index 0000000..848d8b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_0d8b7e() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_0d8b7e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_0d8b7e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_0d8b7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl
new file mode 100644
index 0000000..d07d72a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_0d8b7e(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureDimensions_0d8b7e(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)]]) {
+ textureDimensions_0d8b7e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_0d8b7e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm
new file mode 100644
index 0000000..c5406d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_0d8b7e "textureDimensions_0d8b7e"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_0d8b7e = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySize %v3int %22
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_0d8b7e
+ 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 %textureDimensions_0d8b7e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_0d8b7e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl
new file mode 100644
index 0000000..b4a1350
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0d8b7e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureDimensions_0d8b7e() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0d8b7e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0d8b7e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0d8b7e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl
new file mode 100644
index 0000000..60d2aa3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba16uint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba16uint, write>) -> vec3<i32>
+fn textureDimensions_0e32ee() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0e32ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0e32ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0e32ee();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl
new file mode 100644
index 0000000..3b00486
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_0e32ee() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_0e32ee();
+ 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 uimage3D arg_0;
+void textureDimensions_0e32ee() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_0e32ee();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_0e32ee() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_0e32ee();
+}
+
+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/textureDimensions/0e32ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.hlsl
new file mode 100644
index 0000000..0f338cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_0e32ee() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_0e32ee();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_0e32ee();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_0e32ee();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl
new file mode 100644
index 0000000..376e7b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_0e32ee(texture3d<uint, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureDimensions_0e32ee(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_0e32ee(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_0e32ee(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm
new file mode 100644
index 0000000..c045a1a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_0e32ee "textureDimensions_0e32ee"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_0e32ee = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_0e32ee
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_0e32ee
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_0e32ee
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl
new file mode 100644
index 0000000..9f0e1d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0e32ee.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba16uint, write>;
+
+fn textureDimensions_0e32ee() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0e32ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0e32ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0e32ee();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl
new file mode 100644
index 0000000..c8010cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureDimensions(texture: texture_2d_array<i32>) -> vec2<i32>
+fn textureDimensions_0f3c50() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0f3c50();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0f3c50();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0f3c50();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl
new file mode 100644
index 0000000..da53ee8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureDimensions_0f3c50() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_0f3c50();
+ 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 textureDimensions_0f3c50() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_0f3c50();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureDimensions_0f3c50() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_0f3c50();
+}
+
+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/textureDimensions/0f3c50.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.hlsl
new file mode 100644
index 0000000..5bef298
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_0f3c50() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_0f3c50();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_0f3c50();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_0f3c50();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl
new file mode 100644
index 0000000..9e6f6ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_0f3c50(texture2d_array<int, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureDimensions_0f3c50(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)]]) {
+ textureDimensions_0f3c50(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_0f3c50(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm
new file mode 100644
index 0000000..53a9a61
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_0f3c50 "textureDimensions_0f3c50"
+ 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_0f3c50 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_0f3c50
+ 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 %textureDimensions_0f3c50
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_0f3c50
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl
new file mode 100644
index 0000000..553f57e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/0f3c50.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureDimensions_0f3c50() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_0f3c50();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_0f3c50();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_0f3c50();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl
new file mode 100644
index 0000000..172d049
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureDimensions(texture: texture_2d<u32>) -> vec2<i32>
+fn textureDimensions_1191a5() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1191a5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1191a5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1191a5();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl
new file mode 100644
index 0000000..0514b2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureDimensions_1191a5() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_1191a5();
+ 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 textureDimensions_1191a5() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_1191a5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureDimensions_1191a5() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_1191a5();
+}
+
+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/textureDimensions/1191a5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.hlsl
new file mode 100644
index 0000000..cedbfad
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_1191a5() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_1191a5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_1191a5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_1191a5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl
new file mode 100644
index 0000000..c08c723d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_1191a5(texture2d<uint, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureDimensions_1191a5(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)]]) {
+ textureDimensions_1191a5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_1191a5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm
new file mode 100644
index 0000000..1cc88e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_1191a5 "textureDimensions_1191a5"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_1191a5 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %v2int %20 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_1191a5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_1191a5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_1191a5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl
new file mode 100644
index 0000000..2131304
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1191a5.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureDimensions_1191a5() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1191a5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1191a5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1191a5();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl
new file mode 100644
index 0000000..f235441
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureDimensions(texture: texture_depth_2d, level: i32) -> vec2<i32>
+fn textureDimensions_12c9bb() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_12c9bb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_12c9bb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_12c9bb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl
new file mode 100644
index 0000000..c64c5eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_12c9bb() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_12c9bb();
+ 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 textureDimensions_12c9bb() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_12c9bb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_12c9bb() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_12c9bb();
+}
+
+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/textureDimensions/12c9bb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.hlsl
new file mode 100644
index 0000000..6ae5d77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureDimensions_12c9bb() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_12c9bb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_12c9bb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_12c9bb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl
new file mode 100644
index 0000000..2fb2f57
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_12c9bb(depth2d<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureDimensions_12c9bb(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)]]) {
+ textureDimensions_12c9bb(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_12c9bb(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm
new file mode 100644
index 0000000..72881d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_12c9bb "textureDimensions_12c9bb"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_12c9bb = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v2int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_12c9bb
+ 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 %textureDimensions_12c9bb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_12c9bb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl
new file mode 100644
index 0000000..d61d602
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/12c9bb.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureDimensions_12c9bb() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_12c9bb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_12c9bb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_12c9bb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl
new file mode 100644
index 0000000..17e2e21
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rg32float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rg32float, write>) -> vec2<i32>
+fn textureDimensions_147998() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_147998();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_147998();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_147998();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl
new file mode 100644
index 0000000..90d19e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2D arg_0;
+void textureDimensions_147998() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_147998();
+ 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 image2D arg_0;
+void textureDimensions_147998() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_147998();
+}
+
+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 image2D arg_0;
+void textureDimensions_147998() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_147998();
+}
+
+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/textureDimensions/147998.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.hlsl
new file mode 100644
index 0000000..af1e9bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_147998() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_147998();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_147998();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_147998();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl
new file mode 100644
index 0000000..2543103
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_147998(texture2d<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureDimensions_147998(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_147998(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_147998(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm
new file mode 100644
index 0000000..9e80b7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_147998 "textureDimensions_147998"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_147998 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_147998
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_147998
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_147998
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl
new file mode 100644
index 0000000..3cd6855
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/147998.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rg32float, write>;
+
+fn textureDimensions_147998() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_147998();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_147998();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_147998();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl
new file mode 100644
index 0000000..84ce998
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba8sint, write>) -> vec2<i32>
+fn textureDimensions_16036c() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_16036c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_16036c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_16036c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl
new file mode 100644
index 0000000..5e4d692
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_16036c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_16036c();
+ 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 textureDimensions_16036c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_16036c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_16036c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_16036c();
+}
+
+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/textureDimensions/16036c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.hlsl
new file mode 100644
index 0000000..02565baa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_16036c() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_16036c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_16036c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_16036c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl
new file mode 100644
index 0000000..4872c89
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_16036c(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureDimensions_16036c(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)]]) {
+ textureDimensions_16036c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_16036c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm
new file mode 100644
index 0000000..af24793
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_16036c "textureDimensions_16036c"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_16036c = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_16036c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_16036c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_16036c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl
new file mode 100644
index 0000000..072b71e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/16036c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureDimensions_16036c() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_16036c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_16036c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_16036c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl
new file mode 100644
index 0000000..77f345d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba16sint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba16sint, write>) -> vec3<i32>
+fn textureDimensions_1b71f0() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1b71f0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1b71f0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1b71f0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl
new file mode 100644
index 0000000..16bd5b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_1b71f0() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_1b71f0();
+ 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 iimage3D arg_0;
+void textureDimensions_1b71f0() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_1b71f0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_1b71f0() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_1b71f0();
+}
+
+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/textureDimensions/1b71f0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.hlsl
new file mode 100644
index 0000000..1ffa3d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_1b71f0() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_1b71f0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_1b71f0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_1b71f0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl
new file mode 100644
index 0000000..9ef7f55
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_1b71f0(texture3d<int, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureDimensions_1b71f0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_1b71f0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_1b71f0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm
new file mode 100644
index 0000000..ba6dd6a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_1b71f0 "textureDimensions_1b71f0"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_1b71f0 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_1b71f0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_1b71f0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_1b71f0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl
new file mode 100644
index 0000000..8fedb78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1b71f0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba16sint, write>;
+
+fn textureDimensions_1b71f0() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1b71f0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1b71f0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1b71f0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl
new file mode 100644
index 0000000..0b5857d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8unorm, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba8unorm, write>) -> vec2<i32>
+fn textureDimensions_1d6c26() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1d6c26();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1d6c26();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1d6c26();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl
new file mode 100644
index 0000000..bea79ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_1d6c26() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_1d6c26();
+ 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 textureDimensions_1d6c26() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_1d6c26();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_1d6c26() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_1d6c26();
+}
+
+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/textureDimensions/1d6c26.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.hlsl
new file mode 100644
index 0000000..26140a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_1d6c26() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_1d6c26();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_1d6c26();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_1d6c26();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl
new file mode 100644
index 0000000..65d506d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_1d6c26(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureDimensions_1d6c26(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)]]) {
+ textureDimensions_1d6c26(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_1d6c26(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm
new file mode 100644
index 0000000..f0feca5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_1d6c26 "textureDimensions_1d6c26"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_1d6c26 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_1d6c26
+ 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 %textureDimensions_1d6c26
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_1d6c26
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl
new file mode 100644
index 0000000..1ca754c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1d6c26.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureDimensions_1d6c26() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1d6c26();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1d6c26();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1d6c26();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl
new file mode 100644
index 0000000..c40f9c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba16float, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba16float, write>) -> i32
+fn textureDimensions_1e9e39() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1e9e39();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1e9e39();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1e9e39();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl
new file mode 100644
index 0000000..067bc8b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image1D arg_0;
+void textureDimensions_1e9e39() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_1e9e39();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba16f) uniform highp writeonly image1D arg_0;
+void textureDimensions_1e9e39() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_1e9e39();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image1D arg_0;
+void textureDimensions_1e9e39() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_1e9e39();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl
new file mode 100644
index 0000000..16444c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_1e9e39() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_1e9e39();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_1e9e39();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_1e9e39();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl
new file mode 100644
index 0000000..352d58d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_1e9e39(texture1d<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureDimensions_1e9e39(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_1e9e39(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_1e9e39(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm
new file mode 100644
index 0000000..c83aa50
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_1e9e39 "textureDimensions_1e9e39"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_1e9e39 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_1e9e39
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_1e9e39
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_1e9e39
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl
new file mode 100644
index 0000000..938b104
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1e9e39.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba16float, write>;
+
+fn textureDimensions_1e9e39() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1e9e39();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1e9e39();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1e9e39();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl
new file mode 100644
index 0000000..8301b57
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureDimensions(texture: texture_2d_array<u32>) -> vec2<i32>
+fn textureDimensions_1f20c5() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1f20c5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1f20c5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1f20c5();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl
new file mode 100644
index 0000000..ac742c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureDimensions_1f20c5() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_1f20c5();
+ 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 textureDimensions_1f20c5() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_1f20c5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureDimensions_1f20c5() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_1f20c5();
+}
+
+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/textureDimensions/1f20c5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.hlsl
new file mode 100644
index 0000000..e453d42
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_1f20c5() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_1f20c5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_1f20c5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_1f20c5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl
new file mode 100644
index 0000000..d35a456
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_1f20c5(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureDimensions_1f20c5(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)]]) {
+ textureDimensions_1f20c5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_1f20c5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm
new file mode 100644
index 0000000..83e1fb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_1f20c5 "textureDimensions_1f20c5"
+ 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_1f20c5 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySizeLod %v3int %22 %int_0
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_1f20c5
+ 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 %textureDimensions_1f20c5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_1f20c5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl
new file mode 100644
index 0000000..2cbde3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/1f20c5.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureDimensions_1f20c5() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_1f20c5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_1f20c5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_1f20c5();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl
new file mode 100644
index 0000000..e3ac96c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8sint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba8sint, write>) -> vec3<i32>
+fn textureDimensions_214dd4() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_214dd4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_214dd4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_214dd4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl
new file mode 100644
index 0000000..d7f534f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_214dd4() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_214dd4();
+ 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 iimage3D arg_0;
+void textureDimensions_214dd4() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_214dd4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_214dd4() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_214dd4();
+}
+
+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/textureDimensions/214dd4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.hlsl
new file mode 100644
index 0000000..c91423e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_214dd4() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_214dd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_214dd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_214dd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl
new file mode 100644
index 0000000..169ee32
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_214dd4(texture3d<int, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureDimensions_214dd4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_214dd4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_214dd4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm
new file mode 100644
index 0000000..8210ce8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_214dd4 "textureDimensions_214dd4"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_214dd4 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_214dd4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_214dd4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_214dd4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl
new file mode 100644
index 0000000..a6e1919
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/214dd4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8sint, write>;
+
+fn textureDimensions_214dd4() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_214dd4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_214dd4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_214dd4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl
new file mode 100644
index 0000000..4af29a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<i32>;
+
+// fn textureDimensions(texture: texture_cube_array<i32>, level: i32) -> vec2<i32>
+fn textureDimensions_221f22() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_221f22();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_221f22();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_221f22();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl
new file mode 100644
index 0000000..ba1d23a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_0_1;
+void textureDimensions_221f22() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_221f22();
+ 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_0_1;
+void textureDimensions_221f22() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_221f22();
+}
+
+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_0_1;
+void textureDimensions_221f22() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_221f22();
+}
+
+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/textureDimensions/221f22.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.hlsl
new file mode 100644
index 0000000..6e40306
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_221f22() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_221f22();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_221f22();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_221f22();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl
new file mode 100644
index 0000000..0a75edb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_221f22(texturecube_array<int, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_2) {
+ textureDimensions_221f22(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_221f22(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_221f22(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm
new file mode 100644
index 0000000..d4ab8e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_221f22 "textureDimensions_221f22"
+ OpName %arg_1 "arg_1"
+ 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 Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %28 = OpConstantNull %v2int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_221f22 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %28
+ OpStore %arg_1 %17
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %22 = OpImageQuerySizeLod %v3int %24 %25
+ %20 = OpVectorShuffle %v2int %22 %22 0 1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_221f22
+ 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 %textureDimensions_221f22
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureDimensions_221f22
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl
new file mode 100644
index 0000000..b7afc40
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/221f22.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<i32>;
+
+fn textureDimensions_221f22() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_221f22();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_221f22();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_221f22();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl
new file mode 100644
index 0000000..1fca259
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureDimensions(texture: texture_2d_array<u32>, level: i32) -> vec2<i32>
+fn textureDimensions_267788() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_267788();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_267788();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_267788();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl
new file mode 100644
index 0000000..5ab45cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureDimensions_267788() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_267788();
+ 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 textureDimensions_267788() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_267788();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureDimensions_267788() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_267788();
+}
+
+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/textureDimensions/267788.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.hlsl
new file mode 100644
index 0000000..43ab14c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_267788() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_267788();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_267788();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_267788();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl
new file mode 100644
index 0000000..3f22f32
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_267788(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureDimensions_267788(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)]]) {
+ textureDimensions_267788(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_267788(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm
new file mode 100644
index 0000000..43de7d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_267788 "textureDimensions_267788"
+ OpName %arg_1 "arg_1"
+ 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
+ %18 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %29 = OpConstantNull %v2int
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_267788 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %18
+ %res = OpVariable %_ptr_Function_v2int Function %29
+ OpStore %arg_1 %18
+ %25 = OpLoad %11 %arg_0
+ %26 = OpLoad %int %arg_1
+ %23 = OpImageQuerySizeLod %v3int %25 %26
+ %21 = OpVectorShuffle %v2int %23 %23 0 1
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_267788
+ 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 %textureDimensions_267788
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureDimensions_267788
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl
new file mode 100644
index 0000000..b3c7d0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/267788.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureDimensions_267788() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_267788();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_267788();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_267788();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl
new file mode 100644
index 0000000..46faf75
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureDimensions(texture: texture_3d<f32>, level: i32) -> vec3<i32>
+fn textureDimensions_26bdfa() {
+ var arg_1 = 0;
+ var res: vec3<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_26bdfa();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_26bdfa();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_26bdfa();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl
new file mode 100644
index 0000000..cc8ce41
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureDimensions_26bdfa() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_26bdfa();
+ 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 textureDimensions_26bdfa() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_26bdfa();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureDimensions_26bdfa() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_26bdfa();
+}
+
+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/textureDimensions/26bdfa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.hlsl
new file mode 100644
index 0000000..4d66e90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_26bdfa() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 res = tint_tmp.xyz;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_26bdfa();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_26bdfa();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_26bdfa();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl
new file mode 100644
index 0000000..6786152
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_26bdfa(texture3d<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureDimensions_26bdfa(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)]]) {
+ textureDimensions_26bdfa(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_26bdfa(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm
new file mode 100644
index 0000000..99be954
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_26bdfa "textureDimensions_26bdfa"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %26 = OpConstantNull %v3int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_26bdfa = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v3int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v3int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_26bdfa
+ 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 %textureDimensions_26bdfa
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_26bdfa
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl
new file mode 100644
index 0000000..99aeee2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26bdfa.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureDimensions_26bdfa() {
+ var arg_1 = 0;
+ var res : vec3<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_26bdfa();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_26bdfa();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_26bdfa();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl
new file mode 100644
index 0000000..ccf3250
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba8uint, write>) -> vec2<i32>
+fn textureDimensions_26ef6c() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_26ef6c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_26ef6c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_26ef6c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl
new file mode 100644
index 0000000..dbdb178
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_26ef6c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_26ef6c();
+ 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 textureDimensions_26ef6c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_26ef6c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_26ef6c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_26ef6c();
+}
+
+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/textureDimensions/26ef6c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.hlsl
new file mode 100644
index 0000000..7ccf32f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_26ef6c() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_26ef6c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_26ef6c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_26ef6c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl
new file mode 100644
index 0000000..ba9013a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_26ef6c(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureDimensions_26ef6c(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)]]) {
+ textureDimensions_26ef6c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_26ef6c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm
new file mode 100644
index 0000000..bd40e12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_26ef6c "textureDimensions_26ef6c"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_26ef6c = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySize %v3int %22
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_26ef6c
+ 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 %textureDimensions_26ef6c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_26ef6c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl
new file mode 100644
index 0000000..960c66d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/26ef6c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureDimensions_26ef6c() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_26ef6c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_26ef6c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_26ef6c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl
new file mode 100644
index 0000000..25a8b28
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba16sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba16sint, write>) -> vec2<i32>
+fn textureDimensions_2ad087() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2ad087();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2ad087();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2ad087();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl
new file mode 100644
index 0000000..90289b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_2ad087() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_2ad087();
+ 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 iimage2D arg_0;
+void textureDimensions_2ad087() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_2ad087();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_2ad087() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_2ad087();
+}
+
+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/textureDimensions/2ad087.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.hlsl
new file mode 100644
index 0000000..33dee50
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_2ad087() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_2ad087();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_2ad087();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_2ad087();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl
new file mode 100644
index 0000000..011b3cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_2ad087(texture2d<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureDimensions_2ad087(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_2ad087(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_2ad087(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm
new file mode 100644
index 0000000..cb89db5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_2ad087 "textureDimensions_2ad087"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_2ad087 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_2ad087
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_2ad087
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_2ad087
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl
new file mode 100644
index 0000000..c2b8327
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2ad087.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba16sint, write>;
+
+fn textureDimensions_2ad087() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2ad087();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2ad087();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2ad087();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl
new file mode 100644
index 0000000..9d16f96
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureDimensions(texture: texture_3d<u32>, level: i32) -> vec3<i32>
+fn textureDimensions_2efa05() {
+ var arg_1 = 0;
+ var res: vec3<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2efa05();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2efa05();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2efa05();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl
new file mode 100644
index 0000000..8b23602
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureDimensions_2efa05() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_2efa05();
+ 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 textureDimensions_2efa05() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_2efa05();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureDimensions_2efa05() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_2efa05();
+}
+
+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/textureDimensions/2efa05.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.hlsl
new file mode 100644
index 0000000..fd507fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_2efa05() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 res = tint_tmp.xyz;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_2efa05();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_2efa05();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_2efa05();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl
new file mode 100644
index 0000000..3f1b9a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_2efa05(texture3d<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureDimensions_2efa05(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)]]) {
+ textureDimensions_2efa05(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_2efa05(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm
new file mode 100644
index 0000000..8d162f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_2efa05 "textureDimensions_2efa05"
+ OpName %arg_1 "arg_1"
+ 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
+ %18 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %27 = OpConstantNull %v3int
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_2efa05 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %18
+ %res = OpVariable %_ptr_Function_v3int Function %27
+ OpStore %arg_1 %18
+ %23 = OpLoad %11 %arg_0
+ %24 = OpLoad %int %arg_1
+ %21 = OpImageQuerySizeLod %v3int %23 %24
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureDimensions_2efa05
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_2efa05
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureDimensions_2efa05
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl
new file mode 100644
index 0000000..ac7a3e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2efa05.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureDimensions_2efa05() {
+ var arg_1 = 0;
+ var res : vec3<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2efa05();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2efa05();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2efa05();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl
new file mode 100644
index 0000000..63835a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<r32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<r32sint, write>) -> vec3<i32>
+fn textureDimensions_2f289f() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2f289f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2f289f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2f289f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl
new file mode 100644
index 0000000..ecf5ce0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_2f289f() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_2f289f();
+ 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 iimage3D arg_0;
+void textureDimensions_2f289f() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_2f289f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_2f289f() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_2f289f();
+}
+
+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/textureDimensions/2f289f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.hlsl
new file mode 100644
index 0000000..b84004a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_2f289f() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_2f289f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_2f289f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_2f289f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl
new file mode 100644
index 0000000..a61bafe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_2f289f(texture3d<int, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureDimensions_2f289f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_2f289f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_2f289f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm
new file mode 100644
index 0000000..ae04243
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_2f289f "textureDimensions_2f289f"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_2f289f = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_2f289f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_2f289f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_2f289f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl
new file mode 100644
index 0000000..7ffc030
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2f289f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<r32sint, write>;
+
+fn textureDimensions_2f289f() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2f289f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2f289f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2f289f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl
new file mode 100644
index 0000000..1d4350b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureDimensions(texture: texture_2d<f32>, level: i32) -> vec2<i32>
+fn textureDimensions_2fe1cc() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2fe1cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2fe1cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2fe1cc();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl
new file mode 100644
index 0000000..20bbd86
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_2fe1cc() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_2fe1cc();
+ 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 textureDimensions_2fe1cc() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_2fe1cc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_2fe1cc() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_2fe1cc();
+}
+
+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/textureDimensions/2fe1cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.hlsl
new file mode 100644
index 0000000..723a757
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_2fe1cc() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_2fe1cc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_2fe1cc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_2fe1cc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl
new file mode 100644
index 0000000..38413c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_2fe1cc(texture2d<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureDimensions_2fe1cc(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)]]) {
+ textureDimensions_2fe1cc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_2fe1cc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm
new file mode 100644
index 0000000..3dcda16
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_2fe1cc "textureDimensions_2fe1cc"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_2fe1cc = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v2int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_2fe1cc
+ 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 %textureDimensions_2fe1cc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_2fe1cc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl
new file mode 100644
index 0000000..148b199
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/2fe1cc.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureDimensions_2fe1cc() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_2fe1cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_2fe1cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_2fe1cc();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl
new file mode 100644
index 0000000..4563fc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba16uint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba16uint, write>) -> i32
+fn textureDimensions_318ecc() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_318ecc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_318ecc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_318ecc();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl
new file mode 100644
index 0000000..078e8b3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_318ecc() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_318ecc();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba16ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_318ecc() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_318ecc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_318ecc() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_318ecc();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl
new file mode 100644
index 0000000..bc9b732
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_318ecc() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_318ecc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_318ecc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_318ecc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl
new file mode 100644
index 0000000..a9655f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_318ecc(texture1d<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureDimensions_318ecc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_318ecc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_318ecc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm
new file mode 100644
index 0000000..c65dba9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_318ecc "textureDimensions_318ecc"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_318ecc = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_318ecc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_318ecc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_318ecc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl
new file mode 100644
index 0000000..d1c53d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/318ecc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba16uint, write>;
+
+fn textureDimensions_318ecc() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_318ecc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_318ecc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_318ecc();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl
new file mode 100644
index 0000000..801a81e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<r32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<r32uint, write>) -> vec3<i32>
+fn textureDimensions_340d06() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_340d06();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_340d06();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_340d06();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl
new file mode 100644
index 0000000..78d4994
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_340d06() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_340d06();
+ 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 uimage3D arg_0;
+void textureDimensions_340d06() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_340d06();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_340d06() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_340d06();
+}
+
+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/textureDimensions/340d06.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.hlsl
new file mode 100644
index 0000000..db01f68
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_340d06() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_340d06();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_340d06();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_340d06();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl
new file mode 100644
index 0000000..eb04eb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_340d06(texture3d<uint, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureDimensions_340d06(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_340d06(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_340d06(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm
new file mode 100644
index 0000000..c58da9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_340d06 "textureDimensions_340d06"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_340d06 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_340d06
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_340d06
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_340d06
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl
new file mode 100644
index 0000000..7ae21b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/340d06.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<r32uint, write>;
+
+fn textureDimensions_340d06() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_340d06();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_340d06();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_340d06();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl
new file mode 100644
index 0000000..d8a22e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba32uint, write>) -> vec2<i32>
+fn textureDimensions_398e30() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_398e30();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_398e30();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_398e30();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl
new file mode 100644
index 0000000..6db6351
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_398e30() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_398e30();
+ 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 textureDimensions_398e30() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_398e30();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_398e30() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_398e30();
+}
+
+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/textureDimensions/398e30.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.hlsl
new file mode 100644
index 0000000..ee95c58
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_398e30() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_398e30();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_398e30();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_398e30();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl
new file mode 100644
index 0000000..8de5617
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_398e30(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureDimensions_398e30(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)]]) {
+ textureDimensions_398e30(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_398e30(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm
new file mode 100644
index 0000000..9339841
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_398e30 "textureDimensions_398e30"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_398e30 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySize %v3int %22
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_398e30
+ 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 %textureDimensions_398e30
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_398e30
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl
new file mode 100644
index 0000000..457ff70
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/398e30.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureDimensions_398e30() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_398e30();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_398e30();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_398e30();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl
new file mode 100644
index 0000000..d00adb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rg32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rg32uint, write>) -> vec2<i32>
+fn textureDimensions_3a94ea() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_3a94ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_3a94ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_3a94ea();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl
new file mode 100644
index 0000000..4e7d263
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_3a94ea() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_3a94ea();
+ 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 uimage2D arg_0;
+void textureDimensions_3a94ea() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_3a94ea();
+}
+
+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 uimage2D arg_0;
+void textureDimensions_3a94ea() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_3a94ea();
+}
+
+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/textureDimensions/3a94ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.hlsl
new file mode 100644
index 0000000..347c92e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_3a94ea() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_3a94ea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_3a94ea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_3a94ea();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl
new file mode 100644
index 0000000..7dd2f6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_3a94ea(texture2d<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureDimensions_3a94ea(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_3a94ea(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_3a94ea(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm
new file mode 100644
index 0000000..1ef266d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_3a94ea "textureDimensions_3a94ea"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_3a94ea = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_3a94ea
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_3a94ea
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_3a94ea
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl
new file mode 100644
index 0000000..29d9579
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3a94ea.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rg32uint, write>;
+
+fn textureDimensions_3a94ea() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_3a94ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_3a94ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_3a94ea();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl
new file mode 100644
index 0000000..01a56a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba32float, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba32float, write>) -> i32
+fn textureDimensions_3aca08() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_3aca08();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_3aca08();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_3aca08();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl
new file mode 100644
index 0000000..e9c1656
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_3aca08() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_3aca08();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_3aca08() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_3aca08();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_3aca08() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_3aca08();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl
new file mode 100644
index 0000000..05eedf3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_3aca08() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_3aca08();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_3aca08();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_3aca08();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl
new file mode 100644
index 0000000..765771f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_3aca08(texture1d<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureDimensions_3aca08(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_3aca08(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_3aca08(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm
new file mode 100644
index 0000000..faf0eff
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_3aca08 "textureDimensions_3aca08"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_3aca08 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_3aca08
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_3aca08
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_3aca08
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl
new file mode 100644
index 0000000..ba8e34f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3aca08.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba32float, write>;
+
+fn textureDimensions_3aca08() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_3aca08();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_3aca08();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_3aca08();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl
new file mode 100644
index 0000000..9d72673
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba8sint, write>) -> vec2<i32>
+fn textureDimensions_3c5ad8() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_3c5ad8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_3c5ad8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_3c5ad8();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl
new file mode 100644
index 0000000..b27ab3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_3c5ad8() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_3c5ad8();
+ 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 iimage2D arg_0;
+void textureDimensions_3c5ad8() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_3c5ad8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_3c5ad8() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_3c5ad8();
+}
+
+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/textureDimensions/3c5ad8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.hlsl
new file mode 100644
index 0000000..78cd91b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_3c5ad8() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_3c5ad8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_3c5ad8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_3c5ad8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl
new file mode 100644
index 0000000..ba7e47a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_3c5ad8(texture2d<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureDimensions_3c5ad8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_3c5ad8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_3c5ad8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm
new file mode 100644
index 0000000..f91c033
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_3c5ad8 "textureDimensions_3c5ad8"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_3c5ad8 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_3c5ad8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_3c5ad8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_3c5ad8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc42b19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/3c5ad8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8sint, write>;
+
+fn textureDimensions_3c5ad8() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_3c5ad8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_3c5ad8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_3c5ad8();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl
new file mode 100644
index 0000000..52a3a07
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<u32>;
+
+// fn textureDimensions(texture: texture_cube_array<u32>) -> vec2<i32>
+fn textureDimensions_4152a6() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_4152a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_4152a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_4152a6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl
new file mode 100644
index 0000000..d3120a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_0_1;
+void textureDimensions_4152a6() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_4152a6();
+ 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_0_1;
+void textureDimensions_4152a6() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_4152a6();
+}
+
+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_0_1;
+void textureDimensions_4152a6() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_4152a6();
+}
+
+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/textureDimensions/4152a6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.hlsl
new file mode 100644
index 0000000..ae5eb35
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_4152a6() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_4152a6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_4152a6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_4152a6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl
new file mode 100644
index 0000000..ac8d43d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_4152a6(texturecube_array<uint, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_2) {
+ textureDimensions_4152a6(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_4152a6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_4152a6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm
new file mode 100644
index 0000000..e092546
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_4152a6 "textureDimensions_4152a6"
+ 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 Cube 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_4152a6 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySizeLod %v3int %22 %int_0
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_4152a6
+ 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 %textureDimensions_4152a6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_4152a6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl
new file mode 100644
index 0000000..f9ec8d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4152a6.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<u32>;
+
+fn textureDimensions_4152a6() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_4152a6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_4152a6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_4152a6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl
new file mode 100644
index 0000000..3fd9d7b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureDimensions(texture: texture_1d<i32>) -> i32
+fn textureDimensions_423f99() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_423f99();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_423f99();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_423f99();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl
new file mode 100644
index 0000000..08f2e24
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureDimensions_423f99() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_423f99();
+ 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 textureDimensions_423f99() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_423f99();
+}
+
+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 textureDimensions_423f99() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_423f99();
+}
+
+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/textureDimensions/423f99.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.hlsl
new file mode 100644
index 0000000..d6a4e4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_423f99() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_423f99();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_423f99();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_423f99();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl
new file mode 100644
index 0000000..77b610f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_423f99(texture1d<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureDimensions_423f99(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)]]) {
+ textureDimensions_423f99(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_423f99(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm
new file mode 100644
index 0000000..807bc78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_423f99 "textureDimensions_423f99"
+ 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_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_423f99 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %int %18 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_423f99
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_423f99
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_423f99
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl
new file mode 100644
index 0000000..b84b033
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/423f99.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureDimensions_423f99() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_423f99();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_423f99();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_423f99();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl
new file mode 100644
index 0000000..1c849b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba32float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba32float, write>) -> vec2<i32>
+fn textureDimensions_4267ee() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_4267ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_4267ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_4267ee();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl
new file mode 100644
index 0000000..c1f09fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2D arg_0;
+void textureDimensions_4267ee() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_4267ee();
+ 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 image2D arg_0;
+void textureDimensions_4267ee() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_4267ee();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2D arg_0;
+void textureDimensions_4267ee() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_4267ee();
+}
+
+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/textureDimensions/4267ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.hlsl
new file mode 100644
index 0000000..aab581e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_4267ee() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_4267ee();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_4267ee();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_4267ee();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl
new file mode 100644
index 0000000..177015d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_4267ee(texture2d<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureDimensions_4267ee(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_4267ee(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_4267ee(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm
new file mode 100644
index 0000000..a93a79d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_4267ee "textureDimensions_4267ee"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_4267ee = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_4267ee
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_4267ee
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_4267ee
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl
new file mode 100644
index 0000000..909269f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4267ee.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba32float, write>;
+
+fn textureDimensions_4267ee() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_4267ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_4267ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_4267ee();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl
new file mode 100644
index 0000000..ac087c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8unorm, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba8unorm, write>) -> i32
+fn textureDimensions_42d4e6() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_42d4e6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_42d4e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_42d4e6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl
new file mode 100644
index 0000000..f59d175
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image1D arg_0;
+void textureDimensions_42d4e6() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_42d4e6();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8) uniform highp writeonly image1D arg_0;
+void textureDimensions_42d4e6() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_42d4e6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image1D arg_0;
+void textureDimensions_42d4e6() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_42d4e6();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl
new file mode 100644
index 0000000..7c81817
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_42d4e6() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_42d4e6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_42d4e6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_42d4e6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl
new file mode 100644
index 0000000..cc3fa54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_42d4e6(texture1d<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureDimensions_42d4e6(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_42d4e6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_42d4e6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm
new file mode 100644
index 0000000..4127ab0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_42d4e6 "textureDimensions_42d4e6"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_42d4e6 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_42d4e6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_42d4e6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_42d4e6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl
new file mode 100644
index 0000000..bc98490
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/42d4e6.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8unorm, write>;
+
+fn textureDimensions_42d4e6() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_42d4e6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_42d4e6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_42d4e6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl
new file mode 100644
index 0000000..c278ed8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba16float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba16float, write>) -> vec2<i32>
+fn textureDimensions_48cb89() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_48cb89();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_48cb89();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_48cb89();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl
new file mode 100644
index 0000000..026fcaef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2D arg_0;
+void textureDimensions_48cb89() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_48cb89();
+ 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 image2D arg_0;
+void textureDimensions_48cb89() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_48cb89();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2D arg_0;
+void textureDimensions_48cb89() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_48cb89();
+}
+
+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/textureDimensions/48cb89.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.hlsl
new file mode 100644
index 0000000..9ec64be
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_48cb89() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_48cb89();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_48cb89();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_48cb89();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl
new file mode 100644
index 0000000..5f475e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_48cb89(texture2d<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureDimensions_48cb89(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_48cb89(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_48cb89(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm
new file mode 100644
index 0000000..9a887dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_48cb89 "textureDimensions_48cb89"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_48cb89 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_48cb89
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_48cb89
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_48cb89
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl
new file mode 100644
index 0000000..cdc0578
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/48cb89.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba16float, write>;
+
+fn textureDimensions_48cb89() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_48cb89();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_48cb89();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_48cb89();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl
new file mode 100644
index 0000000..dd85926
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rg32sint, write>) -> vec2<i32>
+fn textureDimensions_49d274() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_49d274();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_49d274();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_49d274();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl
new file mode 100644
index 0000000..70347a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_49d274() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_49d274();
+ 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 textureDimensions_49d274() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_49d274();
+}
+
+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 textureDimensions_49d274() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_49d274();
+}
+
+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/textureDimensions/49d274.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.hlsl
new file mode 100644
index 0000000..9ceff50
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_49d274() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_49d274();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_49d274();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_49d274();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl
new file mode 100644
index 0000000..4ca4453
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_49d274(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureDimensions_49d274(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)]]) {
+ textureDimensions_49d274(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_49d274(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm
new file mode 100644
index 0000000..9a63680
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_49d274 "textureDimensions_49d274"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_49d274 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_49d274
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_49d274
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_49d274
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl
new file mode 100644
index 0000000..00ebf36
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/49d274.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureDimensions_49d274() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_49d274();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_49d274();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_49d274();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl
new file mode 100644
index 0000000..c95dd96
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rg32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rg32uint, write>) -> i32
+fn textureDimensions_4df9a8() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_4df9a8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_4df9a8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_4df9a8();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl
new file mode 100644
index 0000000..7871ed7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_4df9a8() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_4df9a8();
+ 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 uimage1D arg_0;
+void textureDimensions_4df9a8() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_4df9a8();
+}
+
+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 uimage1D arg_0;
+void textureDimensions_4df9a8() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_4df9a8();
+}
+
+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/textureDimensions/4df9a8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.hlsl
new file mode 100644
index 0000000..8541c75
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_4df9a8() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_4df9a8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_4df9a8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_4df9a8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl
new file mode 100644
index 0000000..54723cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_4df9a8(texture1d<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureDimensions_4df9a8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_4df9a8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_4df9a8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm
new file mode 100644
index 0000000..c4be2a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_4df9a8 "textureDimensions_4df9a8"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_4df9a8 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_4df9a8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_4df9a8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_4df9a8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl
new file mode 100644
index 0000000..4078aa2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/4df9a8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rg32uint, write>;
+
+fn textureDimensions_4df9a8() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_4df9a8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_4df9a8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_4df9a8();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl
new file mode 100644
index 0000000..1a5c087
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+
+// fn textureDimensions(texture: texture_cube_array<f32>, level: i32) -> vec2<i32>
+fn textureDimensions_50a9ee() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_50a9ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_50a9ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_50a9ee();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl
new file mode 100644
index 0000000..e06d866
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureDimensions_50a9ee() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_50a9ee();
+ 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_0_1;
+void textureDimensions_50a9ee() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_50a9ee();
+}
+
+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_0_1;
+void textureDimensions_50a9ee() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_50a9ee();
+}
+
+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/textureDimensions/50a9ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.hlsl
new file mode 100644
index 0000000..e5b311b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_50a9ee() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_50a9ee();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_50a9ee();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_50a9ee();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl
new file mode 100644
index 0000000..109f854
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_50a9ee(texturecube_array<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_50a9ee(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_50a9ee(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_50a9ee(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm
new file mode 100644
index 0000000..e7172f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_50a9ee "textureDimensions_50a9ee"
+ OpName %arg_1 "arg_1"
+ 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 Cube 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %28 = OpConstantNull %v2int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_50a9ee = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %28
+ OpStore %arg_1 %17
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %22 = OpImageQuerySizeLod %v3int %24 %25
+ %20 = OpVectorShuffle %v2int %22 %22 0 1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_50a9ee
+ 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 %textureDimensions_50a9ee
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureDimensions_50a9ee
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl
new file mode 100644
index 0000000..664cf63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/50a9ee.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+fn textureDimensions_50a9ee() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_50a9ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_50a9ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_50a9ee();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl
new file mode 100644
index 0000000..08d9c90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureDimensions(texture: texture_1d<i32>, level: i32) -> i32
+fn textureDimensions_52045c() {
+ var arg_1 = 0;
+ var res: i32 = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_52045c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_52045c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_52045c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl
new file mode 100644
index 0000000..d4f8701
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureDimensions_52045c() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_52045c();
+ 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 textureDimensions_52045c() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_52045c();
+}
+
+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 textureDimensions_52045c() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_52045c();
+}
+
+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/textureDimensions/52045c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.hlsl
new file mode 100644
index 0000000..cb503d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_52045c() {
+ int arg_1 = 0;
+ int2 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_52045c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_52045c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_52045c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl
new file mode 100644
index 0000000..f8ccfdf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_52045c(texture1d<int, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureDimensions_52045c(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)]]) {
+ textureDimensions_52045c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_52045c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm
new file mode 100644
index 0000000..a119139
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_52045c "textureDimensions_52045c"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_52045c = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_1 %17
+ %21 = OpLoad %11 %arg_0
+ %22 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %int %21 %22
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_52045c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_52045c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_52045c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl
new file mode 100644
index 0000000..a03ae63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/52045c.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureDimensions_52045c() {
+ var arg_1 = 0;
+ var res : i32 = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_52045c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_52045c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_52045c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl
new file mode 100644
index 0000000..06255e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rg32float, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rg32float, write>) -> i32
+fn textureDimensions_55b23e() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_55b23e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_55b23e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_55b23e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl
new file mode 100644
index 0000000..a9465b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_55b23e() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_55b23e();
+ 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 image1D arg_0;
+void textureDimensions_55b23e() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_55b23e();
+}
+
+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 image1D arg_0;
+void textureDimensions_55b23e() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_55b23e();
+}
+
+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/textureDimensions/55b23e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.hlsl
new file mode 100644
index 0000000..c3634a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_55b23e() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_55b23e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_55b23e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_55b23e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl
new file mode 100644
index 0000000..0778752
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_55b23e(texture1d<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureDimensions_55b23e(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_55b23e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_55b23e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm
new file mode 100644
index 0000000..e6470a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_55b23e "textureDimensions_55b23e"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_55b23e = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_55b23e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_55b23e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_55b23e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl
new file mode 100644
index 0000000..32b929c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/55b23e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rg32float, write>;
+
+fn textureDimensions_55b23e() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_55b23e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_55b23e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_55b23e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl
new file mode 100644
index 0000000..963d480
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<u32>;
+
+// fn textureDimensions(texture: texture_multisampled_2d<u32>) -> vec2<i32>
+fn textureDimensions_579629() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_579629();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_579629();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_579629();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl
new file mode 100644
index 0000000..d1ca2e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureDimensions_579629() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_579629();
+ 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 textureDimensions_579629() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void fragment_main() {
+ textureDimensions_579629();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureDimensions_579629() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void compute_main() {
+ textureDimensions_579629();
+}
+
+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/textureDimensions/579629.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.hlsl
new file mode 100644
index 0000000..297d5dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_579629() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_579629();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_579629();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_579629();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl
new file mode 100644
index 0000000..d6c497b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_579629(texture2d_ms<uint, access::read> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<uint, access::read> tint_symbol_2) {
+ textureDimensions_579629(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)]]) {
+ textureDimensions_579629(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_579629(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm
new file mode 100644
index 0000000..5d35bf9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_579629 "textureDimensions_579629"
+ 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_579629 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_579629
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_579629
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_579629
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl
new file mode 100644
index 0000000..e157439
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/579629.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureDimensions_579629() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_579629();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_579629();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_579629();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl
new file mode 100644
index 0000000..5b7a168
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<r32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<r32uint, write>) -> i32
+fn textureDimensions_57da0b() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_57da0b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_57da0b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_57da0b();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl
new file mode 100644
index 0000000..c45ed2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_57da0b() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_57da0b();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(r32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_57da0b() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_57da0b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_57da0b() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_57da0b();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl
new file mode 100644
index 0000000..f9df5ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_57da0b() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_57da0b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_57da0b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_57da0b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl
new file mode 100644
index 0000000..fb1c232
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_57da0b(texture1d<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureDimensions_57da0b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_57da0b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_57da0b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm
new file mode 100644
index 0000000..9d0c96d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_57da0b "textureDimensions_57da0b"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_57da0b = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_57da0b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_57da0b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_57da0b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl
new file mode 100644
index 0000000..f05ee1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57da0b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<r32uint, write>;
+
+fn textureDimensions_57da0b() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_57da0b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_57da0b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_57da0b();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl
new file mode 100644
index 0000000..0b9d680
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+
+// fn textureDimensions(texture: texture_depth_cube) -> vec2<i32>
+fn textureDimensions_57e28f() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_57e28f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_57e28f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_57e28f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl
new file mode 100644
index 0000000..c8713a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_57e28f() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_57e28f();
+ 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 samplerCube arg_0_1;
+void textureDimensions_57e28f() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_57e28f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_57e28f() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_57e28f();
+}
+
+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/textureDimensions/57e28f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.hlsl
new file mode 100644
index 0000000..8da8d7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube arg_0 : register(t0, space1);
+
+void textureDimensions_57e28f() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_57e28f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_57e28f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_57e28f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl
new file mode 100644
index 0000000..c089020
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_57e28f(depthcube<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_2) {
+ textureDimensions_57e28f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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(depthcube<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_57e28f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_57e28f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm
new file mode 100644
index 0000000..9dd34bf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_57e28f "textureDimensions_57e28f"
+ 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 Cube 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_57e28f = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySizeLod %v2int %19 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_57e28f
+ 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 %textureDimensions_57e28f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_57e28f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl
new file mode 100644
index 0000000..3d25747
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/57e28f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+fn textureDimensions_57e28f() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_57e28f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_57e28f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_57e28f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl
new file mode 100644
index 0000000..df0e9cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba16float, write>) -> vec2<i32>
+fn textureDimensions_58a515() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_58a515();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_58a515();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_58a515();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl
new file mode 100644
index 0000000..b67bb0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_58a515() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_58a515();
+ 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 textureDimensions_58a515() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_58a515();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_58a515() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_58a515();
+}
+
+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/textureDimensions/58a515.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.hlsl
new file mode 100644
index 0000000..e8a7b4b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_58a515() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_58a515();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_58a515();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_58a515();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl
new file mode 100644
index 0000000..c8d90cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_58a515(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureDimensions_58a515(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)]]) {
+ textureDimensions_58a515(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_58a515(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm
new file mode 100644
index 0000000..5afc929
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_58a515 "textureDimensions_58a515"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_58a515 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_58a515
+ 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 %textureDimensions_58a515
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_58a515
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl
new file mode 100644
index 0000000..c395b92
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/58a515.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureDimensions_58a515() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_58a515();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_58a515();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_58a515();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl
new file mode 100644
index 0000000..dffa849
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba32sint, write>) -> vec2<i32>
+fn textureDimensions_5985f3() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_5985f3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_5985f3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_5985f3();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl
new file mode 100644
index 0000000..4c33a17
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_5985f3() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_5985f3();
+ 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 textureDimensions_5985f3() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_5985f3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_5985f3() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_5985f3();
+}
+
+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/textureDimensions/5985f3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.hlsl
new file mode 100644
index 0000000..488cb17
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_5985f3() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_5985f3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_5985f3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_5985f3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl
new file mode 100644
index 0000000..90f407d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_5985f3(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureDimensions_5985f3(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)]]) {
+ textureDimensions_5985f3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_5985f3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm
new file mode 100644
index 0000000..f51c50b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_5985f3 "textureDimensions_5985f3"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_5985f3 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_5985f3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_5985f3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_5985f3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl
new file mode 100644
index 0000000..cc73d08
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5985f3.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureDimensions_5985f3() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_5985f3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_5985f3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_5985f3();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl
new file mode 100644
index 0000000..5582c6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba32uint, write>) -> i32
+fn textureDimensions_5caa5e() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_5caa5e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_5caa5e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_5caa5e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl
new file mode 100644
index 0000000..d02caf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_5caa5e() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_5caa5e();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_5caa5e() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_5caa5e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_5caa5e() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_5caa5e();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl
new file mode 100644
index 0000000..066fbdf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_5caa5e() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_5caa5e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_5caa5e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_5caa5e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl
new file mode 100644
index 0000000..56e5f71
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_5caa5e(texture1d<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureDimensions_5caa5e(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_5caa5e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_5caa5e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm
new file mode 100644
index 0000000..68ec968
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_5caa5e "textureDimensions_5caa5e"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_5caa5e = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_5caa5e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_5caa5e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_5caa5e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl
new file mode 100644
index 0000000..3f83443
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5caa5e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba32uint, write>;
+
+fn textureDimensions_5caa5e() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_5caa5e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_5caa5e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_5caa5e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl
new file mode 100644
index 0000000..b855d3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba16uint, write>) -> vec2<i32>
+fn textureDimensions_5e295d() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_5e295d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_5e295d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_5e295d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl
new file mode 100644
index 0000000..f079eb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_5e295d() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_5e295d();
+ 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 textureDimensions_5e295d() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_5e295d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_5e295d() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_5e295d();
+}
+
+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/textureDimensions/5e295d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.hlsl
new file mode 100644
index 0000000..a88725c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_5e295d() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_5e295d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_5e295d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_5e295d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl
new file mode 100644
index 0000000..50d3988
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_5e295d(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureDimensions_5e295d(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)]]) {
+ textureDimensions_5e295d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_5e295d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm
new file mode 100644
index 0000000..05297b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_5e295d "textureDimensions_5e295d"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_5e295d = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySize %v3int %22
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_5e295d
+ 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 %textureDimensions_5e295d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_5e295d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl
new file mode 100644
index 0000000..d8bceb6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/5e295d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureDimensions_5e295d() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_5e295d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_5e295d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_5e295d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl
new file mode 100644
index 0000000..df274c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rg32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rg32sint, write>) -> vec3<i32>
+fn textureDimensions_60bf54() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_60bf54();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_60bf54();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_60bf54();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl
new file mode 100644
index 0000000..91d0815
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_60bf54() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_60bf54();
+ 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 iimage3D arg_0;
+void textureDimensions_60bf54() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_60bf54();
+}
+
+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 iimage3D arg_0;
+void textureDimensions_60bf54() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_60bf54();
+}
+
+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/textureDimensions/60bf54.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.hlsl
new file mode 100644
index 0000000..d7ac1d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_60bf54() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_60bf54();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_60bf54();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_60bf54();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl
new file mode 100644
index 0000000..bf597c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_60bf54(texture3d<int, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureDimensions_60bf54(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_60bf54(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_60bf54(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm
new file mode 100644
index 0000000..5073da1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_60bf54 "textureDimensions_60bf54"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_60bf54 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_60bf54
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_60bf54
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_60bf54
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl
new file mode 100644
index 0000000..f9347de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/60bf54.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rg32sint, write>;
+
+fn textureDimensions_60bf54() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_60bf54();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_60bf54();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_60bf54();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl
new file mode 100644
index 0000000..ae013ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rg32float, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rg32float, write>) -> vec3<i32>
+fn textureDimensions_63f3cf() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_63f3cf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_63f3cf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_63f3cf();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl
new file mode 100644
index 0000000..6a77ea9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image3D arg_0;
+void textureDimensions_63f3cf() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_63f3cf();
+ 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 image3D arg_0;
+void textureDimensions_63f3cf() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_63f3cf();
+}
+
+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 image3D arg_0;
+void textureDimensions_63f3cf() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_63f3cf();
+}
+
+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/textureDimensions/63f3cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.hlsl
new file mode 100644
index 0000000..f03906d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_63f3cf() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_63f3cf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_63f3cf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_63f3cf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl
new file mode 100644
index 0000000..931b457
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_63f3cf(texture3d<float, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureDimensions_63f3cf(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_63f3cf(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_63f3cf(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm
new file mode 100644
index 0000000..f146e10
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_63f3cf "textureDimensions_63f3cf"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_63f3cf = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v3int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_63f3cf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_63f3cf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_63f3cf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl
new file mode 100644
index 0000000..43e5f15
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/63f3cf.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rg32float, write>;
+
+fn textureDimensions_63f3cf() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_63f3cf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_63f3cf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_63f3cf();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl
new file mode 100644
index 0000000..ddac6b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba32uint, write>) -> vec2<i32>
+fn textureDimensions_68105c() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_68105c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_68105c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_68105c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl
new file mode 100644
index 0000000..d366071
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_68105c() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_68105c();
+ 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 uimage2D arg_0;
+void textureDimensions_68105c() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_68105c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_68105c() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_68105c();
+}
+
+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/textureDimensions/68105c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.hlsl
new file mode 100644
index 0000000..c372328
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_68105c() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_68105c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_68105c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_68105c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl
new file mode 100644
index 0000000..a1fdb63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_68105c(texture2d<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureDimensions_68105c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_68105c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_68105c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm
new file mode 100644
index 0000000..471b570
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_68105c "textureDimensions_68105c"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_68105c = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_68105c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_68105c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_68105c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl
new file mode 100644
index 0000000..853c631
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/68105c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba32uint, write>;
+
+fn textureDimensions_68105c() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_68105c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_68105c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_68105c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl
new file mode 100644
index 0000000..8a24797
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<i32>;
+
+// fn textureDimensions(texture: texture_cube<i32>, level: i32) -> vec2<i32>
+fn textureDimensions_686ef2() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_686ef2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_686ef2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_686ef2();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl
new file mode 100644
index 0000000..c020973
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp isamplerCube arg_0_1;
+void textureDimensions_686ef2() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_686ef2();
+ 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 isamplerCube arg_0_1;
+void textureDimensions_686ef2() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_686ef2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isamplerCube arg_0_1;
+void textureDimensions_686ef2() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_686ef2();
+}
+
+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/textureDimensions/686ef2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.hlsl
new file mode 100644
index 0000000..eeccbd6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_686ef2() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_686ef2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_686ef2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_686ef2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl
new file mode 100644
index 0000000..c934b1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_686ef2(texturecube<int, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<int, access::sample> tint_symbol_2) {
+ textureDimensions_686ef2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_686ef2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_686ef2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm
new file mode 100644
index 0000000..83b84ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_686ef2 "textureDimensions_686ef2"
+ OpName %arg_1 "arg_1"
+ 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 Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_686ef2 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v2int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_686ef2
+ 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 %textureDimensions_686ef2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_686ef2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl
new file mode 100644
index 0000000..19de8f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/686ef2.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_cube<i32>;
+
+fn textureDimensions_686ef2() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_686ef2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_686ef2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_686ef2();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl
new file mode 100644
index 0000000..d079cf9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba32sint, write>) -> i32
+fn textureDimensions_6adac6() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_6adac6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_6adac6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_6adac6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl
new file mode 100644
index 0000000..acaaa5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_6adac6() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_6adac6();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_6adac6() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_6adac6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_6adac6() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_6adac6();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl
new file mode 100644
index 0000000..52b2080
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_6adac6() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_6adac6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_6adac6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_6adac6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl
new file mode 100644
index 0000000..7087625
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_6adac6(texture1d<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureDimensions_6adac6(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_6adac6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_6adac6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm
new file mode 100644
index 0000000..363af60
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_6adac6 "textureDimensions_6adac6"
+ 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 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 1D 0 0 0 2 Rgba32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_6adac6 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_6adac6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_6adac6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_6adac6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl
new file mode 100644
index 0000000..c48c479
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6adac6.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba32sint, write>;
+
+fn textureDimensions_6adac6() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_6adac6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_6adac6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_6adac6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl
new file mode 100644
index 0000000..eaab191
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureDimensions(texture: texture_3d<u32>) -> vec3<i32>
+fn textureDimensions_6ec1b4() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_6ec1b4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_6ec1b4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_6ec1b4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl
new file mode 100644
index 0000000..482455d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureDimensions_6ec1b4() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_6ec1b4();
+ 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 textureDimensions_6ec1b4() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_6ec1b4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureDimensions_6ec1b4() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_6ec1b4();
+}
+
+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/textureDimensions/6ec1b4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.hlsl
new file mode 100644
index 0000000..6e9cb1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_6ec1b4() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_6ec1b4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_6ec1b4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_6ec1b4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl
new file mode 100644
index 0000000..52a3369
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_6ec1b4(texture3d<uint, access::sample> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureDimensions_6ec1b4(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)]]) {
+ textureDimensions_6ec1b4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_6ec1b4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm
new file mode 100644
index 0000000..4f8be17
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_6ec1b4 "textureDimensions_6ec1b4"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %24 = OpConstantNull %v3int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_6ec1b4 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %24
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %v3int %20 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_6ec1b4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_6ec1b4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_6ec1b4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl
new file mode 100644
index 0000000..6cc7cc1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6ec1b4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureDimensions_6ec1b4() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_6ec1b4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_6ec1b4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_6ec1b4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl
new file mode 100644
index 0000000..05ff750
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8snorm, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba8snorm, write>) -> vec2<i32>
+fn textureDimensions_6f0d79() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_6f0d79();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_6f0d79();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_6f0d79();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl
new file mode 100644
index 0000000..71893cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_6f0d79() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_6f0d79();
+ 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 textureDimensions_6f0d79() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_6f0d79();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_6f0d79() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_6f0d79();
+}
+
+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/textureDimensions/6f0d79.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.hlsl
new file mode 100644
index 0000000..cd1a3a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_6f0d79() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_6f0d79();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_6f0d79();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_6f0d79();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl
new file mode 100644
index 0000000..5154f6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_6f0d79(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureDimensions_6f0d79(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)]]) {
+ textureDimensions_6f0d79(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_6f0d79(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm
new file mode 100644
index 0000000..f1032b69
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_6f0d79 "textureDimensions_6f0d79"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_6f0d79 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_6f0d79
+ 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 %textureDimensions_6f0d79
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_6f0d79
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl
new file mode 100644
index 0000000..7b1f32c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/6f0d79.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureDimensions_6f0d79() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_6f0d79();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_6f0d79();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_6f0d79();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl
new file mode 100644
index 0000000..0673cb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8unorm, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba8unorm, write>) -> vec2<i32>
+fn textureDimensions_702c53() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_702c53();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_702c53();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_702c53();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl
new file mode 100644
index 0000000..e4f0c34
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2D arg_0;
+void textureDimensions_702c53() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_702c53();
+ 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 image2D arg_0;
+void textureDimensions_702c53() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_702c53();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2D arg_0;
+void textureDimensions_702c53() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_702c53();
+}
+
+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/textureDimensions/702c53.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.hlsl
new file mode 100644
index 0000000..40c27c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_702c53() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_702c53();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_702c53();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_702c53();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl
new file mode 100644
index 0000000..d202631
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_702c53(texture2d<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureDimensions_702c53(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_702c53(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_702c53(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm
new file mode 100644
index 0000000..514d19f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_702c53 "textureDimensions_702c53"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_702c53 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_702c53
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_702c53
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_702c53
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl
new file mode 100644
index 0000000..27d3074
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/702c53.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8unorm, write>;
+
+fn textureDimensions_702c53() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_702c53();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_702c53();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_702c53();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl
new file mode 100644
index 0000000..92e43ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureDimensions(texture: texture_depth_2d_array, level: i32) -> vec2<i32>
+fn textureDimensions_72e5d6() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_72e5d6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_72e5d6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_72e5d6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl
new file mode 100644
index 0000000..1b5be59
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_72e5d6() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_72e5d6();
+ 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 textureDimensions_72e5d6() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_72e5d6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_72e5d6() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_72e5d6();
+}
+
+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/textureDimensions/72e5d6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.hlsl
new file mode 100644
index 0000000..71a9484
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureDimensions_72e5d6() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_72e5d6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_72e5d6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_72e5d6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl
new file mode 100644
index 0000000..d022c05
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_72e5d6(depth2d_array<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_72e5d6(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)]]) {
+ textureDimensions_72e5d6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_72e5d6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm
new file mode 100644
index 0000000..882e22c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_72e5d6 "textureDimensions_72e5d6"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %28 = OpConstantNull %v2int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_72e5d6 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %28
+ OpStore %arg_1 %17
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %22 = OpImageQuerySizeLod %v3int %24 %25
+ %20 = OpVectorShuffle %v2int %22 %22 0 1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_72e5d6
+ 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 %textureDimensions_72e5d6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureDimensions_72e5d6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl
new file mode 100644
index 0000000..7789fbc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/72e5d6.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureDimensions_72e5d6() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_72e5d6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_72e5d6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_72e5d6();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl
new file mode 100644
index 0000000..868f9d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureDimensions(texture: texture_1d<u32>, level: i32) -> i32
+fn textureDimensions_79df87() {
+ var arg_1 = 0;
+ var res: i32 = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_79df87();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_79df87();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_79df87();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl
new file mode 100644
index 0000000..1b5edf0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureDimensions_79df87() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_79df87();
+ 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 textureDimensions_79df87() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_79df87();
+}
+
+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 textureDimensions_79df87() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_79df87();
+}
+
+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/textureDimensions/79df87.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.hlsl
new file mode 100644
index 0000000..d2bf772
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_79df87() {
+ int arg_1 = 0;
+ int2 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_79df87();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_79df87();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_79df87();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl
new file mode 100644
index 0000000..77b77b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_79df87(texture1d<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureDimensions_79df87(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)]]) {
+ textureDimensions_79df87(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_79df87(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm
new file mode 100644
index 0000000..4c4689a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_79df87 "textureDimensions_79df87"
+ OpName %arg_1 "arg_1"
+ 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
+ %18 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_79df87 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %18
+ %res = OpVariable %_ptr_Function_int Function %18
+ OpStore %arg_1 %18
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %21 = OpImageQuerySizeLod %int %22 %23
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_79df87
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_79df87
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_79df87
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl
new file mode 100644
index 0000000..3029f41
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/79df87.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureDimensions_79df87() {
+ var arg_1 = 0;
+ var res : i32 = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_79df87();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_79df87();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_79df87();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl
new file mode 100644
index 0000000..6297e5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureDimensions(texture: texture_depth_2d_array) -> vec2<i32>
+fn textureDimensions_7bf826() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_7bf826();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_7bf826();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_7bf826();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl
new file mode 100644
index 0000000..9859cdd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_7bf826() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_7bf826();
+ 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 textureDimensions_7bf826() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_7bf826();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_7bf826() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_7bf826();
+}
+
+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/textureDimensions/7bf826.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.hlsl
new file mode 100644
index 0000000..9c0e675
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureDimensions_7bf826() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_7bf826();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_7bf826();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_7bf826();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl
new file mode 100644
index 0000000..59cd373
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_7bf826(depth2d_array<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_7bf826(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)]]) {
+ textureDimensions_7bf826(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_7bf826(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm
new file mode 100644
index 0000000..2229e18
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_7bf826 "textureDimensions_7bf826"
+ 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_7bf826 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_7bf826
+ 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 %textureDimensions_7bf826
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_7bf826
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl
new file mode 100644
index 0000000..50ddae7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7bf826.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureDimensions_7bf826() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_7bf826();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_7bf826();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_7bf826();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl
new file mode 100644
index 0000000..97ce4dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rg32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rg32sint, write>) -> vec2<i32>
+fn textureDimensions_7f5c2e() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_7f5c2e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_7f5c2e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_7f5c2e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl
new file mode 100644
index 0000000..ed85e7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_7f5c2e() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_7f5c2e();
+ 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 iimage2D arg_0;
+void textureDimensions_7f5c2e() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_7f5c2e();
+}
+
+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 iimage2D arg_0;
+void textureDimensions_7f5c2e() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_7f5c2e();
+}
+
+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/textureDimensions/7f5c2e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.hlsl
new file mode 100644
index 0000000..9c6abe3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_7f5c2e() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_7f5c2e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_7f5c2e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_7f5c2e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl
new file mode 100644
index 0000000..f853ebc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_7f5c2e(texture2d<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureDimensions_7f5c2e(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_7f5c2e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_7f5c2e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm
new file mode 100644
index 0000000..5a25cc1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_7f5c2e "textureDimensions_7f5c2e"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_7f5c2e = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_7f5c2e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_7f5c2e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_7f5c2e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl
new file mode 100644
index 0000000..0eecf68
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/7f5c2e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rg32sint, write>;
+
+fn textureDimensions_7f5c2e() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_7f5c2e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_7f5c2e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_7f5c2e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl
new file mode 100644
index 0000000..b478fa2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<r32float, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<r32float, write>) -> vec3<i32>
+fn textureDimensions_8028f3() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8028f3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8028f3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8028f3();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl
new file mode 100644
index 0000000..4ac9ac9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image3D arg_0;
+void textureDimensions_8028f3() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_8028f3();
+ 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 image3D arg_0;
+void textureDimensions_8028f3() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_8028f3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image3D arg_0;
+void textureDimensions_8028f3() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_8028f3();
+}
+
+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/textureDimensions/8028f3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.hlsl
new file mode 100644
index 0000000..f18db34
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_8028f3() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_8028f3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_8028f3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_8028f3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl
new file mode 100644
index 0000000..efc7793
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_8028f3(texture3d<float, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureDimensions_8028f3(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_8028f3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_8028f3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm
new file mode 100644
index 0000000..814b999
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_8028f3 "textureDimensions_8028f3"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_8028f3 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v3int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_8028f3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_8028f3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_8028f3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl
new file mode 100644
index 0000000..7ad5727
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8028f3.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<r32float, write>;
+
+fn textureDimensions_8028f3() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8028f3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8028f3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8028f3();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl
new file mode 100644
index 0000000..7d7722d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba32uint, write>) -> vec3<i32>
+fn textureDimensions_811679() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_811679();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_811679();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_811679();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl
new file mode 100644
index 0000000..152d367
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_811679() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_811679();
+ 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 uimage3D arg_0;
+void textureDimensions_811679() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_811679();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_811679() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_811679();
+}
+
+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/textureDimensions/811679.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.hlsl
new file mode 100644
index 0000000..a474cba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_811679() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_811679();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_811679();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_811679();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl
new file mode 100644
index 0000000..825c3ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_811679(texture3d<uint, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureDimensions_811679(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_811679(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_811679(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm
new file mode 100644
index 0000000..c051822
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_811679 "textureDimensions_811679"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_811679 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_811679
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_811679
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_811679
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl
new file mode 100644
index 0000000..154cdde
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/811679.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba32uint, write>;
+
+fn textureDimensions_811679() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_811679();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_811679();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_811679();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl
new file mode 100644
index 0000000..8ec3269
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rg32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rg32uint, write>) -> vec3<i32>
+fn textureDimensions_820596() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_820596();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_820596();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_820596();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl
new file mode 100644
index 0000000..12ee4ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_820596() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_820596();
+ 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 uimage3D arg_0;
+void textureDimensions_820596() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_820596();
+}
+
+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 uimage3D arg_0;
+void textureDimensions_820596() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_820596();
+}
+
+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/textureDimensions/820596.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.hlsl
new file mode 100644
index 0000000..af2f262
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_820596() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_820596();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_820596();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_820596();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl
new file mode 100644
index 0000000..1ecf8c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_820596(texture3d<uint, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureDimensions_820596(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_820596(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_820596(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm
new file mode 100644
index 0000000..a657294
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_820596 "textureDimensions_820596"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_820596 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_820596
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_820596
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_820596
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl
new file mode 100644
index 0000000..93106d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/820596.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rg32uint, write>;
+
+fn textureDimensions_820596() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_820596();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_820596();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_820596();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl
new file mode 100644
index 0000000..bdd0b53
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba32sint, write>) -> vec2<i32>
+fn textureDimensions_83ee5a() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_83ee5a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_83ee5a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_83ee5a();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl
new file mode 100644
index 0000000..1f6ce58
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_83ee5a() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_83ee5a();
+ 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 iimage2D arg_0;
+void textureDimensions_83ee5a() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_83ee5a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_83ee5a() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_83ee5a();
+}
+
+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/textureDimensions/83ee5a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.hlsl
new file mode 100644
index 0000000..efa903a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_83ee5a() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_83ee5a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_83ee5a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_83ee5a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl
new file mode 100644
index 0000000..29cff8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_83ee5a(texture2d<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureDimensions_83ee5a(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_83ee5a(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_83ee5a(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm
new file mode 100644
index 0000000..32e7431
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_83ee5a "textureDimensions_83ee5a"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_83ee5a = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_83ee5a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_83ee5a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_83ee5a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl
new file mode 100644
index 0000000..3481e3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/83ee5a.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba32sint, write>;
+
+fn textureDimensions_83ee5a() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_83ee5a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_83ee5a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_83ee5a();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl
new file mode 100644
index 0000000..10a4318
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureDimensions(texture: texture_2d_array<f32>, level: i32) -> vec2<i32>
+fn textureDimensions_85d556() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_85d556();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_85d556();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_85d556();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl
new file mode 100644
index 0000000..0186d41
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_85d556() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_85d556();
+ 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 textureDimensions_85d556() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_85d556();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_85d556() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_85d556();
+}
+
+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/textureDimensions/85d556.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.hlsl
new file mode 100644
index 0000000..383bb7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_85d556() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_85d556();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_85d556();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_85d556();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl
new file mode 100644
index 0000000..ee20395
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_85d556(texture2d_array<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_85d556(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)]]) {
+ textureDimensions_85d556(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_85d556(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm
new file mode 100644
index 0000000..e15046a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_85d556 "textureDimensions_85d556"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %28 = OpConstantNull %v2int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_85d556 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %28
+ OpStore %arg_1 %17
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %22 = OpImageQuerySizeLod %v3int %24 %25
+ %20 = OpVectorShuffle %v2int %22 %22 0 1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_85d556
+ 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 %textureDimensions_85d556
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureDimensions_85d556
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl
new file mode 100644
index 0000000..55c3e24
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/85d556.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureDimensions_85d556() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_85d556();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_85d556();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_85d556();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl
new file mode 100644
index 0000000..f64186a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<u32>;
+
+// fn textureDimensions(texture: texture_cube<u32>, level: i32) -> vec2<i32>
+fn textureDimensions_88ad17() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_88ad17();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_88ad17();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_88ad17();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl
new file mode 100644
index 0000000..5cfa74e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp usamplerCube arg_0_1;
+void textureDimensions_88ad17() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_88ad17();
+ 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 usamplerCube arg_0_1;
+void textureDimensions_88ad17() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_88ad17();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usamplerCube arg_0_1;
+void textureDimensions_88ad17() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_88ad17();
+}
+
+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/textureDimensions/88ad17.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.hlsl
new file mode 100644
index 0000000..4b443c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_88ad17() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_88ad17();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_88ad17();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_88ad17();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl
new file mode 100644
index 0000000..6a00fb1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_88ad17(texturecube<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<uint, access::sample> tint_symbol_2) {
+ textureDimensions_88ad17(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_88ad17(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_88ad17(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm
new file mode 100644
index 0000000..c88dd06
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_88ad17 "textureDimensions_88ad17"
+ OpName %arg_1 "arg_1"
+ 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 Cube 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
+ %18 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %27 = OpConstantNull %v2int
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_88ad17 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %18
+ %res = OpVariable %_ptr_Function_v2int Function %27
+ OpStore %arg_1 %18
+ %23 = OpLoad %11 %arg_0
+ %24 = OpLoad %int %arg_1
+ %21 = OpImageQuerySizeLod %v2int %23 %24
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureDimensions_88ad17
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_88ad17
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureDimensions_88ad17
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl
new file mode 100644
index 0000000..8a2f64b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/88ad17.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_cube<u32>;
+
+fn textureDimensions_88ad17() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_88ad17();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_88ad17();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_88ad17();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl
new file mode 100644
index 0000000..4468f26
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureDimensions(texture: texture_3d<f32>) -> vec3<i32>
+fn textureDimensions_8aa4c4() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8aa4c4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8aa4c4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8aa4c4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl
new file mode 100644
index 0000000..45495e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureDimensions_8aa4c4() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_8aa4c4();
+ 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 textureDimensions_8aa4c4() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_8aa4c4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureDimensions_8aa4c4() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_8aa4c4();
+}
+
+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/textureDimensions/8aa4c4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.hlsl
new file mode 100644
index 0000000..e8a2fa1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_8aa4c4() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_8aa4c4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_8aa4c4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_8aa4c4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl
new file mode 100644
index 0000000..77f5715
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_8aa4c4(texture3d<float, access::sample> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureDimensions_8aa4c4(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)]]) {
+ textureDimensions_8aa4c4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_8aa4c4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b2376f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_8aa4c4 "textureDimensions_8aa4c4"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_8aa4c4 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySizeLod %v3int %19 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_8aa4c4
+ 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 %textureDimensions_8aa4c4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_8aa4c4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl
new file mode 100644
index 0000000..3a59eb6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8aa4c4.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureDimensions_8aa4c4() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8aa4c4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8aa4c4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8aa4c4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl
new file mode 100644
index 0000000..de87126
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureDimensions(texture: texture_3d<i32>) -> vec3<i32>
+fn textureDimensions_8deb5e() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8deb5e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8deb5e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8deb5e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl
new file mode 100644
index 0000000..8869c19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureDimensions_8deb5e() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_8deb5e();
+ 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 textureDimensions_8deb5e() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_8deb5e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureDimensions_8deb5e() {
+ ivec3 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_8deb5e();
+}
+
+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/textureDimensions/8deb5e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.hlsl
new file mode 100644
index 0000000..398823e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_8deb5e() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_8deb5e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_8deb5e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_8deb5e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl
new file mode 100644
index 0000000..7899845
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_8deb5e(texture3d<int, access::sample> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureDimensions_8deb5e(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)]]) {
+ textureDimensions_8deb5e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_8deb5e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm
new file mode 100644
index 0000000..7afdac3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_8deb5e "textureDimensions_8deb5e"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_8deb5e = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %v3int %19 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_8deb5e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_8deb5e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_8deb5e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl
new file mode 100644
index 0000000..1f088c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8deb5e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureDimensions_8deb5e() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8deb5e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8deb5e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8deb5e();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl
new file mode 100644
index 0000000..ba50596
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+
+// fn textureDimensions(texture: texture_cube_array<f32>) -> vec2<i32>
+fn textureDimensions_8f20bf() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8f20bf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8f20bf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8f20bf();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl
new file mode 100644
index 0000000..a01eead
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureDimensions_8f20bf() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_8f20bf();
+ 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_0_1;
+void textureDimensions_8f20bf() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_8f20bf();
+}
+
+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_0_1;
+void textureDimensions_8f20bf() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_8f20bf();
+}
+
+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/textureDimensions/8f20bf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.hlsl
new file mode 100644
index 0000000..58462cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_8f20bf() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_8f20bf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_8f20bf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_8f20bf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl
new file mode 100644
index 0000000..431a454
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_8f20bf(texturecube_array<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_8f20bf(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_8f20bf(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_8f20bf(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm
new file mode 100644
index 0000000..952b3d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_8f20bf "textureDimensions_8f20bf"
+ 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 Cube 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_8f20bf = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_8f20bf
+ 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 %textureDimensions_8f20bf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_8f20bf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl
new file mode 100644
index 0000000..e299daf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8f20bf.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+fn textureDimensions_8f20bf() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8f20bf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8f20bf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8f20bf();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl
new file mode 100644
index 0000000..ca949de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba32float, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba32float, write>) -> vec3<i32>
+fn textureDimensions_8fca0f() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8fca0f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8fca0f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8fca0f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl
new file mode 100644
index 0000000..255924a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image3D arg_0;
+void textureDimensions_8fca0f() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_8fca0f();
+ 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 image3D arg_0;
+void textureDimensions_8fca0f() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_8fca0f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image3D arg_0;
+void textureDimensions_8fca0f() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_8fca0f();
+}
+
+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/textureDimensions/8fca0f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.hlsl
new file mode 100644
index 0000000..ace86e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_8fca0f() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_8fca0f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_8fca0f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_8fca0f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl
new file mode 100644
index 0000000..f104902
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_8fca0f(texture3d<float, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureDimensions_8fca0f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_8fca0f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_8fca0f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm
new file mode 100644
index 0000000..0f3281e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_8fca0f "textureDimensions_8fca0f"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_8fca0f = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v3int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_8fca0f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_8fca0f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_8fca0f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl
new file mode 100644
index 0000000..4599b2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/8fca0f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba32float, write>;
+
+fn textureDimensions_8fca0f() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_8fca0f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_8fca0f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_8fca0f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl
new file mode 100644
index 0000000..4acb1f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+
+// fn textureDimensions(texture: texture_depth_cube_array) -> vec2<i32>
+fn textureDimensions_90340b() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_90340b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_90340b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_90340b();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl
new file mode 100644
index 0000000..09d10eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureDimensions_90340b() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_90340b();
+ 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_0_1;
+void textureDimensions_90340b() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_90340b();
+}
+
+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_0_1;
+void textureDimensions_90340b() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_90340b();
+}
+
+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/textureDimensions/90340b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.hlsl
new file mode 100644
index 0000000..26df72f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray arg_0 : register(t0, space1);
+
+void textureDimensions_90340b() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_90340b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_90340b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_90340b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl
new file mode 100644
index 0000000..f585531
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_90340b(depthcube_array<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_90340b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_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(depthcube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_90340b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_90340b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm
new file mode 100644
index 0000000..5d4d7e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_90340b "textureDimensions_90340b"
+ 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 Cube 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_90340b = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_90340b
+ 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 %textureDimensions_90340b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_90340b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl
new file mode 100644
index 0000000..2addbf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/90340b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+fn textureDimensions_90340b() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_90340b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_90340b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_90340b();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl
new file mode 100644
index 0000000..6365cba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rg32uint, write>) -> vec2<i32>
+fn textureDimensions_9042ab() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9042ab();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9042ab();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9042ab();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl
new file mode 100644
index 0000000..1fb6520
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureDimensions_9042ab() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_9042ab();
+ 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 textureDimensions_9042ab() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_9042ab();
+}
+
+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 textureDimensions_9042ab() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_9042ab();
+}
+
+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/textureDimensions/9042ab.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.hlsl
new file mode 100644
index 0000000..95dc105
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_9042ab() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9042ab();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9042ab();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9042ab();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl
new file mode 100644
index 0000000..5f29287
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9042ab(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureDimensions_9042ab(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)]]) {
+ textureDimensions_9042ab(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9042ab(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0099a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.spvasm
@@ -0,0 +1,80 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_9042ab "textureDimensions_9042ab"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9042ab = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %22 = OpLoad %11 %arg_0
+ %20 = OpImageQuerySize %v3int %22
+ %17 = OpVectorShuffle %v2int %20 %20 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_9042ab
+ 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 %textureDimensions_9042ab
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_9042ab
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl
new file mode 100644
index 0000000..a2d8666
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9042ab.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureDimensions_9042ab() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9042ab();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9042ab();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9042ab();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl
new file mode 100644
index 0000000..2872414
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+
+// fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2<i32>
+fn textureDimensions_9393b0() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9393b0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9393b0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9393b0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl
new file mode 100644
index 0000000..5faaac0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_9393b0() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_9393b0();
+ 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 samplerCube arg_0_1;
+void textureDimensions_9393b0() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_9393b0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_9393b0() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_9393b0();
+}
+
+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/textureDimensions/9393b0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.hlsl
new file mode 100644
index 0000000..452ad7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube arg_0 : register(t0, space1);
+
+void textureDimensions_9393b0() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9393b0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9393b0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9393b0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl
new file mode 100644
index 0000000..b564f16
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9393b0(depthcube<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_2) {
+ textureDimensions_9393b0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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(depthcube<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_9393b0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9393b0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm
new file mode 100644
index 0000000..e7d10e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_9393b0 "textureDimensions_9393b0"
+ OpName %arg_1 "arg_1"
+ 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 Cube 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9393b0 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v2int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_9393b0
+ 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 %textureDimensions_9393b0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_9393b0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl
new file mode 100644
index 0000000..6243a7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9393b0.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+fn textureDimensions_9393b0() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9393b0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9393b0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9393b0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl
new file mode 100644
index 0000000..9852d37
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureDimensions(texture: texture_depth_2d) -> vec2<i32>
+fn textureDimensions_939fdb() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_939fdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_939fdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_939fdb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl
new file mode 100644
index 0000000..380941e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_939fdb() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_939fdb();
+ 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 textureDimensions_939fdb() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_939fdb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_939fdb() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_939fdb();
+}
+
+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/textureDimensions/939fdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.hlsl
new file mode 100644
index 0000000..1edab80
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureDimensions_939fdb() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_939fdb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_939fdb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_939fdb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl
new file mode 100644
index 0000000..a6283fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_939fdb(depth2d<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureDimensions_939fdb(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)]]) {
+ textureDimensions_939fdb(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_939fdb(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm
new file mode 100644
index 0000000..7e41c36
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_939fdb "textureDimensions_939fdb"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_939fdb = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySizeLod %v2int %19 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_939fdb
+ 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 %textureDimensions_939fdb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_939fdb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl
new file mode 100644
index 0000000..12cc535
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/939fdb.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureDimensions_939fdb() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_939fdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_939fdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_939fdb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl
new file mode 100644
index 0000000..fddb828
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<i32>;
+
+// fn textureDimensions(texture: texture_cube<i32>) -> vec2<i32>
+fn textureDimensions_962dcd() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_962dcd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_962dcd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_962dcd();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl
new file mode 100644
index 0000000..ded4e42
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isamplerCube arg_0_1;
+void textureDimensions_962dcd() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_962dcd();
+ 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 isamplerCube arg_0_1;
+void textureDimensions_962dcd() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_962dcd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isamplerCube arg_0_1;
+void textureDimensions_962dcd() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_962dcd();
+}
+
+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/textureDimensions/962dcd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.hlsl
new file mode 100644
index 0000000..7f1c1eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_962dcd() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_962dcd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_962dcd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_962dcd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl
new file mode 100644
index 0000000..052154f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_962dcd(texturecube<int, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<int, access::sample> tint_symbol_2) {
+ textureDimensions_962dcd(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_962dcd(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_962dcd(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm
new file mode 100644
index 0000000..ceac95f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_962dcd "textureDimensions_962dcd"
+ 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 Cube 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_962dcd = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %v2int %19 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_962dcd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_962dcd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_962dcd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl
new file mode 100644
index 0000000..8c1d256
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/962dcd.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube<i32>;
+
+fn textureDimensions_962dcd() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_962dcd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_962dcd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_962dcd();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl
new file mode 100644
index 0000000..4fea70c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba32float, write>) -> vec2<i32>
+fn textureDimensions_9abfe5() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9abfe5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9abfe5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9abfe5();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl
new file mode 100644
index 0000000..0de8c91
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_9abfe5() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_9abfe5();
+ 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 textureDimensions_9abfe5() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_9abfe5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_9abfe5() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_9abfe5();
+}
+
+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/textureDimensions/9abfe5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.hlsl
new file mode 100644
index 0000000..d97dcf7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_9abfe5() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9abfe5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9abfe5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9abfe5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl
new file mode 100644
index 0000000..cc19962
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9abfe5(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureDimensions_9abfe5(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)]]) {
+ textureDimensions_9abfe5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9abfe5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm
new file mode 100644
index 0000000..6a733e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_9abfe5 "textureDimensions_9abfe5"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9abfe5 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_9abfe5
+ 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 %textureDimensions_9abfe5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_9abfe5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl
new file mode 100644
index 0000000..fd97994
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9abfe5.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureDimensions_9abfe5() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9abfe5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9abfe5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9abfe5();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl
new file mode 100644
index 0000000..d04579d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureDimensions(texture: texture_2d_array<i32>, level: i32) -> vec2<i32>
+fn textureDimensions_9c9c57() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9c9c57();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9c9c57();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9c9c57();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl
new file mode 100644
index 0000000..09beab3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureDimensions_9c9c57() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_9c9c57();
+ 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 textureDimensions_9c9c57() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_9c9c57();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureDimensions_9c9c57() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_9c9c57();
+}
+
+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/textureDimensions/9c9c57.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.hlsl
new file mode 100644
index 0000000..31b75d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_9c9c57() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9c9c57();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9c9c57();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9c9c57();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl
new file mode 100644
index 0000000..97807b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9c9c57(texture2d_array<int, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureDimensions_9c9c57(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)]]) {
+ textureDimensions_9c9c57(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9c9c57(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm
new file mode 100644
index 0000000..f00858a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_9c9c57 "textureDimensions_9c9c57"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %28 = OpConstantNull %v2int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9c9c57 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %28
+ OpStore %arg_1 %17
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %22 = OpImageQuerySizeLod %v3int %24 %25
+ %20 = OpVectorShuffle %v2int %22 %22 0 1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_9c9c57
+ 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 %textureDimensions_9c9c57
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureDimensions_9c9c57
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl
new file mode 100644
index 0000000..dd5cf5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9c9c57.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureDimensions_9c9c57() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9c9c57();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9c9c57();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9c9c57();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl
new file mode 100644
index 0000000..05e9f02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8sint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba8sint, write>) -> i32
+fn textureDimensions_9da9e2() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9da9e2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9da9e2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9da9e2();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl
new file mode 100644
index 0000000..5773b40
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_9da9e2() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_9da9e2();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_9da9e2() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_9da9e2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_9da9e2() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_9da9e2();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl
new file mode 100644
index 0000000..f500491b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_9da9e2() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9da9e2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9da9e2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9da9e2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl
new file mode 100644
index 0000000..ea085fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9da9e2(texture1d<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureDimensions_9da9e2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_9da9e2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9da9e2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm
new file mode 100644
index 0000000..edaecfe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_9da9e2 "textureDimensions_9da9e2"
+ 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 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 1D 0 0 0 2 Rgba8i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9da9e2 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_9da9e2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_9da9e2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_9da9e2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl
new file mode 100644
index 0000000..3e1f941
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9da9e2.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8sint, write>;
+
+fn textureDimensions_9da9e2() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9da9e2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9da9e2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9da9e2();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl
new file mode 100644
index 0000000..8a3f461
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<r32uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<r32uint, write>) -> vec2<i32>
+fn textureDimensions_9eb8d8() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9eb8d8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9eb8d8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9eb8d8();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl
new file mode 100644
index 0000000..6185ef1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_9eb8d8() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_9eb8d8();
+ 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 uimage2D arg_0;
+void textureDimensions_9eb8d8() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_9eb8d8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_9eb8d8() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_9eb8d8();
+}
+
+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/textureDimensions/9eb8d8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.hlsl
new file mode 100644
index 0000000..cf18843
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_9eb8d8() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9eb8d8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9eb8d8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9eb8d8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl
new file mode 100644
index 0000000..140c2af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9eb8d8(texture2d<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureDimensions_9eb8d8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_9eb8d8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9eb8d8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm
new file mode 100644
index 0000000..b450c7b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_9eb8d8 "textureDimensions_9eb8d8"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9eb8d8 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_9eb8d8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_9eb8d8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_9eb8d8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl
new file mode 100644
index 0000000..58bc54f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9eb8d8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<r32uint, write>;
+
+fn textureDimensions_9eb8d8() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9eb8d8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9eb8d8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9eb8d8();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl
new file mode 100644
index 0000000..c2caccf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureDimensions(texture: texture_2d<f32>) -> vec2<i32>
+fn textureDimensions_9f8e46() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9f8e46();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9f8e46();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9f8e46();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl
new file mode 100644
index 0000000..a292ec4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_9f8e46() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_9f8e46();
+ 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 textureDimensions_9f8e46() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_9f8e46();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_9f8e46() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_9f8e46();
+}
+
+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/textureDimensions/9f8e46.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.hlsl
new file mode 100644
index 0000000..384fdc3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_9f8e46() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_9f8e46();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_9f8e46();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_9f8e46();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl
new file mode 100644
index 0000000..b7097a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_9f8e46(texture2d<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureDimensions_9f8e46(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)]]) {
+ textureDimensions_9f8e46(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_9f8e46(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm
new file mode 100644
index 0000000..9fabd6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_9f8e46 "textureDimensions_9f8e46"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_9f8e46 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySizeLod %v2int %19 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_9f8e46
+ 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 %textureDimensions_9f8e46
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_9f8e46
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl
new file mode 100644
index 0000000..df7b1a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/9f8e46.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureDimensions_9f8e46() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_9f8e46();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_9f8e46();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_9f8e46();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl
new file mode 100644
index 0000000..00aa1e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+
+// fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2<i32>
+fn textureDimensions_a01845() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a01845();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a01845();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a01845();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl
new file mode 100644
index 0000000..283779e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureDimensions_a01845() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_a01845();
+ 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_0_1;
+void textureDimensions_a01845() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_a01845();
+}
+
+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_0_1;
+void textureDimensions_a01845() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_a01845();
+}
+
+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/textureDimensions/a01845.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.hlsl
new file mode 100644
index 0000000..3fcaee8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray arg_0 : register(t0, space1);
+
+void textureDimensions_a01845() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_a01845();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_a01845();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_a01845();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl
new file mode 100644
index 0000000..a386075
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_a01845(depthcube_array<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_a01845(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_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(depthcube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_a01845(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_a01845(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm
new file mode 100644
index 0000000..8f49c1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_a01845 "textureDimensions_a01845"
+ OpName %arg_1 "arg_1"
+ 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 Cube 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %28 = OpConstantNull %v2int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_a01845 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %28
+ OpStore %arg_1 %17
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %22 = OpImageQuerySizeLod %v3int %24 %25
+ %20 = OpVectorShuffle %v2int %22 %22 0 1
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_a01845
+ 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 %textureDimensions_a01845
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureDimensions_a01845
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl
new file mode 100644
index 0000000..70d0b72
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a01845.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+fn textureDimensions_a01845() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a01845();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a01845();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a01845();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl
new file mode 100644
index 0000000..2559f77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureDimensions(texture: texture_1d<u32>) -> i32
+fn textureDimensions_a7d565() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a7d565();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a7d565();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a7d565();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl
new file mode 100644
index 0000000..24152c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureDimensions_a7d565() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_a7d565();
+ 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 textureDimensions_a7d565() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_a7d565();
+}
+
+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 textureDimensions_a7d565() {
+ int res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_a7d565();
+}
+
+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/textureDimensions/a7d565.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.hlsl
new file mode 100644
index 0000000..949e8b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_a7d565() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_a7d565();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_a7d565();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_a7d565();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl
new file mode 100644
index 0000000..aef8670
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_a7d565(texture1d<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureDimensions_a7d565(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)]]) {
+ textureDimensions_a7d565(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_a7d565(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm
new file mode 100644
index 0000000..1694f88
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_a7d565 "textureDimensions_a7d565"
+ 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_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_a7d565 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %int %19 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_a7d565
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_a7d565
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_a7d565
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl
new file mode 100644
index 0000000..4cd2c97
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a7d565.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureDimensions_a7d565() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a7d565();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a7d565();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a7d565();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl
new file mode 100644
index 0000000..d88716e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<r32float, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<r32float, write>) -> i32
+fn textureDimensions_a863f2() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a863f2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a863f2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a863f2();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl
new file mode 100644
index 0000000..b157dd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(r32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_a863f2() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_a863f2();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(r32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_a863f2() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_a863f2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(r32f) uniform highp writeonly image1D arg_0;
+void textureDimensions_a863f2() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_a863f2();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl
new file mode 100644
index 0000000..212bbca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_a863f2() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_a863f2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_a863f2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_a863f2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl
new file mode 100644
index 0000000..583342b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_a863f2(texture1d<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureDimensions_a863f2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_a863f2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_a863f2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm
new file mode 100644
index 0000000..9e5a66a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_a863f2 "textureDimensions_a863f2"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_a863f2 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_a863f2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_a863f2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_a863f2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl
new file mode 100644
index 0000000..257be4e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a863f2.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<r32float, write>;
+
+fn textureDimensions_a863f2() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a863f2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a863f2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a863f2();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl
new file mode 100644
index 0000000..7dac118
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+
+// fn textureDimensions(texture: texture_cube<f32>, level: i32) -> vec2<i32>
+fn textureDimensions_a9c9c1() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a9c9c1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a9c9c1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a9c9c1();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl
new file mode 100644
index 0000000..2ed5a55
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_a9c9c1() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_a9c9c1();
+ 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 samplerCube arg_0_1;
+void textureDimensions_a9c9c1() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_a9c9c1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_a9c9c1() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_a9c9c1();
+}
+
+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/textureDimensions/a9c9c1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.hlsl
new file mode 100644
index 0000000..d7f1f25
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_a9c9c1() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_a9c9c1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_a9c9c1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_a9c9c1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl
new file mode 100644
index 0000000..63ccb1a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_a9c9c1(texturecube<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_2) {
+ textureDimensions_a9c9c1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_a9c9c1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_a9c9c1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm
new file mode 100644
index 0000000..11c075c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_a9c9c1 "textureDimensions_a9c9c1"
+ OpName %arg_1 "arg_1"
+ 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 Cube 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_a9c9c1 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v2int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_a9c9c1
+ 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 %textureDimensions_a9c9c1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_a9c9c1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl
new file mode 100644
index 0000000..4532c17
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/a9c9c1.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+fn textureDimensions_a9c9c1() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_a9c9c1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_a9c9c1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_a9c9c1();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl
new file mode 100644
index 0000000..ff16fe8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureDimensions(texture: texture_2d<i32>, level: i32) -> vec2<i32>
+fn textureDimensions_b0e16d() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b0e16d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b0e16d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b0e16d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl
new file mode 100644
index 0000000..08c8f51
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureDimensions_b0e16d() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_b0e16d();
+ 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 textureDimensions_b0e16d() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_b0e16d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureDimensions_b0e16d() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_b0e16d();
+}
+
+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/textureDimensions/b0e16d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.hlsl
new file mode 100644
index 0000000..6cdc838
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_b0e16d() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_b0e16d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_b0e16d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_b0e16d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl
new file mode 100644
index 0000000..fe9454a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_b0e16d(texture2d<int, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureDimensions_b0e16d(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)]]) {
+ textureDimensions_b0e16d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_b0e16d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm
new file mode 100644
index 0000000..b8b73a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_b0e16d "textureDimensions_b0e16d"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %26 = OpConstantNull %v2int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_b0e16d = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v2int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v2int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_b0e16d
+ 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 %textureDimensions_b0e16d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_b0e16d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl
new file mode 100644
index 0000000..fd73808
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b0e16d.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureDimensions_b0e16d() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b0e16d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b0e16d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b0e16d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl
new file mode 100644
index 0000000..2fb0e3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<u32>;
+
+// fn textureDimensions(texture: texture_cube<u32>) -> vec2<i32>
+fn textureDimensions_b3c954() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b3c954();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b3c954();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b3c954();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl
new file mode 100644
index 0000000..855349f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usamplerCube arg_0_1;
+void textureDimensions_b3c954() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_b3c954();
+ 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 usamplerCube arg_0_1;
+void textureDimensions_b3c954() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_b3c954();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usamplerCube arg_0_1;
+void textureDimensions_b3c954() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_b3c954();
+}
+
+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/textureDimensions/b3c954.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.hlsl
new file mode 100644
index 0000000..f0d031d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_b3c954() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_b3c954();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_b3c954();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_b3c954();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl
new file mode 100644
index 0000000..33fc09a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_b3c954(texturecube<uint, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<uint, access::sample> tint_symbol_2) {
+ textureDimensions_b3c954(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_b3c954(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_b3c954(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm
new file mode 100644
index 0000000..f8a392c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_b3c954 "textureDimensions_b3c954"
+ 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 Cube 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_b3c954 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %v2int %20 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_b3c954
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_b3c954
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_b3c954
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl
new file mode 100644
index 0000000..de3b872
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3c954.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube<u32>;
+
+fn textureDimensions_b3c954() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b3c954();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b3c954();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b3c954();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl
new file mode 100644
index 0000000..5b88cd2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureDimensions(texture: texture_1d<f32>, level: i32) -> i32
+fn textureDimensions_b3e407() {
+ var arg_1 = 0;
+ var res: i32 = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b3e407();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b3e407();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b3e407();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl
new file mode 100644
index 0000000..0191881
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureDimensions_b3e407() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_b3e407();
+ 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 textureDimensions_b3e407() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_b3e407();
+}
+
+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 textureDimensions_b3e407() {
+ int arg_1 = 0;
+ int res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_b3e407();
+}
+
+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/textureDimensions/b3e407.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.hlsl
new file mode 100644
index 0000000..035c05f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_b3e407() {
+ int arg_1 = 0;
+ int2 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_b3e407();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_b3e407();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_b3e407();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl
new file mode 100644
index 0000000..bd1261a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_b3e407(texture1d<float, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureDimensions_b3e407(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)]]) {
+ textureDimensions_b3e407(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_b3e407(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm
new file mode 100644
index 0000000..fdc21d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_b3e407 "textureDimensions_b3e407"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_b3e407 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_int Function %17
+ OpStore %arg_1 %17
+ %21 = OpLoad %11 %arg_0
+ %22 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %int %21 %22
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_b3e407
+ 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 %textureDimensions_b3e407
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_b3e407
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl
new file mode 100644
index 0000000..6e09c13
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b3e407.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureDimensions_b3e407() {
+ var arg_1 = 0;
+ var res : i32 = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b3e407();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b3e407();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b3e407();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl
new file mode 100644
index 0000000..df6cccb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8snorm, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba8snorm, write>) -> vec2<i32>
+fn textureDimensions_b91240() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b91240();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b91240();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b91240();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl
new file mode 100644
index 0000000..3976de3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2D arg_0;
+void textureDimensions_b91240() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_b91240();
+ 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 image2D arg_0;
+void textureDimensions_b91240() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_b91240();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2D arg_0;
+void textureDimensions_b91240() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_b91240();
+}
+
+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/textureDimensions/b91240.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.hlsl
new file mode 100644
index 0000000..7f3c930
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_b91240() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_b91240();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_b91240();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_b91240();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl
new file mode 100644
index 0000000..ee84ff1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_b91240(texture2d<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureDimensions_b91240(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_b91240(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_b91240(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm
new file mode 100644
index 0000000..a0757e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_b91240 "textureDimensions_b91240"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_b91240 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_b91240
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_b91240
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_b91240
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl
new file mode 100644
index 0000000..105338f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/b91240.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8snorm, write>;
+
+fn textureDimensions_b91240() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_b91240();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_b91240();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_b91240();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl
new file mode 100644
index 0000000..1cb0abe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_external;
+
+// fn textureDimensions(texture: texture_external) -> vec2<i32>
+fn textureDimensions_ba1481() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_ba1481();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_ba1481();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_ba1481();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl
new file mode 100644
index 0000000..25eab78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.glsl
@@ -0,0 +1,133 @@
+#version 310 es
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 2) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_ba1481() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_ba1481();
+ 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;
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 2) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_ba1481() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_ba1481();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 2) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+uniform highp sampler2D arg_0_1;
+void textureDimensions_ba1481() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_ba1481();
+}
+
+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/textureDimensions/ba1481.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.hlsl
new file mode 100644
index 0000000..1761c017
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.hlsl
@@ -0,0 +1,38 @@
+Texture2D<float4> ext_tex_plane_1 : register(t1, space1);
+cbuffer cbuffer_ext_tex_params : register(b2, space1) {
+ uint4 ext_tex_params[11];
+};
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_ba1481() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_ba1481();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_ba1481();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_ba1481();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl
new file mode 100644
index 0000000..cf84f15
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.msl
@@ -0,0 +1,52 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ float3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ float3x3 gamutConversionMatrix;
+};
+
+void textureDimensions_ba1481(texture2d<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureDimensions_ba1481(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)]]) {
+ textureDimensions_ba1481(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_ba1481(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm
new file mode 100644
index 0000000..c0f550a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.spvasm
@@ -0,0 +1,125 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %ext_tex_plane_1 "ext_tex_plane_1"
+ OpName %ExternalTextureParams "ExternalTextureParams"
+ OpMemberName %ExternalTextureParams 0 "numPlanes"
+ OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix"
+ OpMemberName %ExternalTextureParams 2 "gammaDecodeParams"
+ OpName %GammaTransferParams "GammaTransferParams"
+ OpMemberName %GammaTransferParams 0 "G"
+ OpMemberName %GammaTransferParams 1 "A"
+ OpMemberName %GammaTransferParams 2 "B"
+ OpMemberName %GammaTransferParams 3 "C"
+ OpMemberName %GammaTransferParams 4 "D"
+ OpMemberName %GammaTransferParams 5 "E"
+ OpMemberName %GammaTransferParams 6 "F"
+ OpMemberName %GammaTransferParams 7 "padding"
+ OpMemberName %ExternalTextureParams 3 "gammaEncodeParams"
+ OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix"
+ OpName %ext_tex_params "ext_tex_params"
+ OpName %arg_0 "arg_0"
+ OpName %textureDimensions_ba1481 "textureDimensions_ba1481"
+ 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 %ext_tex_plane_1 DescriptorSet 1
+ OpDecorate %ext_tex_plane_1 Binding 1
+ OpDecorate %ExternalTextureParams Block
+ OpMemberDecorate %ExternalTextureParams 0 Offset 0
+ OpMemberDecorate %ExternalTextureParams 1 Offset 16
+ OpMemberDecorate %ExternalTextureParams 1 ColMajor
+ OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16
+ OpMemberDecorate %ExternalTextureParams 2 Offset 64
+ OpMemberDecorate %GammaTransferParams 0 Offset 0
+ OpMemberDecorate %GammaTransferParams 1 Offset 4
+ OpMemberDecorate %GammaTransferParams 2 Offset 8
+ OpMemberDecorate %GammaTransferParams 3 Offset 12
+ OpMemberDecorate %GammaTransferParams 4 Offset 16
+ OpMemberDecorate %GammaTransferParams 5 Offset 20
+ OpMemberDecorate %GammaTransferParams 6 Offset 24
+ OpMemberDecorate %GammaTransferParams 7 Offset 28
+ OpMemberDecorate %ExternalTextureParams 3 Offset 96
+ OpMemberDecorate %ExternalTextureParams 4 Offset 128
+ OpMemberDecorate %ExternalTextureParams 4 ColMajor
+ OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16
+ OpDecorate %ext_tex_params NonWritable
+ OpDecorate %ext_tex_params DescriptorSet 1
+ OpDecorate %ext_tex_params Binding 2
+ 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
+%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %uint = OpTypeInt 32 0
+%mat3v4float = OpTypeMatrix %v4float 3
+%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
+ %v3float = OpTypeVector %float 3
+%mat3v3float = OpTypeMatrix %v3float 3
+%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float
+%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
+%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %21 = OpTypeFunction %void
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %32 = OpConstantNull %v2int
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_ba1481 = OpFunction %void None %21
+ %24 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %32
+ %28 = OpLoad %11 %arg_0
+ %25 = OpImageQuerySizeLod %v2int %28 %int_0
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_ba1481
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %21
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %21
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureDimensions_ba1481
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %21
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureDimensions_ba1481
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl
new file mode 100644
index 0000000..0bcf4af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ba1481.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_external;
+
+fn textureDimensions_ba1481() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_ba1481();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_ba1481();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_ba1481();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl
new file mode 100644
index 0000000..fec2488
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba32sint, write>) -> vec3<i32>
+fn textureDimensions_bb3dde() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_bb3dde();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_bb3dde();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_bb3dde();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl
new file mode 100644
index 0000000..8c5f740
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_bb3dde() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_bb3dde();
+ 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 iimage3D arg_0;
+void textureDimensions_bb3dde() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_bb3dde();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage3D arg_0;
+void textureDimensions_bb3dde() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_bb3dde();
+}
+
+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/textureDimensions/bb3dde.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.hlsl
new file mode 100644
index 0000000..48b980a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_bb3dde() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_bb3dde();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_bb3dde();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_bb3dde();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl
new file mode 100644
index 0000000..0f83742
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_bb3dde(texture3d<int, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureDimensions_bb3dde(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_bb3dde(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_bb3dde(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm
new file mode 100644
index 0000000..7d30072
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_bb3dde "textureDimensions_bb3dde"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_bb3dde = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_bb3dde
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_bb3dde
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_bb3dde
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl
new file mode 100644
index 0000000..005cae6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/bb3dde.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba32sint, write>;
+
+fn textureDimensions_bb3dde() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_bb3dde();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_bb3dde();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_bb3dde();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl
new file mode 100644
index 0000000..c5afaf3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<r32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<r32sint, write>) -> vec2<i32>
+fn textureDimensions_c30e75() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_c30e75();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_c30e75();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_c30e75();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl
new file mode 100644
index 0000000..06b6108
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_c30e75() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_c30e75();
+ 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 iimage2D arg_0;
+void textureDimensions_c30e75() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_c30e75();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2D arg_0;
+void textureDimensions_c30e75() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_c30e75();
+}
+
+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/textureDimensions/c30e75.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.hlsl
new file mode 100644
index 0000000..e4ae382
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_c30e75() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_c30e75();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_c30e75();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_c30e75();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl
new file mode 100644
index 0000000..711f4aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_c30e75(texture2d<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureDimensions_c30e75(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_c30e75(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_c30e75(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm
new file mode 100644
index 0000000..05cad7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_c30e75 "textureDimensions_c30e75"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_c30e75 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_c30e75
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_c30e75
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_c30e75
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl
new file mode 100644
index 0000000..ecf60b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c30e75.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<r32sint, write>;
+
+fn textureDimensions_c30e75() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_c30e75();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_c30e75();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_c30e75();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl
new file mode 100644
index 0000000..892ea87
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8uint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<rgba8uint, write>) -> vec2<i32>
+fn textureDimensions_c7943d() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_c7943d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_c7943d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_c7943d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl
new file mode 100644
index 0000000..ec88d6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_c7943d() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_c7943d();
+ 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 uimage2D arg_0;
+void textureDimensions_c7943d() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_c7943d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2D arg_0;
+void textureDimensions_c7943d() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_c7943d();
+}
+
+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/textureDimensions/c7943d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.hlsl
new file mode 100644
index 0000000..4b69252
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_c7943d() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_c7943d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_c7943d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_c7943d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl
new file mode 100644
index 0000000..39c32d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_c7943d(texture2d<uint, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureDimensions_c7943d(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_c7943d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_c7943d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm
new file mode 100644
index 0000000..0f1070d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_c7943d "textureDimensions_c7943d"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_c7943d = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_c7943d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_c7943d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_c7943d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl
new file mode 100644
index 0000000..d664f33
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/c7943d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8uint, write>;
+
+fn textureDimensions_c7943d() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_c7943d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_c7943d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_c7943d();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl
new file mode 100644
index 0000000..42f777f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rg32sint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rg32sint, write>) -> i32
+fn textureDimensions_cc968c() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cc968c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cc968c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cc968c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl
new file mode 100644
index 0000000..d7f3bec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage1D arg_0;
+void textureDimensions_cc968c() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_cc968c();
+ 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 iimage1D arg_0;
+void textureDimensions_cc968c() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_cc968c();
+}
+
+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 iimage1D arg_0;
+void textureDimensions_cc968c() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_cc968c();
+}
+
+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/textureDimensions/cc968c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.hlsl
new file mode 100644
index 0000000..e20e81b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_cc968c() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_cc968c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_cc968c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_cc968c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl
new file mode 100644
index 0000000..2a4db09
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_cc968c(texture1d<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureDimensions_cc968c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_cc968c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_cc968c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm
new file mode 100644
index 0000000..21f2dd1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_cc968c "textureDimensions_cc968c"
+ 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 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 1D 0 0 0 2 Rg32i
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_cc968c = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_cc968c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_cc968c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_cc968c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl
new file mode 100644
index 0000000..8198585
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cc968c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rg32sint, write>;
+
+fn textureDimensions_cc968c() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cc968c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cc968c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cc968c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl
new file mode 100644
index 0000000..b320e91
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8snorm, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba8snorm, write>) -> i32
+fn textureDimensions_cccc8f() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cccc8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cccc8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cccc8f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl
new file mode 100644
index 0000000..8ea9b9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image1D arg_0;
+void textureDimensions_cccc8f() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_cccc8f();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8_snorm) uniform highp writeonly image1D arg_0;
+void textureDimensions_cccc8f() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_cccc8f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image1D arg_0;
+void textureDimensions_cccc8f() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_cccc8f();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl
new file mode 100644
index 0000000..8030a26
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_cccc8f() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_cccc8f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_cccc8f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_cccc8f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl
new file mode 100644
index 0000000..f03ce0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_cccc8f(texture1d<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureDimensions_cccc8f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_cccc8f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_cccc8f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm
new file mode 100644
index 0000000..ae7cb8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_cccc8f "textureDimensions_cccc8f"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_cccc8f = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureDimensions_cccc8f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureDimensions_cccc8f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_cccc8f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl
new file mode 100644
index 0000000..a4d44f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cccc8f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8snorm, write>;
+
+fn textureDimensions_cccc8f() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cccc8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cccc8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cccc8f();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl
new file mode 100644
index 0000000..8959a17
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8unorm, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba8unorm, write>) -> vec3<i32>
+fn textureDimensions_cd76a7() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cd76a7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cd76a7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cd76a7();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl
new file mode 100644
index 0000000..92b0dae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image3D arg_0;
+void textureDimensions_cd76a7() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_cd76a7();
+ 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 image3D arg_0;
+void textureDimensions_cd76a7() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_cd76a7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image3D arg_0;
+void textureDimensions_cd76a7() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_cd76a7();
+}
+
+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/textureDimensions/cd76a7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.hlsl
new file mode 100644
index 0000000..107e7e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_cd76a7() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_cd76a7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_cd76a7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_cd76a7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl
new file mode 100644
index 0000000..14b141a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_cd76a7(texture3d<float, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureDimensions_cd76a7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_cd76a7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_cd76a7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm
new file mode 100644
index 0000000..6d33337
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_cd76a7 "textureDimensions_cd76a7"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_cd76a7 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v3int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_cd76a7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_cd76a7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_cd76a7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl
new file mode 100644
index 0000000..139070f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cd76a7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8unorm, write>;
+
+fn textureDimensions_cd76a7() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cd76a7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cd76a7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cd76a7();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl
new file mode 100644
index 0000000..3eb0f09
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16sint, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rgba16sint, write>) -> vec2<i32>
+fn textureDimensions_cdf473() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cdf473();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cdf473();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cdf473();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl
new file mode 100644
index 0000000..ea5fe7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_cdf473() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_cdf473();
+ 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 textureDimensions_cdf473() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_cdf473();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureDimensions_cdf473() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_cdf473();
+}
+
+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/textureDimensions/cdf473.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.hlsl
new file mode 100644
index 0000000..895f7d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureDimensions_cdf473() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_cdf473();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_cdf473();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_cdf473();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl
new file mode 100644
index 0000000..fa50285
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_cdf473(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureDimensions_cdf473(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)]]) {
+ textureDimensions_cdf473(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_cdf473(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm
new file mode 100644
index 0000000..30caae8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_cdf473 "textureDimensions_cdf473"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_cdf473 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_cdf473
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureDimensions_cdf473
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_cdf473
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl
new file mode 100644
index 0000000..31373c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cdf473.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureDimensions_cdf473() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cdf473();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cdf473();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cdf473();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl
new file mode 100644
index 0000000..abd76b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureDimensions(texture: texture_2d_array<f32>) -> vec2<i32>
+fn textureDimensions_cec841() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cec841();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cec841();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cec841();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl
new file mode 100644
index 0000000..6c4ff13
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_cec841() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_cec841();
+ 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 textureDimensions_cec841() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_cec841();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureDimensions_cec841() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_cec841();
+}
+
+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/textureDimensions/cec841.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.hlsl
new file mode 100644
index 0000000..8b892fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_cec841() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_cec841();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_cec841();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_cec841();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl
new file mode 100644
index 0000000..7c0b4ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_cec841(texture2d_array<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureDimensions_cec841(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)]]) {
+ textureDimensions_cec841(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_cec841(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm
new file mode 100644
index 0000000..34eb8ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_cec841 "textureDimensions_cec841"
+ 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_cec841 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_cec841
+ 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 %textureDimensions_cec841
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_cec841
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl
new file mode 100644
index 0000000..d1667a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cec841.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureDimensions_cec841() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cec841();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cec841();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cec841();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl
new file mode 100644
index 0000000..8faa148
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8snorm, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba8snorm, write>) -> vec3<i32>
+fn textureDimensions_cf7e43() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cf7e43();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cf7e43();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cf7e43();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl
new file mode 100644
index 0000000..8b491fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image3D arg_0;
+void textureDimensions_cf7e43() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_cf7e43();
+ 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 image3D arg_0;
+void textureDimensions_cf7e43() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_cf7e43();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image3D arg_0;
+void textureDimensions_cf7e43() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_cf7e43();
+}
+
+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/textureDimensions/cf7e43.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.hlsl
new file mode 100644
index 0000000..f8b6211
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_cf7e43() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_cf7e43();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_cf7e43();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_cf7e43();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl
new file mode 100644
index 0000000..2103642
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_cf7e43(texture3d<float, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureDimensions_cf7e43(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_cf7e43(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_cf7e43(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm
new file mode 100644
index 0000000..62a64df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_cf7e43 "textureDimensions_cf7e43"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %22 = OpConstantNull %v3int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_cf7e43 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v3int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_cf7e43
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_cf7e43
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_cf7e43
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl
new file mode 100644
index 0000000..fd5550b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/cf7e43.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8snorm, write>;
+
+fn textureDimensions_cf7e43() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_cf7e43();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_cf7e43();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_cf7e43();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl
new file mode 100644
index 0000000..62a607f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+
+// fn textureDimensions(texture: texture_cube<f32>) -> vec2<i32>
+fn textureDimensions_d125bc() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_d125bc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_d125bc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_d125bc();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl
new file mode 100644
index 0000000..0debada
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_d125bc() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_d125bc();
+ 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 samplerCube arg_0_1;
+void textureDimensions_d125bc() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_d125bc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureDimensions_d125bc() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_d125bc();
+}
+
+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/textureDimensions/d125bc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.hlsl
new file mode 100644
index 0000000..bf2c107
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_d125bc() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_d125bc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_d125bc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_d125bc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl
new file mode 100644
index 0000000..67f0abc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_d125bc(texturecube<float, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_2) {
+ textureDimensions_d125bc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_d125bc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_d125bc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm
new file mode 100644
index 0000000..3d3b32a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_d125bc "textureDimensions_d125bc"
+ 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 Cube 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_d125bc = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySizeLod %v2int %19 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_d125bc
+ 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 %textureDimensions_d125bc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_d125bc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl
new file mode 100644
index 0000000..e8b2c56
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d125bc.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+fn textureDimensions_d125bc() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_d125bc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_d125bc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_d125bc();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl
new file mode 100644
index 0000000..4626578
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<u32>;
+
+// fn textureDimensions(texture: texture_cube_array<u32>, level: i32) -> vec2<i32>
+fn textureDimensions_d83c45() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_d83c45();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_d83c45();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_d83c45();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl
new file mode 100644
index 0000000..7264f8b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_0_1;
+void textureDimensions_d83c45() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_d83c45();
+ 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_0_1;
+void textureDimensions_d83c45() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void fragment_main() {
+ textureDimensions_d83c45();
+}
+
+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_0_1;
+void textureDimensions_d83c45() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1).xy;
+}
+
+void compute_main() {
+ textureDimensions_d83c45();
+}
+
+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/textureDimensions/d83c45.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.hlsl
new file mode 100644
index 0000000..5ccc18c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_d83c45() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_d83c45();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_d83c45();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_d83c45();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl
new file mode 100644
index 0000000..15239da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_d83c45(texturecube_array<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_2) {
+ textureDimensions_d83c45(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_d83c45(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_d83c45(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm
new file mode 100644
index 0000000..8aa6e79
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_d83c45 "textureDimensions_d83c45"
+ OpName %arg_1 "arg_1"
+ 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 Cube 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
+ %18 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %29 = OpConstantNull %v2int
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_d83c45 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %18
+ %res = OpVariable %_ptr_Function_v2int Function %29
+ OpStore %arg_1 %18
+ %25 = OpLoad %11 %arg_0
+ %26 = OpLoad %int %arg_1
+ %23 = OpImageQuerySizeLod %v3int %25 %26
+ %21 = OpVectorShuffle %v2int %23 %23 0 1
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_d83c45
+ 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 %textureDimensions_d83c45
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureDimensions_d83c45
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl
new file mode 100644
index 0000000..a0186f6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/d83c45.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<u32>;
+
+fn textureDimensions_d83c45() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_d83c45();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_d83c45();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_d83c45();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl
new file mode 100644
index 0000000..9d66ada
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<i32>;
+
+// fn textureDimensions(texture: texture_multisampled_2d<i32>) -> vec2<i32>
+fn textureDimensions_daf7c0() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_daf7c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_daf7c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_daf7c0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl
new file mode 100644
index 0000000..5cfbb47
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureDimensions_daf7c0() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_daf7c0();
+ 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 textureDimensions_daf7c0() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void fragment_main() {
+ textureDimensions_daf7c0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureDimensions_daf7c0() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void compute_main() {
+ textureDimensions_daf7c0();
+}
+
+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/textureDimensions/daf7c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.hlsl
new file mode 100644
index 0000000..b44a6b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_daf7c0() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_daf7c0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_daf7c0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_daf7c0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl
new file mode 100644
index 0000000..9f811af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_daf7c0(texture2d_ms<int, access::read> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<int, access::read> tint_symbol_2) {
+ textureDimensions_daf7c0(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)]]) {
+ textureDimensions_daf7c0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_daf7c0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm
new file mode 100644
index 0000000..05b6fe7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_daf7c0 "textureDimensions_daf7c0"
+ 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_daf7c0 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v2int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_daf7c0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_daf7c0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_daf7c0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl
new file mode 100644
index 0000000..6d2fbeb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/daf7c0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureDimensions_daf7c0() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_daf7c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_daf7c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_daf7c0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl
new file mode 100644
index 0000000..dd28eb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8uint, write>;
+
+// fn textureDimensions(texture: texture_storage_1d<rgba8uint, write>) -> i32
+fn textureDimensions_dc2dd0() {
+ var res: i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_dc2dd0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_dc2dd0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_dc2dd0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl
new file mode 100644
index 0000000..3d7ac14
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_dc2dd0() {
+ int res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_dc2dd0();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_dc2dd0() {
+ int res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_dc2dd0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage1D arg_0;
+void textureDimensions_dc2dd0() {
+ int res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_dc2dd0();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl
new file mode 100644
index 0000000..20e9146
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_dc2dd0() {
+ int tint_tmp;
+ arg_0.GetDimensions(tint_tmp);
+ int res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_dc2dd0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_dc2dd0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_dc2dd0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl
new file mode 100644
index 0000000..9e5082a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_dc2dd0(texture1d<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_width(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureDimensions_dc2dd0(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_dc2dd0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_dc2dd0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm
new file mode 100644
index 0000000..074de23
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ OpCapability ImageQuery
+ 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 %textureDimensions_dc2dd0 "textureDimensions_dc2dd0"
+ 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 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 1D 0 0 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_dc2dd0 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_dc2dd0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_dc2dd0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_dc2dd0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl
new file mode 100644
index 0000000..5151ae9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/dc2dd0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8uint, write>;
+
+fn textureDimensions_dc2dd0() {
+ var res : i32 = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_dc2dd0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_dc2dd0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_dc2dd0();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl
new file mode 100644
index 0000000..e711cdd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<i32>;
+
+// fn textureDimensions(texture: texture_cube_array<i32>) -> vec2<i32>
+fn textureDimensions_e927be() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_e927be();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_e927be();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_e927be();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl
new file mode 100644
index 0000000..a476da2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_0_1;
+void textureDimensions_e927be() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_e927be();
+ 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_0_1;
+void textureDimensions_e927be() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_e927be();
+}
+
+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_0_1;
+void textureDimensions_e927be() {
+ ivec2 res = textureSize(arg_0_1, 0).xy;
+}
+
+void compute_main() {
+ textureDimensions_e927be();
+}
+
+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/textureDimensions/e927be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.hlsl
new file mode 100644
index 0000000..3be868f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_e927be() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_e927be();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_e927be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_e927be();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl
new file mode 100644
index 0000000..709257f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_e927be(texturecube_array<int, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_2) {
+ textureDimensions_e927be(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_e927be(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_e927be(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm
new file mode 100644
index 0000000..021901e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureDimensions_e927be "textureDimensions_e927be"
+ 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 Cube 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %25 = OpConstantNull %v2int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_e927be = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %17 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureDimensions_e927be
+ 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 %textureDimensions_e927be
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureDimensions_e927be
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl
new file mode 100644
index 0000000..637bad6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e927be.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<i32>;
+
+fn textureDimensions_e927be() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_e927be();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_e927be();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_e927be();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl
new file mode 100644
index 0000000..41b9f1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<r32float, write>) -> vec2<i32>
+fn textureDimensions_e9e96c() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_e9e96c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_e9e96c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_e9e96c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl
new file mode 100644
index 0000000..c167c24
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_e9e96c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_e9e96c();
+ 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 textureDimensions_e9e96c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_e9e96c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_e9e96c() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_e9e96c();
+}
+
+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/textureDimensions/e9e96c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.hlsl
new file mode 100644
index 0000000..510eef8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_e9e96c() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_e9e96c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_e9e96c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_e9e96c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl
new file mode 100644
index 0000000..d512809
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_e9e96c(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureDimensions_e9e96c(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)]]) {
+ textureDimensions_e9e96c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_e9e96c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm
new file mode 100644
index 0000000..3bc1dd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_e9e96c "textureDimensions_e9e96c"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_e9e96c = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_e9e96c
+ 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 %textureDimensions_e9e96c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_e9e96c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl
new file mode 100644
index 0000000..0f84fac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/e9e96c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureDimensions_e9e96c() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_e9e96c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_e9e96c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_e9e96c();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl
new file mode 100644
index 0000000..b533d38
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<f32>;
+
+// fn textureDimensions(texture: texture_multisampled_2d<f32>) -> vec2<i32>
+fn textureDimensions_ef5b89() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_ef5b89();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_ef5b89();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_ef5b89();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl
new file mode 100644
index 0000000..c0c1d74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureDimensions_ef5b89() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_ef5b89();
+ 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 textureDimensions_ef5b89() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void fragment_main() {
+ textureDimensions_ef5b89();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureDimensions_ef5b89() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void compute_main() {
+ textureDimensions_ef5b89();
+}
+
+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/textureDimensions/ef5b89.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.hlsl
new file mode 100644
index 0000000..4bc53da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_ef5b89() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_ef5b89();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_ef5b89();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_ef5b89();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl
new file mode 100644
index 0000000..a0d18a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_ef5b89(texture2d_ms<float, access::read> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<float, access::read> tint_symbol_2) {
+ textureDimensions_ef5b89(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)]]) {
+ textureDimensions_ef5b89(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_ef5b89(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm
new file mode 100644
index 0000000..2cb1a7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_ef5b89 "textureDimensions_ef5b89"
+ 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_ef5b89 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_ef5b89
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_ef5b89
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_ef5b89
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl
new file mode 100644
index 0000000..f758962
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/ef5b89.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureDimensions_ef5b89() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_ef5b89();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_ef5b89();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_ef5b89();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl
new file mode 100644
index 0000000..3c65b12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureDimensions(texture: texture_3d<i32>, level: i32) -> vec3<i32>
+fn textureDimensions_efc8a4() {
+ var arg_1 = 0;
+ var res: vec3<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_efc8a4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_efc8a4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_efc8a4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl
new file mode 100644
index 0000000..eab90c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureDimensions_efc8a4() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_efc8a4();
+ 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 textureDimensions_efc8a4() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_efc8a4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureDimensions_efc8a4() {
+ int arg_1 = 0;
+ ivec3 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_efc8a4();
+}
+
+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/textureDimensions/efc8a4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.hlsl
new file mode 100644
index 0000000..359fc0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_efc8a4() {
+ int arg_1 = 0;
+ int4 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int3 res = tint_tmp.xyz;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_efc8a4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_efc8a4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_efc8a4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl
new file mode 100644
index 0000000..d1ba35e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_efc8a4(texture3d<int, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int3 res = int3(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1), tint_symbol_1.get_depth(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureDimensions_efc8a4(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)]]) {
+ textureDimensions_efc8a4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_efc8a4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm
new file mode 100644
index 0000000..83fbad6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_efc8a4 "textureDimensions_efc8a4"
+ OpName %arg_1 "arg_1"
+ 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
+ %17 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %26 = OpConstantNull %v3int
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_efc8a4 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %17
+ %res = OpVariable %_ptr_Function_v3int Function %26
+ OpStore %arg_1 %17
+ %22 = OpLoad %11 %arg_0
+ %23 = OpLoad %int %arg_1
+ %20 = OpImageQuerySizeLod %v3int %22 %23
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureDimensions_efc8a4
+ 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 %textureDimensions_efc8a4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureDimensions_efc8a4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl
new file mode 100644
index 0000000..0bec181
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/efc8a4.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureDimensions_efc8a4() {
+ var arg_1 = 0;
+ var res : vec3<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_efc8a4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_efc8a4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_efc8a4();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl
new file mode 100644
index 0000000..167f39a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d;
+
+// fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2<i32>
+fn textureDimensions_f60bdb() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_f60bdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_f60bdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_f60bdb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl
new file mode 100644
index 0000000..9431956
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureDimensions_f60bdb() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_f60bdb();
+ 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 textureDimensions_f60bdb() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void fragment_main() {
+ textureDimensions_f60bdb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureDimensions_f60bdb() {
+ ivec2 res = textureSize(arg_0_1);
+}
+
+void compute_main() {
+ textureDimensions_f60bdb();
+}
+
+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/textureDimensions/f60bdb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.hlsl
new file mode 100644
index 0000000..1609032
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_f60bdb() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_f60bdb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_f60bdb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_f60bdb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl
new file mode 100644
index 0000000..1ec0626
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_f60bdb(depth2d_ms<float, access::read> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_2) {
+ textureDimensions_f60bdb(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)]]) {
+ textureDimensions_f60bdb(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_f60bdb(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm
new file mode 100644
index 0000000..e43fe0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_f60bdb "textureDimensions_f60bdb"
+ 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_f60bdb = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_f60bdb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_f60bdb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_f60bdb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl
new file mode 100644
index 0000000..04d2455
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f60bdb.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureDimensions_f60bdb() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_f60bdb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_f60bdb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_f60bdb();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl
new file mode 100644
index 0000000..b2c2685
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureDimensions(texture: texture_2d<u32>, level: i32) -> vec2<i32>
+fn textureDimensions_f7145b() {
+ var arg_1 = 0;
+ var res: vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_f7145b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_f7145b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_f7145b();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl
new file mode 100644
index 0000000..23309a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.glsl
@@ -0,0 +1,55 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureDimensions_f7145b() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+vec4 vertex_main() {
+ textureDimensions_f7145b();
+ 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 textureDimensions_f7145b() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void fragment_main() {
+ textureDimensions_f7145b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureDimensions_f7145b() {
+ int arg_1 = 0;
+ ivec2 res = textureSize(arg_0_1, arg_1);
+}
+
+void compute_main() {
+ textureDimensions_f7145b();
+}
+
+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/textureDimensions/f7145b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.hlsl
new file mode 100644
index 0000000..54d1c39
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_f7145b() {
+ int arg_1 = 0;
+ int3 tint_tmp;
+ arg_0.GetDimensions(arg_1, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_f7145b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_f7145b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_f7145b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl
new file mode 100644
index 0000000..7fff816
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_f7145b(texture2d<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 0;
+ int2 res = int2(tint_symbol_1.get_width(arg_1), tint_symbol_1.get_height(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureDimensions_f7145b(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)]]) {
+ textureDimensions_f7145b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_f7145b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm
new file mode 100644
index 0000000..cf66407
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_f7145b "textureDimensions_f7145b"
+ OpName %arg_1 "arg_1"
+ 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
+ %18 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v2int = OpTypeVector %int 2
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %27 = OpConstantNull %v2int
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_f7145b = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %18
+ %res = OpVariable %_ptr_Function_v2int Function %27
+ OpStore %arg_1 %18
+ %23 = OpLoad %11 %arg_0
+ %24 = OpLoad %int %arg_1
+ %21 = OpImageQuerySizeLod %v2int %23 %24
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureDimensions_f7145b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %34
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_f7145b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureDimensions_f7145b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl
new file mode 100644
index 0000000..0bbfb0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f7145b.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureDimensions_f7145b() {
+ var arg_1 = 0;
+ var res : vec2<i32> = textureDimensions(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_f7145b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_f7145b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_f7145b();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl
new file mode 100644
index 0000000..85c0fab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<r32float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d<r32float, write>) -> vec2<i32>
+fn textureDimensions_f931c7() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_f931c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_f931c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_f931c7();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl
new file mode 100644
index 0000000..016f679
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2D arg_0;
+void textureDimensions_f931c7() {
+ ivec2 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_f931c7();
+ 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 image2D arg_0;
+void textureDimensions_f931c7() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_f931c7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2D arg_0;
+void textureDimensions_f931c7() {
+ ivec2 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_f931c7();
+}
+
+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/textureDimensions/f931c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.hlsl
new file mode 100644
index 0000000..9e231e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_f931c7() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_f931c7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_f931c7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_f931c7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl
new file mode 100644
index 0000000..7b39e0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_f931c7(texture2d<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureDimensions_f931c7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_f931c7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_f931c7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm
new file mode 100644
index 0000000..2375b4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_f931c7 "textureDimensions_f931c7"
+ 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 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 0 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
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %22 = OpConstantNull %v2int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_f931c7 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %22
+ %19 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySize %v2int %19
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureDimensions_f931c7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureDimensions_f931c7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureDimensions_f931c7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl
new file mode 100644
index 0000000..14de15a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/f931c7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<r32float, write>;
+
+fn textureDimensions_f931c7() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_f931c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_f931c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_f931c7();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl
new file mode 100644
index 0000000..206c54e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureDimensions(texture: texture_2d<i32>) -> vec2<i32>
+fn textureDimensions_fa9859() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_fa9859();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_fa9859();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_fa9859();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl
new file mode 100644
index 0000000..d8e8370
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureDimensions_fa9859() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_fa9859();
+ 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 textureDimensions_fa9859() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void fragment_main() {
+ textureDimensions_fa9859();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureDimensions_fa9859() {
+ ivec2 res = textureSize(arg_0_1, 0);
+}
+
+void compute_main() {
+ textureDimensions_fa9859();
+}
+
+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/textureDimensions/fa9859.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.hlsl
new file mode 100644
index 0000000..4bfdddf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_fa9859() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
+ int2 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_fa9859();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_fa9859();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_fa9859();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl
new file mode 100644
index 0000000..5fca056
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_fa9859(texture2d<int, access::sample> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureDimensions_fa9859(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)]]) {
+ textureDimensions_fa9859(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_fa9859(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm
new file mode 100644
index 0000000..769c44e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_fa9859 "textureDimensions_fa9859"
+ 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %23 = OpConstantNull %v2int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_fa9859 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %23
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySizeLod %v2int %19 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_fa9859
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_fa9859
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_fa9859
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl
new file mode 100644
index 0000000..58b2bd0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fa9859.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureDimensions_fa9859() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_fa9859();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_fa9859();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_fa9859();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl
new file mode 100644
index 0000000..fcfb9cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, write>;
+
+// fn textureDimensions(texture: texture_storage_2d_array<rg32float, write>) -> vec2<i32>
+fn textureDimensions_fb5670() {
+ var res: vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_fb5670();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_fb5670();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_fb5670();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl
new file mode 100644
index 0000000..5c3bd40
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureDimensions_fb5670() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+vec4 vertex_main() {
+ textureDimensions_fb5670();
+ 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 textureDimensions_fb5670() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void fragment_main() {
+ textureDimensions_fb5670();
+}
+
+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 textureDimensions_fb5670() {
+ ivec2 res = imageSize(arg_0).xy;
+}
+
+void compute_main() {
+ textureDimensions_fb5670();
+}
+
+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/textureDimensions/fb5670.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.hlsl
new file mode 100644
index 0000000..3f6c71f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureDimensions_fb5670() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int2 res = tint_tmp.xy;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_fb5670();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_fb5670();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_fb5670();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl
new file mode 100644
index 0000000..fed740f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_fb5670(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 res = int2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureDimensions_fb5670(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)]]) {
+ textureDimensions_fb5670(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_fb5670(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm
new file mode 100644
index 0000000..c870194
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureDimensions_fb5670 "textureDimensions_fb5670"
+ 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 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+ %24 = OpConstantNull %v2int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_fb5670 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_v2int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %16 = OpVectorShuffle %v2int %19 %19 0 1
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureDimensions_fb5670
+ 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 %textureDimensions_fb5670
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureDimensions_fb5670
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl
new file mode 100644
index 0000000..79fcdb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fb5670.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureDimensions_fb5670() {
+ var res : vec2<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_fb5670();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_fb5670();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_fb5670();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl
new file mode 100644
index 0000000..7e7c4d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8uint, write>;
+
+// fn textureDimensions(texture: texture_storage_3d<rgba8uint, write>) -> vec3<i32>
+fn textureDimensions_fcac78() {
+ var res: vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_fcac78();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_fcac78();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_fcac78();
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl
new file mode 100644
index 0000000..9226dcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_fcac78() {
+ ivec3 res = imageSize(arg_0);
+}
+
+vec4 vertex_main() {
+ textureDimensions_fcac78();
+ 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 uimage3D arg_0;
+void textureDimensions_fcac78() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void fragment_main() {
+ textureDimensions_fcac78();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage3D arg_0;
+void textureDimensions_fcac78() {
+ ivec3 res = imageSize(arg_0);
+}
+
+void compute_main() {
+ textureDimensions_fcac78();
+}
+
+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/textureDimensions/fcac78.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.hlsl
new file mode 100644
index 0000000..f02946b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureDimensions_fcac78() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int3 res = tint_tmp;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureDimensions_fcac78();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureDimensions_fcac78();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_fcac78();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl
new file mode 100644
index 0000000..3c6340c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureDimensions_fcac78(texture3d<uint, access::write> tint_symbol_1) {
+ int3 res = int3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureDimensions_fcac78(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureDimensions_fcac78(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureDimensions_fcac78(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm
new file mode 100644
index 0000000..2b1c5c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureDimensions_fcac78 "textureDimensions_fcac78"
+ 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 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 3D 0 0 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
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %23 = OpConstantNull %v3int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_fcac78 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_v3int Function %23
+ %20 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySize %v3int %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureDimensions_fcac78
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureDimensions_fcac78
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureDimensions_fcac78
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd243ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureDimensions/fcac78.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8uint, write>;
+
+fn textureDimensions_fcac78() {
+ var res : vec3<i32> = textureDimensions(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureDimensions_fcac78();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureDimensions_fcac78();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureDimensions_fcac78();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl
new file mode 100644
index 0000000..3f1f968
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>) -> vec4<f32>
+fn textureGather_10c554() {
+ var arg_2 = vec3<f32>();
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_10c554();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_10c554();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_10c554();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl
new file mode 100644
index 0000000..e6f2add
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureGather_10c554() {
+ vec3 arg_2 = vec3(0.0f);
+ vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0);
+}
+
+vec4 vertex_main() {
+ textureGather_10c554();
+ 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 samplerCubeShadow arg_0_arg_1;
+
+void textureGather_10c554() {
+ vec3 arg_2 = vec3(0.0f);
+ vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0);
+}
+
+void fragment_main() {
+ textureGather_10c554();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureGather_10c554() {
+ vec3 arg_2 = vec3(0.0f);
+ vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0);
+}
+
+void compute_main() {
+ textureGather_10c554();
+}
+
+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/10c554.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.hlsl
new file mode 100644
index 0000000..eab2277
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureGather_10c554() {
+ float3 arg_2 = (0.0f).xxx;
+ float4 res = arg_0.Gather(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_10c554();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_10c554();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_10c554();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl
new file mode 100644
index 0000000..16595bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_10c554(depthcube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_10c554(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_10c554(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_10c554(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm
new file mode 100644
index 0000000..76b2553
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureGather_10c554 "textureGather_10c554"
+ 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
+ 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 0 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
+ %26 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_10c554 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ %24 = OpLoad %14 %arg_1
+ %25 = OpLoad %11 %arg_0
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v3float %arg_2
+ %23 = OpImageGather %v4float %27 %28 %int_0
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureGather_10c554
+ 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_10c554
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_10c554
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl
new file mode 100644
index 0000000..2e22217
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/10c554.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureGather_10c554() {
+ var arg_2 = vec3<f32>();
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_10c554();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_10c554();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_10c554();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl
new file mode 100644
index 0000000..e22c989
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGather_1f7f6b() {
+ var arg_2 = vec2<f32>();
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_1f7f6b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_1f7f6b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_1f7f6b();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl
new file mode 100644
index 0000000..1516248
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGather_1f7f6b() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureGather_1f7f6b();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureGather_1f7f6b() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0));
+}
+
+void fragment_main() {
+ textureGather_1f7f6b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGather_1f7f6b() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, 0.0, ivec2(0));
+}
+
+void compute_main() {
+ textureGather_1f7f6b();
+}
+
+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/1f7f6b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.hlsl
new file mode 100644
index 0000000..36412fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureGather_1f7f6b() {
+ float2 arg_2 = (0.0f).xx;
+ float4 res = arg_0.Gather(arg_1, arg_2, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_1f7f6b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1f7f6b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_1f7f6b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl
new file mode 100644
index 0000000..5219d4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_1f7f6b(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_1f7f6b(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_1f7f6b(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_1f7f6b(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm
new file mode 100644
index 0000000..d32d052
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.spvasm
@@ -0,0 +1,91 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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 %textureGather_1f7f6b "textureGather_1f7f6b"
+ 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
+ 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 0 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
+ %26 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+ %v2int = OpTypeVector %int 2
+ %32 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_1f7f6b = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ %24 = OpLoad %14 %arg_1
+ %25 = OpLoad %11 %arg_0
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v2float %arg_2
+ %23 = OpImageGather %v4float %27 %28 %int_0 ConstOffset %32
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_1f7f6b
+ 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 %textureGather_1f7f6b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_1f7f6b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl
new file mode 100644
index 0000000..b5b5663
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/1f7f6b.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureGather_1f7f6b() {
+ var arg_2 = vec2<f32>();
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_1f7f6b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_1f7f6b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_1f7f6b();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl
new file mode 100644
index 0000000..ba57f22
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_22e930() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res: vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_22e930();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_22e930();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_22e930();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl
new file mode 100644
index 0000000..af84133
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_22e930() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_22e930();
+ 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_22e930() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+void fragment_main() {
+ textureGather_22e930();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_22e930() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+void compute_main() {
+ textureGather_22e930();
+}
+
+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/22e930.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.hlsl
new file mode 100644
index 0000000..7aa31c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_22e930() {
+ 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_22e930();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_22e930();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_22e930();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl
new file mode 100644
index 0000000..d6b3f74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_22e930(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_22e930(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_22e930(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_22e930(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm
new file mode 100644
index 0000000..dce3fe0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.spvasm
@@ -0,0 +1,100 @@
+; 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_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_22e930 "textureGather_22e930"
+ 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_22e930 = 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 %int_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureGather_22e930
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureGather_22e930
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGather_22e930
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl
new file mode 100644
index 0000000..2642e65
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/22e930.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_22e930() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res : vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_22e930();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_22e930();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_22e930();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl
new file mode 100644
index 0000000..436aa74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<u32>
+fn textureGather_2cc066() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res: vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_2cc066();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_2cc066();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_2cc066();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl
new file mode 100644
index 0000000..42cedd1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_2cc066() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_2cc066();
+ 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_2cc066() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+void fragment_main() {
+ textureGather_2cc066();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_2cc066() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+void compute_main() {
+ textureGather_2cc066();
+}
+
+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/2cc066.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.hlsl
new file mode 100644
index 0000000..3d64cb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_2cc066() {
+ 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_2cc066();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_2cc066();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_2cc066();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl
new file mode 100644
index 0000000..1788324
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_2cc066(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_2cc066(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_2cc066(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_2cc066(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm
new file mode 100644
index 0000000..ba22c06
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.spvasm
@@ -0,0 +1,103 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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_2cc066 "textureGather_2cc066"
+ 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
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %44 = OpConstantNull %v4uint
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_2cc066 = 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 %44
+ 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 %int_1
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_2cc066
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGather_2cc066
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_2cc066
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl
new file mode 100644
index 0000000..a7766aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2cc066.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_2cc066() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res : vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_2cc066();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_2cc066();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_2cc066();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl
new file mode 100644
index 0000000..f678c1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
+fn textureGather_2e0ed5() {
+ var arg_2 = vec2<f32>();
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_2e0ed5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_2e0ed5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_2e0ed5();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl
new file mode 100644
index 0000000..56056ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGather_2e0ed5() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0);
+}
+
+vec4 vertex_main() {
+ textureGather_2e0ed5();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureGather_2e0ed5() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0);
+}
+
+void fragment_main() {
+ textureGather_2e0ed5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGather_2e0ed5() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureGather(arg_0_arg_1, arg_2, 0.0);
+}
+
+void compute_main() {
+ textureGather_2e0ed5();
+}
+
+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/2e0ed5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.hlsl
new file mode 100644
index 0000000..995319a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureGather_2e0ed5() {
+ float2 arg_2 = (0.0f).xx;
+ float4 res = arg_0.Gather(arg_1, arg_2);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_2e0ed5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_2e0ed5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_2e0ed5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl
new file mode 100644
index 0000000..0fafcf7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_2e0ed5(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_2e0ed5(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_2e0ed5(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_2e0ed5(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm
new file mode 100644
index 0000000..c33a890
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureGather_2e0ed5 "textureGather_2e0ed5"
+ 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
+ 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 0 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
+ %26 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_2e0ed5 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ %24 = OpLoad %14 %arg_1
+ %25 = OpLoad %11 %arg_0
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v2float %arg_2
+ %23 = OpImageGather %v4float %27 %28 %int_0
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureGather_2e0ed5
+ 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_2e0ed5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_2e0ed5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl
new file mode 100644
index 0000000..b2617bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/2e0ed5.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureGather_2e0ed5() {
+ var arg_2 = vec2<f32>();
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_2e0ed5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_2e0ed5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_2e0ed5();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl
new file mode 100644
index 0000000..981274f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>) -> vec4<f32>
+fn textureGather_32c4e8() {
+ var arg_3 = vec3<f32>();
+ var res: vec4<f32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_32c4e8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_32c4e8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_32c4e8();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl
new file mode 100644
index 0000000..aa2ae80
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp samplerCube arg_1_arg_2;
+
+void textureGather_32c4e8() {
+ vec3 arg_3 = vec3(0.0f);
+ vec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+vec4 vertex_main() {
+ textureGather_32c4e8();
+ 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 samplerCube arg_1_arg_2;
+
+void textureGather_32c4e8() {
+ vec3 arg_3 = vec3(0.0f);
+ vec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void fragment_main() {
+ textureGather_32c4e8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_1_arg_2;
+
+void textureGather_32c4e8() {
+ vec3 arg_3 = vec3(0.0f);
+ vec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void compute_main() {
+ textureGather_32c4e8();
+}
+
+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/32c4e8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.hlsl
new file mode 100644
index 0000000..6843bb1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_32c4e8() {
+ float3 arg_3 = (0.0f).xxx;
+ float4 res = arg_1.GatherGreen(arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_32c4e8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_32c4e8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_32c4e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl
new file mode 100644
index 0000000..6bcc6d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_32c4e8(texturecube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_3 = float3(0.0f);
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_32c4e8(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_32c4e8(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_32c4e8(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm
new file mode 100644
index 0000000..af17d81
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; 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_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_32c4e8 "textureGather_32c4e8"
+ 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_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 0 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
+ %26 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_32c4e8 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_3 %20
+ %24 = OpLoad %14 %arg_2
+ %25 = OpLoad %11 %arg_1
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v3float %arg_3
+ %23 = OpImageGather %v4float %27 %28 %int_1
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureGather_32c4e8
+ 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_32c4e8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_32c4e8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl
new file mode 100644
index 0000000..2578384
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/32c4e8.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_cube<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_32c4e8() {
+ var arg_3 = vec3<f32>();
+ var res : vec4<f32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_32c4e8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_32c4e8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_32c4e8();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl
new file mode 100644
index 0000000..361b66f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_cube<u32>, sampler: sampler, coords: vec3<f32>) -> vec4<u32>
+fn textureGather_3b32cc() {
+ var arg_3 = vec3<f32>();
+ var res: vec4<u32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_3b32cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_3b32cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_3b32cc();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl
new file mode 100644
index 0000000..12cba16
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usamplerCube arg_1_arg_2;
+
+void textureGather_3b32cc() {
+ vec3 arg_3 = vec3(0.0f);
+ uvec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+vec4 vertex_main() {
+ textureGather_3b32cc();
+ 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 usamplerCube arg_1_arg_2;
+
+void textureGather_3b32cc() {
+ vec3 arg_3 = vec3(0.0f);
+ uvec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void fragment_main() {
+ textureGather_3b32cc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usamplerCube arg_1_arg_2;
+
+void textureGather_3b32cc() {
+ vec3 arg_3 = vec3(0.0f);
+ uvec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void compute_main() {
+ textureGather_3b32cc();
+}
+
+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/3b32cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.hlsl
new file mode 100644
index 0000000..2845979
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_3b32cc() {
+ float3 arg_3 = (0.0f).xxx;
+ uint4 res = arg_1.GatherGreen(arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_3b32cc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_3b32cc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_3b32cc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl
new file mode 100644
index 0000000..f1dfbe5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_3b32cc(texturecube<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_3 = float3(0.0f);
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_3b32cc(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_3b32cc(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_3b32cc(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm
new file mode 100644
index 0000000..2a29791
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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_3b32cc "textureGather_3b32cc"
+ 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_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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %28 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %35 = OpConstantNull %v4uint
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_3b32cc = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %21
+ %res = OpVariable %_ptr_Function_v4uint Function %35
+ OpStore %arg_3 %21
+ %26 = OpLoad %15 %arg_2
+ %27 = OpLoad %11 %arg_1
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v3float %arg_3
+ %24 = OpImageGather %v4uint %29 %30 %int_1
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_3b32cc
+ 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_3b32cc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_3b32cc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl
new file mode 100644
index 0000000..769f417
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/3b32cc.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_cube<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_3b32cc() {
+ var arg_3 = vec3<f32>();
+ var res : vec4<u32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_3b32cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_3b32cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_3b32cc();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl
new file mode 100644
index 0000000..f17e275
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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 textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_43025d() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_43025d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_43025d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_43025d();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl
new file mode 100644
index 0000000..864a150
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureGather_43025d() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0);
+}
+
+vec4 vertex_main() {
+ textureGather_43025d();
+ 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 textureGather_43025d() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0);
+}
+
+void fragment_main() {
+ textureGather_43025d();
+}
+
+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 textureGather_43025d() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0);
+}
+
+void compute_main() {
+ textureGather_43025d();
+}
+
+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/textureGather/43025d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.hlsl
new file mode 100644
index 0000000..95e4023
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureGather_43025d() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float4 res = arg_0.Gather(arg_1, float4(arg_2, float(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_43025d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_43025d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_43025d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl
new file mode 100644
index 0000000..ed0f44a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_43025d(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_43025d(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)]]) {
+ textureGather_43025d(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)]]) {
+ textureGather_43025d(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm
new file mode 100644
index 0000000..50439ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.spvasm
@@ -0,0 +1,102 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 57
+; 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 %textureGather_43025d "textureGather_43025d"
+ 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
+ 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
+ %31 = OpTypeSampledImage %11
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_43025d = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ %29 = OpLoad %14 %arg_1
+ %30 = OpLoad %11 %arg_0
+ %32 = OpSampledImage %31 %30 %29
+ %33 = OpLoad %v3float %arg_2
+ %34 = OpCompositeExtract %float %33 0
+ %35 = OpCompositeExtract %float %33 1
+ %36 = OpCompositeExtract %float %33 2
+ %38 = OpLoad %int %arg_3
+ %37 = OpConvertSToF %float %38
+ %39 = OpCompositeConstruct %v4float %34 %35 %36 %37
+ %28 = OpImageGather %v4float %32 %39 %int_0
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_43025d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureGather_43025d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_43025d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl
new file mode 100644
index 0000000..4abc4a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/43025d.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureGather_43025d() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_43025d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_43025d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_43025d();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl
new file mode 100644
index 0000000..b72043a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_2d<u32>, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<u32>
+fn textureGather_49b07f() {
+ var arg_3 = vec2<f32>();
+ var res: vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_49b07f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_49b07f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_49b07f();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl
new file mode 100644
index 0000000..e576f45
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2D arg_1_arg_2;
+
+void textureGather_49b07f() {
+ vec2 arg_3 = vec2(0.0f);
+ uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_49b07f();
+ 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_1_arg_2;
+
+void textureGather_49b07f() {
+ vec2 arg_3 = vec2(0.0f);
+ uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+void fragment_main() {
+ textureGather_49b07f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_1_arg_2;
+
+void textureGather_49b07f() {
+ vec2 arg_3 = vec2(0.0f);
+ uvec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+void compute_main() {
+ textureGather_49b07f();
+}
+
+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/49b07f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.hlsl
new file mode 100644
index 0000000..42046f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_49b07f() {
+ float2 arg_3 = (0.0f).xx;
+ uint4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_49b07f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_49b07f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_49b07f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl
new file mode 100644
index 0000000..b83245e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_49b07f(texture2d<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_49b07f(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_49b07f(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_49b07f(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.spvasm
new file mode 100644
index 0000000..bc3d0f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/49b07f.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_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_49b07f "textureGather_49b07f"
+ 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_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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %28 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 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_49b07f = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %res = OpVariable %_ptr_Function_v4uint Function %37
+ OpStore %arg_3 %21
+ %26 = OpLoad %15 %arg_2
+ %27 = OpLoad %11 %arg_1
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v2float %arg_3
+ %24 = OpImageGather %v4uint %29 %30 %int_1 ConstOffset %34
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureGather_49b07f
+ 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_49b07f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGather_49b07f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl
new file mode 100644
index 0000000..7153c61
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/49b07f.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_2d<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_49b07f() {
+ var arg_3 = vec2<f32>();
+ var res : vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_49b07f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_49b07f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_49b07f();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl
new file mode 100644
index 0000000..8cd2108
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGather_4b8103() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res: vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_4b8103();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_4b8103();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_4b8103();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl
new file mode 100644
index 0000000..186aab2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_4b8103() {
+ 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), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_4b8103();
+ 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_4b8103() {
+ 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), 1);
+}
+
+void fragment_main() {
+ textureGather_4b8103();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_1_arg_2;
+
+void textureGather_4b8103() {
+ 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), 1);
+}
+
+void compute_main() {
+ textureGather_4b8103();
+}
+
+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/4b8103.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.hlsl
new file mode 100644
index 0000000..5016110
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_4b8103() {
+ 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_4b8103();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_4b8103();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_4b8103();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl
new file mode 100644
index 0000000..2c3b8cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_4b8103(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_4b8103(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_4b8103(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_4b8103(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.spvasm
new file mode 100644
index 0000000..6b14a08
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/4b8103.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_4b8103 "textureGather_4b8103"
+ 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
+ %v2int = OpTypeVector %int 2
+ %41 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_4b8103 = 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 %int_1 ConstOffset %41
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_4b8103
+ 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_4b8103
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_4b8103
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl
new file mode 100644
index 0000000..1fa629e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/4b8103.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_4b8103() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res : vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_4b8103();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_4b8103();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_4b8103();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl
new file mode 100644
index 0000000..3514a73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
+fn textureGather_5266da() {
+ var arg_3 = vec2<f32>();
+ var res: vec4<f32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_5266da();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_5266da();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_5266da();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl
new file mode 100644
index 0000000..33c4c0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_1_arg_2;
+
+void textureGather_5266da() {
+ vec2 arg_3 = vec2(0.0f);
+ vec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+vec4 vertex_main() {
+ textureGather_5266da();
+ 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_1_arg_2;
+
+void textureGather_5266da() {
+ vec2 arg_3 = vec2(0.0f);
+ vec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void fragment_main() {
+ textureGather_5266da();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_1_arg_2;
+
+void textureGather_5266da() {
+ vec2 arg_3 = vec2(0.0f);
+ vec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void compute_main() {
+ textureGather_5266da();
+}
+
+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/5266da.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.hlsl
new file mode 100644
index 0000000..f449a19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_5266da() {
+ float2 arg_3 = (0.0f).xx;
+ float4 res = arg_1.GatherGreen(arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_5266da();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_5266da();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_5266da();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl
new file mode 100644
index 0000000..09bd3bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_5266da(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_5266da(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_5266da(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_5266da(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm
new file mode 100644
index 0000000..b1bb4b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.spvasm
@@ -0,0 +1,89 @@
+; 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_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ OpName %textureGather_5266da "textureGather_5266da"
+ 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_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 0 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
+ %26 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_5266da = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_3 %20
+ %24 = OpLoad %14 %arg_2
+ %25 = OpLoad %11 %arg_1
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v2float %arg_3
+ %23 = OpImageGather %v4float %27 %28 %int_1
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureGather_5266da
+ 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_5266da
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_5266da
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl
new file mode 100644
index 0000000..cca1739
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5266da.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_2d<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_5266da() {
+ var arg_3 = vec2<f32>();
+ var res : vec4<f32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_5266da();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_5266da();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_5266da();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl
new file mode 100644
index 0000000..bbf18dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_cube<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_cube<i32>, sampler: sampler, coords: vec3<f32>) -> vec4<i32>
+fn textureGather_5ba85f() {
+ var arg_3 = vec3<f32>();
+ var res: vec4<i32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_5ba85f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_5ba85f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_5ba85f();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl
new file mode 100644
index 0000000..096f596
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isamplerCube arg_1_arg_2;
+
+void textureGather_5ba85f() {
+ vec3 arg_3 = vec3(0.0f);
+ ivec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+vec4 vertex_main() {
+ textureGather_5ba85f();
+ 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 isamplerCube arg_1_arg_2;
+
+void textureGather_5ba85f() {
+ vec3 arg_3 = vec3(0.0f);
+ ivec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void fragment_main() {
+ textureGather_5ba85f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isamplerCube arg_1_arg_2;
+
+void textureGather_5ba85f() {
+ vec3 arg_3 = vec3(0.0f);
+ ivec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void compute_main() {
+ textureGather_5ba85f();
+}
+
+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/5ba85f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.hlsl
new file mode 100644
index 0000000..39a0d15
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_5ba85f() {
+ float3 arg_3 = (0.0f).xxx;
+ int4 res = arg_1.GatherGreen(arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_5ba85f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_5ba85f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_5ba85f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl
new file mode 100644
index 0000000..23a45a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_5ba85f(texturecube<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_3 = float3(0.0f);
+ int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_5ba85f(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_5ba85f(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_5ba85f(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm
new file mode 100644
index 0000000..30b40eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.spvasm
@@ -0,0 +1,91 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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_5ba85f "textureGather_5ba85f"
+ 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_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 0 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
+ %v4int = OpTypeVector %int 4
+ %28 = OpTypeSampledImage %11
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %34 = OpConstantNull %v4int
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_5ba85f = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %21
+ %res = OpVariable %_ptr_Function_v4int Function %34
+ OpStore %arg_3 %21
+ %26 = OpLoad %15 %arg_2
+ %27 = OpLoad %11 %arg_1
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v3float %arg_3
+ %24 = OpImageGather %v4int %29 %30 %int_1
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_5ba85f
+ 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_5ba85f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_5ba85f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl
new file mode 100644
index 0000000..bc8269a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5ba85f.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_cube<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_5ba85f() {
+ var arg_3 = vec3<f32>();
+ var res : vec4<i32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_5ba85f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_5ba85f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_5ba85f();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl
new file mode 100644
index 0000000..13d3c92
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d<u32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_2d<u32>, sampler: sampler, coords: vec2<f32>) -> vec4<u32>
+fn textureGather_5bd491() {
+ var arg_3 = vec2<f32>();
+ var res: vec4<u32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_5bd491();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_5bd491();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_5bd491();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl
new file mode 100644
index 0000000..1cb6b09
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2D arg_1_arg_2;
+
+void textureGather_5bd491() {
+ vec2 arg_3 = vec2(0.0f);
+ uvec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+vec4 vertex_main() {
+ textureGather_5bd491();
+ 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_1_arg_2;
+
+void textureGather_5bd491() {
+ vec2 arg_3 = vec2(0.0f);
+ uvec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void fragment_main() {
+ textureGather_5bd491();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_1_arg_2;
+
+void textureGather_5bd491() {
+ vec2 arg_3 = vec2(0.0f);
+ uvec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void compute_main() {
+ textureGather_5bd491();
+}
+
+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/5bd491.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.hlsl
new file mode 100644
index 0000000..50701a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_5bd491() {
+ float2 arg_3 = (0.0f).xx;
+ uint4 res = arg_1.GatherGreen(arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_5bd491();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_5bd491();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_5bd491();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl
new file mode 100644
index 0000000..22227a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_5bd491(texture2d<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ uint4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_5bd491(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_5bd491(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_5bd491(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm
new file mode 100644
index 0000000..601e988
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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_5bd491 "textureGather_5bd491"
+ 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_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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %28 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %35 = OpConstantNull %v4uint
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_5bd491 = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %res = OpVariable %_ptr_Function_v4uint Function %35
+ OpStore %arg_3 %21
+ %26 = OpLoad %15 %arg_2
+ %27 = OpLoad %11 %arg_1
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v2float %arg_3
+ %24 = OpImageGather %v4uint %29 %30 %int_1
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureGather_5bd491
+ 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_5bd491
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_5bd491
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl
new file mode 100644
index 0000000..7e8077e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/5bd491.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_2d<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_5bd491() {
+ var arg_3 = vec2<f32>();
+ var res : vec4<u32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_5bd491();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_5bd491();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_5bd491();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl
new file mode 100644
index 0000000..4103e55
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_751f8a() {
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1;
+ var res: vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_751f8a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_751f8a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_751f8a();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl
new file mode 100644
index 0000000..17c501c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_1_arg_2;
+
+void textureGather_751f8a() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_751f8a();
+ 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_751f8a() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+void fragment_main() {
+ textureGather_751f8a();
+}
+
+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_751f8a() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ vec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+void compute_main() {
+ textureGather_751f8a();
+}
+
+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/751f8a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.hlsl
new file mode 100644
index 0000000..4b0055f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_751f8a() {
+ 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_751f8a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_751f8a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_751f8a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl
new file mode 100644
index 0000000..4b8c748
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_751f8a(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_751f8a(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_751f8a(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_751f8a(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm
new file mode 100644
index 0000000..d65968a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 56
+; 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_751f8a "textureGather_751f8a"
+ 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %42 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_751f8a = 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 %int_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %42
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureGather_751f8a
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %48
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureGather_751f8a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGather_751f8a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl
new file mode 100644
index 0000000..81f901d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/751f8a.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_751f8a() {
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1;
+ var res : vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_751f8a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_751f8a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_751f8a();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl
new file mode 100644
index 0000000..3ae2518
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_2d<i32>, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<i32>
+fn textureGather_7c3828() {
+ var arg_3 = vec2<f32>();
+ var res: vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_7c3828();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_7c3828();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_7c3828();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl
new file mode 100644
index 0000000..862ebb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2D arg_1_arg_2;
+
+void textureGather_7c3828() {
+ vec2 arg_3 = vec2(0.0f);
+ ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_7c3828();
+ 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_1_arg_2;
+
+void textureGather_7c3828() {
+ vec2 arg_3 = vec2(0.0f);
+ ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+void fragment_main() {
+ textureGather_7c3828();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_1_arg_2;
+
+void textureGather_7c3828() {
+ vec2 arg_3 = vec2(0.0f);
+ ivec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+void compute_main() {
+ textureGather_7c3828();
+}
+
+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/7c3828.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.hlsl
new file mode 100644
index 0000000..af880b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_7c3828() {
+ float2 arg_3 = (0.0f).xx;
+ int4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_7c3828();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_7c3828();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_7c3828();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl
new file mode 100644
index 0000000..9772d44
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_7c3828(texture2d<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_7c3828(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_7c3828(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_7c3828(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm
new file mode 100644
index 0000000..18f210e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.spvasm
@@ -0,0 +1,93 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; 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_7c3828 "textureGather_7c3828"
+ 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_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 0 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
+ %v4int = OpTypeVector %int 4
+ %28 = OpTypeSampledImage %11
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %33 = OpConstantNull %v2int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %36 = OpConstantNull %v4int
+ %37 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_7c3828 = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %res = OpVariable %_ptr_Function_v4int Function %36
+ OpStore %arg_3 %21
+ %26 = OpLoad %15 %arg_2
+ %27 = OpLoad %11 %arg_1
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v2float %arg_3
+ %24 = OpImageGather %v4int %29 %30 %int_1 ConstOffset %33
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %37
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureGather_7c3828
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %42 = OpLabel
+ %43 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %43
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_7c3828
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureGather_7c3828
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl
new file mode 100644
index 0000000..701c035
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/7c3828.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_2d<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_7c3828() {
+ var arg_3 = vec2<f32>();
+ var res : vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_7c3828();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_7c3828();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_7c3828();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl
new file mode 100644
index 0000000..155ef01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<i32>
+fn textureGather_8b754c() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res: vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_8b754c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_8b754c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_8b754c();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl
new file mode 100644
index 0000000..b7a690a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_8b754c() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_8b754c();
+ 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_8b754c() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+void fragment_main() {
+ textureGather_8b754c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_8b754c() {
+ vec2 arg_3 = vec2(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec3(arg_3, float(arg_4)), 1);
+}
+
+void compute_main() {
+ textureGather_8b754c();
+}
+
+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/8b754c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.hlsl
new file mode 100644
index 0000000..52dcf0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_8b754c() {
+ 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_8b754c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_8b754c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_8b754c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl
new file mode 100644
index 0000000..171f733
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_8b754c(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_8b754c(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_8b754c(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_8b754c(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.spvasm
new file mode 100644
index 0000000..09b943b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/8b754c.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_8b754c "textureGather_8b754c"
+ 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
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %43 = OpConstantNull %v4int
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_8b754c = 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 %43
+ 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 %int_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_8b754c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureGather_8b754c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_8b754c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl
new file mode 100644
index 0000000..7bcabc24
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/8b754c.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_8b754c() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res : vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_8b754c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_8b754c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_8b754c();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl
new file mode 100644
index 0000000..8d662be
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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 textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
+fn textureGather_9a6358() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_9a6358();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_9a6358();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_9a6358();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl
new file mode 100644
index 0000000..f535b11
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGather_9a6358() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0);
+}
+
+vec4 vertex_main() {
+ textureGather_9a6358();
+ 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 sampler2DArrayShadow arg_0_arg_1;
+
+void textureGather_9a6358() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0);
+}
+
+void fragment_main() {
+ textureGather_9a6358();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGather_9a6358() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0);
+}
+
+void compute_main() {
+ textureGather_9a6358();
+}
+
+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/9a6358.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.hlsl
new file mode 100644
index 0000000..00950b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureGather_9a6358() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3)));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_9a6358();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_9a6358();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_9a6358();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl
new file mode 100644
index 0000000..0b4f909
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_9a6358(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_9a6358(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)]]) {
+ textureGather_9a6358(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)]]) {
+ textureGather_9a6358(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm
new file mode 100644
index 0000000..96ae32c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.spvasm
@@ -0,0 +1,101 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureGather_9a6358 "textureGather_9a6358"
+ 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
+ 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
+ %31 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %43 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_9a6358 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ %29 = OpLoad %14 %arg_1
+ %30 = OpLoad %11 %arg_0
+ %32 = OpSampledImage %31 %30 %29
+ %34 = OpLoad %v2float %arg_2
+ %35 = OpCompositeExtract %float %34 0
+ %36 = OpCompositeExtract %float %34 1
+ %38 = OpLoad %int %arg_3
+ %37 = OpConvertSToF %float %38
+ %39 = OpCompositeConstruct %v3float %35 %36 %37
+ %28 = OpImageGather %v4float %32 %39 %int_0
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %43
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureGather_9a6358
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %48 = OpLabel
+ %49 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %49
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureGather_9a6358
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %55 = OpLabel
+ %56 = OpFunctionCall %void %textureGather_9a6358
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl
new file mode 100644
index 0000000..91e2ccd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/9a6358.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureGather_9a6358() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_9a6358();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_9a6358();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_9a6358();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl
new file mode 100644
index 0000000..754bffc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d<f32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGather_af55b3() {
+ var arg_3 = vec2<f32>();
+ var res: vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_af55b3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_af55b3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_af55b3();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl
new file mode 100644
index 0000000..ec46313
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_1_arg_2;
+
+void textureGather_af55b3() {
+ vec2 arg_3 = vec2(0.0f);
+ vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_af55b3();
+ 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_1_arg_2;
+
+void textureGather_af55b3() {
+ vec2 arg_3 = vec2(0.0f);
+ vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+void fragment_main() {
+ textureGather_af55b3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_1_arg_2;
+
+void textureGather_af55b3() {
+ vec2 arg_3 = vec2(0.0f);
+ vec4 res = textureGatherOffset(arg_1_arg_2, arg_3, ivec2(0), 1);
+}
+
+void compute_main() {
+ textureGather_af55b3();
+}
+
+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/af55b3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.hlsl
new file mode 100644
index 0000000..2cf56d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_af55b3() {
+ float2 arg_3 = (0.0f).xx;
+ float4 res = arg_1.GatherGreen(arg_2, arg_3, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_af55b3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_af55b3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_af55b3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl
new file mode 100644
index 0000000..5bdf570
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_af55b3(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_af55b3(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_af55b3(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_af55b3(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm
new file mode 100644
index 0000000..7bb9edc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.spvasm
@@ -0,0 +1,91 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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_af55b3 "textureGather_af55b3"
+ 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_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 0 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
+ %26 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+ %v2int = OpTypeVector %int 2
+ %32 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_af55b3 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_3 %20
+ %24 = OpLoad %14 %arg_2
+ %25 = OpLoad %11 %arg_1
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v2float %arg_3
+ %23 = OpImageGather %v4float %27 %28 %int_1 ConstOffset %32
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_af55b3
+ 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 %textureGather_af55b3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_af55b3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl
new file mode 100644
index 0000000..e0e56db
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/af55b3.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_2d<f32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_af55b3() {
+ var arg_3 = vec2<f32>();
+ var res : vec4<f32> = textureGather(1, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_af55b3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_af55b3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_af55b3();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl
new file mode 100644
index 0000000..a0a33cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(1) var arg_1: texture_2d<i32>;
+@group(1) @binding(2) var arg_2: sampler;
+
+// fn textureGather(@const component: i32, texture: texture_2d<i32>, sampler: sampler, coords: vec2<f32>) -> vec4<i32>
+fn textureGather_bb3ac5() {
+ var arg_3 = vec2<f32>();
+ var res: vec4<i32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_bb3ac5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_bb3ac5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_bb3ac5();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl
new file mode 100644
index 0000000..0c9b449
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2D arg_1_arg_2;
+
+void textureGather_bb3ac5() {
+ vec2 arg_3 = vec2(0.0f);
+ ivec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+vec4 vertex_main() {
+ textureGather_bb3ac5();
+ 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_1_arg_2;
+
+void textureGather_bb3ac5() {
+ vec2 arg_3 = vec2(0.0f);
+ ivec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void fragment_main() {
+ textureGather_bb3ac5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_1_arg_2;
+
+void textureGather_bb3ac5() {
+ vec2 arg_3 = vec2(0.0f);
+ ivec4 res = textureGather(arg_1_arg_2, arg_3, 1);
+}
+
+void compute_main() {
+ textureGather_bb3ac5();
+}
+
+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/bb3ac5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.hlsl
new file mode 100644
index 0000000..2f718f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_bb3ac5() {
+ float2 arg_3 = (0.0f).xx;
+ int4 res = arg_1.GatherGreen(arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_bb3ac5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_bb3ac5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_bb3ac5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl
new file mode 100644
index 0000000..99c8768
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_bb3ac5(texture2d<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_3 = float2(0.0f);
+ int4 res = tint_symbol_1.gather(tint_symbol_2, arg_3, int2(0), component::y);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_bb3ac5(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGather_bb3ac5(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGather_bb3ac5(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm
new file mode 100644
index 0000000..0d15df0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.spvasm
@@ -0,0 +1,91 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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_bb3ac5 "textureGather_bb3ac5"
+ 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_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 0 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
+ %v4int = OpTypeVector %int 4
+ %28 = OpTypeSampledImage %11
+ %int_1 = OpConstant %int 1
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %34 = OpConstantNull %v4int
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_bb3ac5 = OpFunction %void None %16
+ %19 = OpLabel
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %21
+ %res = OpVariable %_ptr_Function_v4int Function %34
+ OpStore %arg_3 %21
+ %26 = OpLoad %15 %arg_2
+ %27 = OpLoad %11 %arg_1
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v2float %arg_3
+ %24 = OpImageGather %v4int %29 %30 %int_1
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGather_bb3ac5
+ 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_bb3ac5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_bb3ac5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl
new file mode 100644
index 0000000..e7eb3e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/bb3ac5.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(1) var arg_1 : texture_2d<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_bb3ac5() {
+ var arg_3 = vec2<f32>();
+ var res : vec4<i32> = textureGather(1, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_bb3ac5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_bb3ac5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_bb3ac5();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl
new file mode 100644
index 0000000..6c23eb0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_cube_array<i32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<i32>
+fn textureGather_c0640c() {
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1;
+ var res: vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_c0640c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_c0640c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_c0640c();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl
new file mode 100644
index 0000000..a15bb75
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_1_arg_2;
+
+void textureGather_c0640c() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_c0640c();
+ 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_c0640c() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+void fragment_main() {
+ textureGather_c0640c();
+}
+
+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_c0640c() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ ivec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+void compute_main() {
+ textureGather_c0640c();
+}
+
+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/c0640c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.hlsl
new file mode 100644
index 0000000..76b208b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_c0640c() {
+ 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_c0640c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c0640c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_c0640c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl
new file mode 100644
index 0000000..9e5a33b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_c0640c(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_c0640c(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_c0640c(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_c0640c(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.spvasm
new file mode 100644
index 0000000..1a0206b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/c0640c.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_c0640c "textureGather_c0640c"
+ 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
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %43 = OpConstantNull %v4int
+ %44 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_c0640c = 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 %43
+ 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 %int_1
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %44
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGather_c0640c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %50
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %53 = OpLabel
+ %54 = OpFunctionCall %void %textureGather_c0640c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_c0640c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl
new file mode 100644
index 0000000..da3cf25
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/c0640c.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_c0640c() {
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1;
+ var res : vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_c0640c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_c0640c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_c0640c();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl
new file mode 100644
index 0000000..f6546db
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<u32>
+fn textureGather_d1f187() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res: vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d1f187();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_d1f187();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_d1f187();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl
new file mode 100644
index 0000000..cf015a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_d1f187() {
+ 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), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_d1f187();
+ 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_d1f187() {
+ 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), 1);
+}
+
+void fragment_main() {
+ textureGather_d1f187();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_1_arg_2;
+
+void textureGather_d1f187() {
+ 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), 1);
+}
+
+void compute_main() {
+ textureGather_d1f187();
+}
+
+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/d1f187.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.hlsl
new file mode 100644
index 0000000..6fdf9e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_d1f187() {
+ 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_d1f187();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_d1f187();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d1f187();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl
new file mode 100644
index 0000000..a2e3383
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_d1f187(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_d1f187(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_d1f187(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_d1f187(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm
new file mode 100644
index 0000000..f88d541
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.spvasm
@@ -0,0 +1,105 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; 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_d1f187 "textureGather_d1f187"
+ 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
+ %v2int = OpTypeVector %int 2
+ %43 = OpConstantNull %v2int
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %46 = OpConstantNull %v4uint
+ %47 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_d1f187 = 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 %46
+ 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 %int_1 ConstOffset %43
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %47
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureGather_d1f187
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %52 = OpLabel
+ %53 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %53
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGather_d1f187
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureGather_d1f187
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl
new file mode 100644
index 0000000..93aa44d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d1f187.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_d1f187() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res : vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d1f187();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_d1f187();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_d1f187();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl
new file mode 100644
index 0000000..c813243
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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 textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGather_d90605() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res: vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d90605();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_d90605();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_d90605();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl
new file mode 100644
index 0000000..698dd66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGather_d90605() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureGather_d90605();
+ 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 sampler2DArrayShadow arg_0_arg_1;
+
+void textureGather_d90605() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0));
+}
+
+void fragment_main() {
+ textureGather_d90605();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGather_d90605() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), 0.0, ivec2(0));
+}
+
+void compute_main() {
+ textureGather_d90605();
+}
+
+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/d90605.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.hlsl
new file mode 100644
index 0000000..961f7f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureGather_d90605() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float4 res = arg_0.Gather(arg_1, float3(arg_2, float(arg_3)), (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGather_d90605();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_d90605();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_d90605();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl
new file mode 100644
index 0000000..b5074d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_d90605(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float4 res = tint_symbol_1.gather(tint_symbol_2, arg_2, arg_3, int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGather_d90605(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)]]) {
+ textureGather_d90605(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)]]) {
+ textureGather_d90605(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm
new file mode 100644
index 0000000..2c1da3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.spvasm
@@ -0,0 +1,103 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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 %textureGather_d90605 "textureGather_d90605"
+ 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
+ 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
+ %31 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %int_0 = OpConstant %int 0
+ %v2int = OpTypeVector %int 2
+ %42 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_d90605 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %27
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ %29 = OpLoad %14 %arg_1
+ %30 = OpLoad %11 %arg_0
+ %32 = OpSampledImage %31 %30 %29
+ %34 = OpLoad %v2float %arg_2
+ %35 = OpCompositeExtract %float %34 0
+ %36 = OpCompositeExtract %float %34 1
+ %38 = OpLoad %int %arg_3
+ %37 = OpConvertSToF %float %38
+ %39 = OpCompositeConstruct %v3float %35 %36 %37
+ %28 = OpImageGather %v4float %32 %39 %int_0 ConstOffset %42
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_d90605
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGather_d90605
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_d90605
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl
new file mode 100644
index 0000000..be99bc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/d90605.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureGather_d90605() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res : vec4<f32> = textureGather(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_d90605();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_d90605();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_d90605();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl
new file mode 100644
index 0000000..afee045
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<i32>
+fn textureGather_e9d390() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res: vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_e9d390();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_e9d390();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_e9d390();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl
new file mode 100644
index 0000000..51dbcc1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_e9d390() {
+ 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), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_e9d390();
+ 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_e9d390() {
+ 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), 1);
+}
+
+void fragment_main() {
+ textureGather_e9d390();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_1_arg_2;
+
+void textureGather_e9d390() {
+ 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), 1);
+}
+
+void compute_main() {
+ textureGather_e9d390();
+}
+
+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/e9d390.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.hlsl
new file mode 100644
index 0000000..303164a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_e9d390() {
+ 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_e9d390();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_e9d390();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_e9d390();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl
new file mode 100644
index 0000000..6d75549
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_e9d390(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_e9d390(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_e9d390(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_e9d390(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.spvasm
new file mode 100644
index 0000000..0748d70
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e9d390.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_e9d390 "textureGather_e9d390"
+ 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
+ %v2int = OpTypeVector %int 2
+ %42 = OpConstantNull %v2int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %45 = OpConstantNull %v4int
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_e9d390 = 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 %int_1 ConstOffset %42
+ OpStore %res %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGather_e9d390
+ 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_e9d390
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureGather_e9d390
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl
new file mode 100644
index 0000000..5b73c9d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/e9d390.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_2d_array<i32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_e9d390() {
+ var arg_3 = vec2<f32>();
+ var arg_4 = 1;
+ var res : vec4<i32> = textureGather(1, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_e9d390();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_e9d390();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_e9d390();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl
new file mode 100644
index 0000000..e68bee7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, texture: texture_cube_array<u32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<u32>
+fn textureGather_f2c6e3() {
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1;
+ var res: vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_f2c6e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_f2c6e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_f2c6e3();
+}
diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl
new file mode 100644
index 0000000..0b0838a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_1_arg_2;
+
+void textureGather_f2c6e3() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+vec4 vertex_main() {
+ textureGather_f2c6e3();
+ 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_f2c6e3() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+void fragment_main() {
+ textureGather_f2c6e3();
+}
+
+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_f2c6e3() {
+ vec3 arg_3 = vec3(0.0f);
+ int arg_4 = 1;
+ uvec4 res = textureGather(arg_1_arg_2, vec4(arg_3, float(arg_4)), 1);
+}
+
+void compute_main() {
+ textureGather_f2c6e3();
+}
+
+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/f2c6e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.hlsl
new file mode 100644
index 0000000..e7b6ba8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCubeArray<uint4> arg_1 : register(t1, space1);
+SamplerState arg_2 : register(s2, space1);
+
+void textureGather_f2c6e3() {
+ 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_f2c6e3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_f2c6e3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGather_f2c6e3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl
new file mode 100644
index 0000000..088082f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGather_f2c6e3(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_f2c6e3(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_f2c6e3(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_f2c6e3(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm
new file mode 100644
index 0000000..2fba92b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.spvasm
@@ -0,0 +1,104 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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_f2c6e3 "textureGather_f2c6e3"
+ 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
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %44 = OpConstantNull %v4uint
+ %45 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureGather_f2c6e3 = 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 %44
+ 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 %int_1
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %45
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureGather_f2c6e3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %16
+ %50 = OpLabel
+ %51 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %51
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %16
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGather_f2c6e3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %16
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGather_f2c6e3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl
new file mode 100644
index 0000000..a12cb2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGather/f2c6e3.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(1) var arg_1 : texture_cube_array<u32>;
+
+@group(1) @binding(2) var arg_2 : sampler;
+
+fn textureGather_f2c6e3() {
+ var arg_3 = vec3<f32>();
+ var arg_4 = 1;
+ var res : vec4<u32> = textureGather(1, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGather_f2c6e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGather_f2c6e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGather_f2c6e3();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl
new file mode 100644
index 0000000..c4cd7b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3<f32>, depth_ref: f32) -> vec4<f32>
+fn textureGatherCompare_182fd4() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_182fd4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_182fd4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_182fd4();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl
new file mode 100644
index 0000000..af1dd4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureGatherCompare_182fd4() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ textureGatherCompare_182fd4();
+ 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 samplerCubeShadow arg_0_arg_1;
+
+void textureGatherCompare_182fd4() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureGatherCompare_182fd4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureGatherCompare_182fd4() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ textureGatherCompare_182fd4();
+}
+
+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/textureGatherCompare/182fd4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.hlsl
new file mode 100644
index 0000000..294d4d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureGatherCompare_182fd4() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGatherCompare_182fd4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGatherCompare_182fd4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGatherCompare_182fd4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl
new file mode 100644
index 0000000..5f3be12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGatherCompare_182fd4(depthcube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGatherCompare_182fd4(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGatherCompare_182fd4(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGatherCompare_182fd4(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm
new file mode 100644
index 0000000..e8bd4b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureGatherCompare_182fd4 "textureGatherCompare_182fd4"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+%textureGatherCompare_182fd4 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageDrefGather %v4float %30 %31 %32
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGatherCompare_182fd4
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureGatherCompare_182fd4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGatherCompare_182fd4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl
new file mode 100644
index 0000000..14cdd2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/182fd4.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureGatherCompare_182fd4() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_182fd4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_182fd4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_182fd4();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl
new file mode 100644
index 0000000..e7dcda6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGatherCompare_313add() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_313add();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_313add();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_313add();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl
new file mode 100644
index 0000000..951aa5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGatherCompare_313add() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureGatherCompare_313add();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureGatherCompare_313add() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0));
+}
+
+void fragment_main() {
+ textureGatherCompare_313add();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGatherCompare_313add() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGatherOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0));
+}
+
+void compute_main() {
+ textureGatherCompare_313add();
+}
+
+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/textureGatherCompare/313add.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.hlsl
new file mode 100644
index 0000000..c92a22b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureGatherCompare_313add() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGatherCompare_313add();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGatherCompare_313add();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGatherCompare_313add();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl
new file mode 100644
index 0000000..4862938
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGatherCompare_313add(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGatherCompare_313add(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGatherCompare_313add(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGatherCompare_313add(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm
new file mode 100644
index 0000000..fe55f7a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; 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 %textureGatherCompare_313add "textureGatherCompare_313add"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %35 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %38 = OpTypeFunction %v4float
+%textureGatherCompare_313add = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageDrefGather %v4float %30 %31 %32 ConstOffset %35
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureGatherCompare_313add
+ 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
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGatherCompare_313add
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureGatherCompare_313add
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl
new file mode 100644
index 0000000..280870d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/313add.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureGatherCompare_313add() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_313add();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_313add();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_313add();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl
new file mode 100644
index 0000000..279f1cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3<f32>, array_index: i32, depth_ref: f32) -> vec4<f32>
+fn textureGatherCompare_60d2d1() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_60d2d1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_60d2d1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_60d2d1();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl
new file mode 100644
index 0000000..33e06ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_60d2d1() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+vec4 vertex_main() {
+ textureGatherCompare_60d2d1();
+ 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 textureGatherCompare_60d2d1() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureGatherCompare_60d2d1();
+}
+
+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 textureGatherCompare_60d2d1() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void compute_main() {
+ textureGatherCompare_60d2d1();
+}
+
+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/textureGatherCompare/60d2d1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.hlsl
new file mode 100644
index 0000000..a0284d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureGatherCompare_60d2d1() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.GatherCmp(arg_1, float4(arg_2, float(arg_3)), arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGatherCompare_60d2d1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGatherCompare_60d2d1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGatherCompare_60d2d1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl
new file mode 100644
index 0000000..682a170
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGatherCompare_60d2d1(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGatherCompare_60d2d1(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)]]) {
+ textureGatherCompare_60d2d1(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)]]) {
+ textureGatherCompare_60d2d1(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm
new file mode 100644
index 0000000..660f0f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.spvasm
@@ -0,0 +1,106 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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 %textureGatherCompare_60d2d1 "textureGatherCompare_60d2d1"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+%textureGatherCompare_60d2d1 = 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_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %36 = OpLoad %v3float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %39 = OpCompositeExtract %float %36 2
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v4float %37 %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageDrefGather %v4float %35 %42 %43
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGatherCompare_60d2d1
+ 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
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGatherCompare_60d2d1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGatherCompare_60d2d1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.wgsl.expected.wgsl
new file mode 100644
index 0000000..630a5af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/60d2d1.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_comparison;
+
+fn textureGatherCompare_60d2d1() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_60d2d1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_60d2d1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_60d2d1();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl
new file mode 100644
index 0000000..4f8562b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32) -> vec4<f32>
+fn textureGatherCompare_6d9352() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_6d9352();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_6d9352();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_6d9352();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl
new file mode 100644
index 0000000..b57e663
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGatherCompare_6d9352() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ textureGatherCompare_6d9352();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureGatherCompare_6d9352() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureGatherCompare_6d9352();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureGatherCompare_6d9352() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ textureGatherCompare_6d9352();
+}
+
+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/textureGatherCompare/6d9352.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.hlsl
new file mode 100644
index 0000000..6c7d0f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureGatherCompare_6d9352() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.GatherCmp(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGatherCompare_6d9352();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGatherCompare_6d9352();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGatherCompare_6d9352();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl
new file mode 100644
index 0000000..ce42345
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGatherCompare_6d9352(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGatherCompare_6d9352(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureGatherCompare_6d9352(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureGatherCompare_6d9352(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm
new file mode 100644
index 0000000..0a6a857
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureGatherCompare_6d9352 "textureGatherCompare_6d9352"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+%textureGatherCompare_6d9352 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageDrefGather %v4float %30 %31 %32
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureGatherCompare_6d9352
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureGatherCompare_6d9352
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureGatherCompare_6d9352
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl
new file mode 100644
index 0000000..b45c6fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/6d9352.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureGatherCompare_6d9352() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_6d9352();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_6d9352();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_6d9352();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl
new file mode 100644
index 0000000..5215238
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32) -> vec4<f32>
+fn textureGatherCompare_783e65() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_783e65();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_783e65();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_783e65();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl
new file mode 100644
index 0000000..84f32d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_783e65() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+vec4 vertex_main() {
+ textureGatherCompare_783e65();
+ 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 sampler2DArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_783e65() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureGatherCompare_783e65();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_783e65() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGather(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+void compute_main() {
+ textureGatherCompare_783e65();
+}
+
+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/textureGatherCompare/783e65.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.hlsl
new file mode 100644
index 0000000..c0b2cce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureGatherCompare_783e65() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGatherCompare_783e65();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGatherCompare_783e65();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGatherCompare_783e65();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl
new file mode 100644
index 0000000..b6aade7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGatherCompare_783e65(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, arg_4);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureGatherCompare_783e65(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)]]) {
+ textureGatherCompare_783e65(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)]]) {
+ textureGatherCompare_783e65(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm
new file mode 100644
index 0000000..9b37b33
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.spvasm
@@ -0,0 +1,105 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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 %textureGatherCompare_783e65 "textureGatherCompare_783e65"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+%textureGatherCompare_783e65 = 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_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %37 = OpLoad %v2float %arg_2
+ %38 = OpCompositeExtract %float %37 0
+ %39 = OpCompositeExtract %float %37 1
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v3float %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageDrefGather %v4float %35 %42 %43
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureGatherCompare_783e65
+ 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
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureGatherCompare_783e65
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureGatherCompare_783e65
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/783e65.wgsl.expected.wgsl
new file mode 100644
index 0000000..9ce6640
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/783e65.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_comparison;
+
+fn textureGatherCompare_783e65() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_783e65();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_783e65();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_783e65();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl
new file mode 100644
index 0000000..17d15e2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureGatherCompare_f585cc() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_f585cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_f585cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_f585cc();
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl
new file mode 100644
index 0000000..8ae1b0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_f585cc() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureGatherCompare_f585cc();
+ 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 sampler2DArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_f585cc() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0));
+}
+
+void fragment_main() {
+ textureGatherCompare_f585cc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureGatherCompare_f585cc() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureGatherOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0));
+}
+
+void compute_main() {
+ textureGatherCompare_f585cc();
+}
+
+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/textureGatherCompare/f585cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.hlsl
new file mode 100644
index 0000000..eef0720
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureGatherCompare_f585cc() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.GatherCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureGatherCompare_f585cc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureGatherCompare_f585cc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureGatherCompare_f585cc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl
new file mode 100644
index 0000000..31ed159
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureGatherCompare_f585cc(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = tint_symbol_1.gather_compare(tint_symbol_2, arg_2, arg_3, 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) {
+ textureGatherCompare_f585cc(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)]]) {
+ textureGatherCompare_f585cc(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)]]) {
+ textureGatherCompare_f585cc(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm
new file mode 100644
index 0000000..9d23a22
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; 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 %textureGatherCompare_f585cc "textureGatherCompare_f585cc"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %45 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %48 = OpTypeFunction %v4float
+%textureGatherCompare_f585cc = 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_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %37 = OpLoad %v2float %arg_2
+ %38 = OpCompositeExtract %float %37 0
+ %39 = OpCompositeExtract %float %37 1
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v3float %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageDrefGather %v4float %35 %42 %43 ConstOffset %45
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureGatherCompare_f585cc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureGatherCompare_f585cc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureGatherCompare_f585cc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.wgsl.expected.wgsl
new file mode 100644
index 0000000..6281ea0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureGatherCompare/f585cc.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_comparison;
+
+fn textureGatherCompare_f585cc() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureGatherCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureGatherCompare_f585cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureGatherCompare_f585cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureGatherCompare_f585cc();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl
new file mode 100644
index 0000000..1f8fe73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> f32
+fn textureLoad_19cf87() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_19cf87();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_19cf87();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_19cf87();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl
new file mode 100644
index 0000000..fb34ff9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_19cf87() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ float res = texelFetch(arg_0_1, arg_1, arg_2).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_19cf87();
+ 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_19cf87() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ float res = texelFetch(arg_0_1, arg_1, arg_2).x;
+}
+
+void fragment_main() {
+ textureLoad_19cf87();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_19cf87() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ float res = texelFetch(arg_0_1, arg_1, arg_2).x;
+}
+
+void compute_main() {
+ textureLoad_19cf87();
+}
+
+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/19cf87.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.hlsl
new file mode 100644
index 0000000..af201f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureLoad_19cf87() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 0;
+ float res = arg_0.Load(int3(arg_1, arg_2)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_19cf87();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_19cf87();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_19cf87();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl
new file mode 100644
index 0000000..d845591
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_19cf87(depth2d<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 0;
+ 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_19cf87(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_19cf87(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_19cf87(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm
new file mode 100644
index 0000000..6237288
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; 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_19cf87 "textureLoad_19cf87"
+ 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
+ %21 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_float = OpTypePointer Function %float
+ %31 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_19cf87 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %21
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %21
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %int %arg_2
+ %25 = OpImageFetch %v4float %26 %27 Lod %28
+ %24 = OpCompositeExtract %float %25 0
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %31
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureLoad_19cf87
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %37
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_19cf87
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_19cf87
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl
new file mode 100644
index 0000000..86140df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/19cf87.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureLoad_19cf87() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_19cf87();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_19cf87();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_19cf87();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl
new file mode 100644
index 0000000..de34cc8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<u32>
+fn textureLoad_1b8588() {
+ var arg_1 = 1;
+ var arg_2 = 0;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1b8588();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_1b8588();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1b8588();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl
new file mode 100644
index 0000000..7a48c97
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureLoad_1b8588() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_1b8588();
+ 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_1b8588() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_1b8588();
+}
+
+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_1b8588() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_1b8588();
+}
+
+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/1b8588.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.hlsl
new file mode 100644
index 0000000..8a7976a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_1b8588() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ uint4 res = arg_0.Load(int2(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1b8588();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1b8588();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1b8588();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl
new file mode 100644
index 0000000..ba01092
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_1b8588(texture1d<uint, access::sample> tint_symbol_1) {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ 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_1b8588(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_1b8588(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_1b8588(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm
new file mode 100644
index 0000000..b68a825
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.spvasm
@@ -0,0 +1,87 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; 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_1b8588 "textureLoad_1b8588"
+ 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
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpConstantNull %v4uint
+ %31 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_1b8588 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_int Function %21
+ %res = OpVariable %_ptr_Function_v4uint Function %30
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %21
+ %25 = OpLoad %11 %arg_0
+ %26 = OpLoad %int %arg_1
+ %27 = OpLoad %int %arg_2
+ %23 = OpImageFetch %v4uint %25 %26 Lod %27
+ OpStore %res %23
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %31
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureLoad_1b8588
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %37
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_1b8588
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_1b8588
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl
new file mode 100644
index 0000000..5d581f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1b8588.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureLoad_1b8588() {
+ var arg_1 = 1;
+ var arg_2 = 0;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1b8588();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_1b8588();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1b8588();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl
new file mode 100644
index 0000000..26e385b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<f32>
+fn textureLoad_1f2016() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 0;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1f2016();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_1f2016();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1f2016();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl
new file mode 100644
index 0000000..4e6193e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_1f2016() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_1f2016();
+ 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_1f2016() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_1f2016();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureLoad_1f2016() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_1f2016();
+}
+
+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/1f2016.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.hlsl
new file mode 100644
index 0000000..9a90498
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_1f2016() {
+ int3 arg_1 = (0).xxx;
+ int arg_2 = 0;
+ float4 res = arg_0.Load(int4(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_1f2016();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1f2016();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_1f2016();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl
new file mode 100644
index 0000000..843d5a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_1f2016(texture3d<float, access::sample> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int arg_2 = 0;
+ 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_1f2016(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_1f2016(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_1f2016(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm
new file mode 100644
index 0000000..d3bd5ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; 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_1f2016 "textureLoad_1f2016"
+ 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
+ %21 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_1f2016 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %21
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %21
+ %25 = OpLoad %11 %arg_0
+ %26 = OpLoad %v3int %arg_1
+ %27 = OpLoad %int %arg_2
+ %24 = OpImageFetch %v4float %25 %26 Lod %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_1f2016
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_1f2016
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_1f2016
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl
new file mode 100644
index 0000000..75576c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/1f2016.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureLoad_1f2016() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 0;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_1f2016();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_1f2016();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_1f2016();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl
new file mode 100644
index 0000000..3d76228
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<f32>
+fn textureLoad_484344() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_484344();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_484344();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_484344();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl
new file mode 100644
index 0000000..4373757
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_484344() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_484344();
+ 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_484344() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_484344();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureLoad_484344() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_484344();
+}
+
+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/484344.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.hlsl
new file mode 100644
index 0000000..26f5c56
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_484344() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 0;
+ float4 res = arg_0.Load(int3(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_484344();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_484344();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_484344();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl
new file mode 100644
index 0000000..cc878b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_484344(texture2d<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 0;
+ 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_484344(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_484344(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_484344(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm
new file mode 100644
index 0000000..f1c4518
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; 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_484344 "textureLoad_484344"
+ 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
+ %21 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_484344 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %21
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %21
+ %25 = OpLoad %11 %arg_0
+ %26 = OpLoad %v2int %arg_1
+ %27 = OpLoad %int %arg_2
+ %24 = OpImageFetch %v4float %25 %26 Lod %27
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_484344
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %35 = OpLabel
+ %36 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %36
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_484344
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_484344
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl
new file mode 100644
index 0000000..e8b9067
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/484344.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureLoad_484344() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_484344();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_484344();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_484344();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl
new file mode 100644
index 0000000..feb2dd2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<i32>
+fn textureLoad_4fd803() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 0;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4fd803();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_4fd803();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4fd803();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl
new file mode 100644
index 0000000..d0ac1ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_4fd803() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_4fd803();
+ 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_4fd803() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_4fd803();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureLoad_4fd803() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_4fd803();
+}
+
+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/4fd803.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.hlsl
new file mode 100644
index 0000000..62f5574
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_4fd803() {
+ int3 arg_1 = (0).xxx;
+ int arg_2 = 0;
+ int4 res = arg_0.Load(int4(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_4fd803();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_4fd803();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_4fd803();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl
new file mode 100644
index 0000000..0b3b144
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_4fd803(texture3d<int, access::sample> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int arg_2 = 0;
+ 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_4fd803(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_4fd803(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_4fd803(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.spvasm
new file mode 100644
index 0000000..003f85d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.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_4fd803 "textureLoad_4fd803"
+ 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
+ %21 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %31 = OpConstantNull %v4int
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_4fd803 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %21
+ %res = OpVariable %_ptr_Function_v4int Function %31
+ OpStore %arg_1 %18
+ OpStore %arg_2 %21
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v3int %arg_1
+ %28 = OpLoad %int %arg_2
+ %24 = OpImageFetch %v4int %26 %27 Lod %28
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_4fd803
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_4fd803
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_4fd803
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl
new file mode 100644
index 0000000..b6c2086
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/4fd803.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureLoad_4fd803() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 0;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_4fd803();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_4fd803();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_4fd803();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl
new file mode 100644
index 0000000..70e70e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<i32>
+fn textureLoad_5a2f9d() {
+ var arg_1 = 1;
+ var arg_2 = 0;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_5a2f9d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_5a2f9d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_5a2f9d();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl
new file mode 100644
index 0000000..4c2d0e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureLoad_5a2f9d() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_5a2f9d();
+ 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_5a2f9d() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_5a2f9d();
+}
+
+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_5a2f9d() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_5a2f9d();
+}
+
+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/5a2f9d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.hlsl
new file mode 100644
index 0000000..6560358
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_5a2f9d() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ int4 res = arg_0.Load(int2(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_5a2f9d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_5a2f9d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_5a2f9d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl
new file mode 100644
index 0000000..f2f8860
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_5a2f9d(texture1d<int, access::sample> tint_symbol_1) {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ 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_5a2f9d(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_5a2f9d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_5a2f9d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm
new file mode 100644
index 0000000..f4ceb92
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; 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_5a2f9d "textureLoad_5a2f9d"
+ 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
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpConstantNull %v4int
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_5a2f9d = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_v4int Function %29
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %20
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %int %arg_2
+ %22 = OpImageFetch %v4int %24 %25 Lod %26
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureLoad_5a2f9d
+ 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_5a2f9d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_5a2f9d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl
new file mode 100644
index 0000000..c78620e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/5a2f9d.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureLoad_5a2f9d() {
+ var arg_1 = 1;
+ var arg_2 = 0;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_5a2f9d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_5a2f9d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_5a2f9d();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl
new file mode 100644
index 0000000..a165d74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<u32>
+fn textureLoad_6154d4() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6154d4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_6154d4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6154d4();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl
new file mode 100644
index 0000000..5fe0e2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_6154d4() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_6154d4();
+ 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_6154d4() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_6154d4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureLoad_6154d4() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_6154d4();
+}
+
+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/6154d4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.hlsl
new file mode 100644
index 0000000..38bda49
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_6154d4() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 0;
+ uint4 res = arg_0.Load(int3(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6154d4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_6154d4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6154d4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl
new file mode 100644
index 0000000..ab70ff6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6154d4(texture2d<uint, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 0;
+ 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_6154d4(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_6154d4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6154d4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.spvasm
new file mode 100644
index 0000000..e670096
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.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_6154d4 "textureLoad_6154d4"
+ 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
+ %22 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %32 = OpConstantNull %v4uint
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6154d4 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %22
+ %res = OpVariable %_ptr_Function_v4uint Function %32
+ OpStore %arg_1 %19
+ OpStore %arg_2 %22
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %int %arg_2
+ %25 = OpImageFetch %v4uint %27 %28 Lod %29
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_6154d4
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_6154d4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_6154d4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl
new file mode 100644
index 0000000..f58a9da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6154d4.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureLoad_6154d4() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6154d4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_6154d4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6154d4();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl
new file mode 100644
index 0000000..5d6029c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> f32
+fn textureLoad_6273b1() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6273b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_6273b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6273b1();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl
new file mode 100644
index 0000000..ae0115f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6273b1() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, arg_1, arg_2).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_6273b1();
+ 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_6273b1() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, arg_1, arg_2).x;
+}
+
+void fragment_main() {
+ textureLoad_6273b1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_6273b1() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ float res = texelFetch(arg_0_1, arg_1, arg_2).x;
+}
+
+void compute_main() {
+ textureLoad_6273b1();
+}
+
+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/6273b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.hlsl
new file mode 100644
index 0000000..b05e1bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_6273b1() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float res = arg_0.Load(int3(arg_1, 0), arg_2).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_6273b1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_6273b1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_6273b1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl
new file mode 100644
index 0000000..05fb393
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_6273b1(depth2d_ms<float, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_6273b1(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_6273b1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_6273b1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.spvasm
new file mode 100644
index 0000000..4ed02fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.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_6273b1 "textureLoad_6273b1"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_float = OpTypePointer Function %float
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_6273b1 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %24
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %int %arg_2
+ %26 = OpImageFetch %v4float %27 %28 Sample %29
+ %25 = OpCompositeExtract %float %26 0
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_6273b1
+ 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_6273b1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_6273b1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl
new file mode 100644
index 0000000..98a60a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/6273b1.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureLoad_6273b1() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_6273b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_6273b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_6273b1();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl
new file mode 100644
index 0000000..555abca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<i32>
+fn textureLoad_79e697() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_79e697();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_79e697();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_79e697();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl
new file mode 100644
index 0000000..2ddb088
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_79e697() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_79e697();
+ 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_79e697() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_79e697();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureLoad_79e697() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ ivec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureLoad_79e697();
+}
+
+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/79e697.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.hlsl
new file mode 100644
index 0000000..058dfb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureLoad_79e697() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int arg_3 = 0;
+ int4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_79e697();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_79e697();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_79e697();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl
new file mode 100644
index 0000000..b2e557e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_79e697(texture2d_array<int, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ 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_79e697(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_79e697(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_79e697(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.spvasm
new file mode 100644
index 0000000..ccc8296
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.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_79e697 "textureLoad_79e697"
+ 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
+ %v4int = OpTypeVector %int 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %38 = OpConstantNull %v4int
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_79e697 = 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_int Function %24
+ %res = OpVariable %_ptr_Function_v4int Function %38
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %24
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %int %arg_3
+ %26 = OpImageFetch %v4int %28 %34 Lod %35
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_79e697
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureLoad_79e697
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureLoad_79e697
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl
new file mode 100644
index 0000000..4ab97b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/79e697.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureLoad_79e697() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_79e697();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_79e697();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_79e697();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl
new file mode 100644
index 0000000..e6ae433
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<u32>
+fn textureLoad_7c90e5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7c90e5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_7c90e5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7c90e5();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl
new file mode 100644
index 0000000..8777502
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7c90e5() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_7c90e5();
+ 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_7c90e5() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_7c90e5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureLoad_7c90e5() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ uvec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureLoad_7c90e5();
+}
+
+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/7c90e5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.hlsl
new file mode 100644
index 0000000..eac35c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_7c90e5() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int arg_3 = 0;
+ uint4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_7c90e5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_7c90e5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_7c90e5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl
new file mode 100644
index 0000000..12ab5a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_7c90e5(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ 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_7c90e5(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_7c90e5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_7c90e5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0e8a8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.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_7c90e5 "textureLoad_7c90e5"
+ 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
+ %v4uint = OpTypeVector %uint 4
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %39 = OpConstantNull %v4uint
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_7c90e5 = 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_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %39
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %25
+ %29 = OpLoad %11 %arg_0
+ %31 = OpLoad %v2int %arg_1
+ %32 = OpCompositeExtract %int %31 0
+ %33 = OpCompositeExtract %int %31 1
+ %34 = OpLoad %int %arg_2
+ %35 = OpCompositeConstruct %v3int %32 %33 %34
+ %36 = OpLoad %int %arg_3
+ %27 = OpImageFetch %v4uint %29 %35 Lod %36
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_7c90e5
+ 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 %textureLoad_7c90e5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureLoad_7c90e5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl
new file mode 100644
index 0000000..f6852e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/7c90e5.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureLoad_7c90e5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_7c90e5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_7c90e5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_7c90e5();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl
new file mode 100644
index 0000000..45d48d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<f32>
+fn textureLoad_81c381() {
+ var arg_1 = 1;
+ var arg_2 = 0;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_81c381();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_81c381();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_81c381();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl
new file mode 100644
index 0000000..33ebb73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureLoad_81c381() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_81c381();
+ 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_81c381() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_81c381();
+}
+
+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_81c381() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_81c381();
+}
+
+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/81c381.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.hlsl
new file mode 100644
index 0000000..f125cbe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureLoad_81c381() {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ float4 res = arg_0.Load(int2(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_81c381();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_81c381();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_81c381();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl
new file mode 100644
index 0000000..96b3184
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_81c381(texture1d<float, access::sample> tint_symbol_1) {
+ int arg_1 = 1;
+ int arg_2 = 0;
+ 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_81c381(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_81c381(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_81c381(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm
new file mode 100644
index 0000000..d4d8ae6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; 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_81c381 "textureLoad_81c381"
+ 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %28 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_81c381 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %20
+ %23 = OpLoad %11 %arg_0
+ %24 = OpLoad %int %arg_1
+ %25 = OpLoad %int %arg_2
+ %22 = OpImageFetch %v4float %23 %24 Lod %25
+ OpStore %res %22
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %28
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureLoad_81c381
+ 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_81c381
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_81c381
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl
new file mode 100644
index 0000000..3ada1ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/81c381.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureLoad_81c381() {
+ var arg_1 = 1;
+ var arg_2 = 0;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_81c381();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_81c381();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_81c381();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl
new file mode 100644
index 0000000..a32ef39
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<f32>
+fn textureLoad_87be85() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_87be85();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_87be85();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_87be85();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl
new file mode 100644
index 0000000..d7e3830
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_87be85() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureLoad_87be85();
+ 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_87be85() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureLoad_87be85();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_87be85() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ vec4 res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureLoad_87be85();
+}
+
+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/87be85.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.hlsl
new file mode 100644
index 0000000..b22cbff
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureLoad_87be85() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int arg_3 = 0;
+ float4 res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_87be85();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_87be85();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_87be85();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl
new file mode 100644
index 0000000..fd2e590
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_87be85(texture2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ 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_87be85(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_87be85(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_87be85(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm
new file mode 100644
index 0000000..4894eba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.spvasm
@@ -0,0 +1,94 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; 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_87be85 "textureLoad_87be85"
+ 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %37 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_87be85 = 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_int Function %24
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %24
+ %27 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %arg_1
+ %30 = OpCompositeExtract %int %29 0
+ %31 = OpCompositeExtract %int %29 1
+ %32 = OpLoad %int %arg_2
+ %33 = OpCompositeConstruct %v3int %30 %31 %32
+ %34 = OpLoad %int %arg_3
+ %26 = OpImageFetch %v4float %27 %33 Lod %34
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %37
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureLoad_87be85
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %42 = OpLabel
+ %43 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %43
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_87be85
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureLoad_87be85
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl
new file mode 100644
index 0000000..a033a61
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/87be85.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureLoad_87be85() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_87be85();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_87be85();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_87be85();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl
new file mode 100644
index 0000000..1f98b4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl
@@ -0,0 +1,47 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_external;
+
+// fn textureLoad(texture: texture_external, coords: vec2<i32>) -> vec4<f32>
+fn textureLoad_8acf41() {
+ var arg_1 = vec2<i32>();
+ var res: vec4<f32> = textureLoad(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_8acf41();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_8acf41();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_8acf41();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
new file mode 100644
index 0000000..5f0b29c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.glsl
@@ -0,0 +1,225 @@
+SKIP: FAILED
+
+#version 310 es
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 2) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
+ bvec3 cond = lessThan(abs(v), vec3(params.D));
+ vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
+ return mix(f, t, cond);
+}
+
+vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
+ vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = texelFetch(plane0_1, coord, 0).rgb;
+ } else {
+ color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return vec4(color, 1.0f);
+}
+
+uniform highp sampler2D arg_0_1;
+uniform highp sampler2D ext_tex_plane_1_1;
+void textureLoad_8acf41() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params);
+}
+
+vec4 vertex_main() {
+ textureLoad_8acf41();
+ 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:54: 'textureLoadExternal' : no matching overloaded function found
+ERROR: 0:54: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float'
+ERROR: 0:54: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 2) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
+ bvec3 cond = lessThan(abs(v), vec3(params.D));
+ vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
+ return mix(f, t, cond);
+}
+
+vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
+ vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = texelFetch(plane0_1, coord, 0).rgb;
+ } else {
+ color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return vec4(color, 1.0f);
+}
+
+uniform highp sampler2D arg_0_1;
+uniform highp sampler2D ext_tex_plane_1_1;
+void textureLoad_8acf41() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params);
+}
+
+void fragment_main() {
+ textureLoad_8acf41();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:55: 'textureLoadExternal' : no matching overloaded function found
+ERROR: 0:55: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float'
+ERROR: 0:55: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 2) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
+ bvec3 cond = lessThan(abs(v), vec3(params.D));
+ vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
+ return mix(f, t, cond);
+}
+
+vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
+ vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = texelFetch(plane0_1, coord, 0).rgb;
+ } else {
+ color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return vec4(color, 1.0f);
+}
+
+uniform highp sampler2D arg_0_1;
+uniform highp sampler2D ext_tex_plane_1_1;
+void textureLoad_8acf41() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 res = textureLoadExternal(arg_0_1, ext_tex_plane_1_1, arg_1, ext_tex_params);
+}
+
+void compute_main() {
+ textureLoad_8acf41();
+}
+
+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:54: 'textureLoadExternal' : no matching overloaded function found
+ERROR: 0:54: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float'
+ERROR: 0:54: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl
new file mode 100644
index 0000000..010b382
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.hlsl
@@ -0,0 +1,108 @@
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+struct ExternalTextureParams {
+ uint numPlanes;
+ float3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ float3x3 gamutConversionMatrix;
+};
+
+Texture2D<float4> ext_tex_plane_1 : register(t1, space1);
+cbuffer cbuffer_ext_tex_params : register(b2, space1) {
+ uint4 ext_tex_params[11];
+};
+Texture2D<float4> arg_0 : register(t0, space1);
+
+float3 gammaCorrection(float3 v, GammaTransferParams params) {
+ const bool3 cond = (abs(v) < float3((params.D).xxx));
+ const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
+ return (cond ? t : f);
+}
+
+float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
+ float3 color = float3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = plane0.Load(int3(coord, 0)).rgb;
+ } else {
+ color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f));
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = mul(color, params.gamutConversionMatrix);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return float4(color, 1.0f);
+}
+
+float3x4 tint_symbol_3(uint4 buffer[11], uint offset) {
+ const uint scalar_offset = ((offset + 0u)) / 4;
+ const uint scalar_offset_1 = ((offset + 16u)) / 4;
+ const uint scalar_offset_2 = ((offset + 32u)) / 4;
+ return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]));
+}
+
+GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) {
+ const uint scalar_offset_3 = ((offset + 0u)) / 4;
+ const uint scalar_offset_4 = ((offset + 4u)) / 4;
+ const uint scalar_offset_5 = ((offset + 8u)) / 4;
+ const uint scalar_offset_6 = ((offset + 12u)) / 4;
+ const uint scalar_offset_7 = ((offset + 16u)) / 4;
+ const uint scalar_offset_8 = ((offset + 20u)) / 4;
+ const uint scalar_offset_9 = ((offset + 24u)) / 4;
+ const uint scalar_offset_10 = ((offset + 28u)) / 4;
+ const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]};
+ return tint_symbol_9;
+}
+
+float3x3 tint_symbol_7(uint4 buffer[11], uint offset) {
+ const uint scalar_offset_11 = ((offset + 0u)) / 4;
+ const uint scalar_offset_12 = ((offset + 16u)) / 4;
+ const uint scalar_offset_13 = ((offset + 32u)) / 4;
+ return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz));
+}
+
+ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) {
+ const uint scalar_offset_14 = ((offset + 0u)) / 4;
+ const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))};
+ return tint_symbol_10;
+}
+
+void textureLoad_8acf41() {
+ int2 arg_1 = (0).xx;
+ float4 res = textureLoadExternal(arg_0, ext_tex_plane_1, arg_1, tint_symbol_1(ext_tex_params, 0u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_8acf41();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_8acf41();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_8acf41();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl
new file mode 100644
index 0000000..bd83a8e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.msl
@@ -0,0 +1,74 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct GammaTransferParams {
+ /* 0x0000 */ float G;
+ /* 0x0004 */ float A;
+ /* 0x0008 */ float B;
+ /* 0x000c */ float C;
+ /* 0x0010 */ float D;
+ /* 0x0014 */ float E;
+ /* 0x0018 */ float F;
+ /* 0x001c */ uint padding;
+};
+
+struct ExternalTextureParams {
+ /* 0x0000 */ uint numPlanes;
+ /* 0x0004 */ int8_t tint_pad[12];
+ /* 0x0010 */ float3x4 yuvToRgbConversionMatrix;
+ /* 0x0040 */ GammaTransferParams gammaDecodeParams;
+ /* 0x0060 */ GammaTransferParams gammaEncodeParams;
+ /* 0x0080 */ float3x3 gamutConversionMatrix;
+};
+
+float3 gammaCorrection(float3 v, GammaTransferParams params) {
+ bool3 const cond = (fabs(v) < float3(params.D));
+ float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F));
+ float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E));
+ return select(f, t, cond);
+}
+
+float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
+ float3 color = 0.0f;
+ if ((params.numPlanes == 1u)) {
+ color = float4(plane0.read(uint2(coord), 0)).rgb;
+ } else {
+ color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return float4(color, 1.0f);
+}
+
+void textureLoad_8acf41(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, const constant ExternalTextureParams* const tint_symbol_3) {
+ int2 arg_1 = int2(0);
+ float4 res = textureLoadExternal(tint_symbol_1, tint_symbol_2, arg_1, *(tint_symbol_3));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_4, texture2d<float, access::sample> tint_symbol_5, const constant ExternalTextureParams* const tint_symbol_6) {
+ textureLoad_8acf41(tint_symbol_4, tint_symbol_5, tint_symbol_6);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_7 [[texture(0)]], texture2d<float, access::sample> tint_symbol_8 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_9 [[buffer(2)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_7, tint_symbol_8, tint_symbol_9);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_10 [[texture(0)]], texture2d<float, access::sample> tint_symbol_11 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) {
+ textureLoad_8acf41(tint_symbol_10, tint_symbol_11, tint_symbol_12);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_13 [[texture(0)]], texture2d<float, access::sample> tint_symbol_14 [[texture(1)]], const constant ExternalTextureParams* tint_symbol_15 [[buffer(2)]]) {
+ textureLoad_8acf41(tint_symbol_13, tint_symbol_14, tint_symbol_15);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm
new file mode 100644
index 0000000..2c3a902
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.spvasm
@@ -0,0 +1,233 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 132
+; Schema: 0
+ OpCapability Shader
+ %27 = OpExtInstImport "GLSL.std.450"
+ 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 %ext_tex_plane_1 "ext_tex_plane_1"
+ OpName %ExternalTextureParams "ExternalTextureParams"
+ OpMemberName %ExternalTextureParams 0 "numPlanes"
+ OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix"
+ OpMemberName %ExternalTextureParams 2 "gammaDecodeParams"
+ OpName %GammaTransferParams "GammaTransferParams"
+ OpMemberName %GammaTransferParams 0 "G"
+ OpMemberName %GammaTransferParams 1 "A"
+ OpMemberName %GammaTransferParams 2 "B"
+ OpMemberName %GammaTransferParams 3 "C"
+ OpMemberName %GammaTransferParams 4 "D"
+ OpMemberName %GammaTransferParams 5 "E"
+ OpMemberName %GammaTransferParams 6 "F"
+ OpMemberName %GammaTransferParams 7 "padding"
+ OpMemberName %ExternalTextureParams 3 "gammaEncodeParams"
+ OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix"
+ OpName %ext_tex_params "ext_tex_params"
+ OpName %arg_0 "arg_0"
+ OpName %gammaCorrection "gammaCorrection"
+ OpName %v "v"
+ OpName %params "params"
+ OpName %textureLoadExternal "textureLoadExternal"
+ OpName %plane0 "plane0"
+ OpName %plane1 "plane1"
+ OpName %coord "coord"
+ OpName %params_0 "params"
+ OpName %color "color"
+ OpName %textureLoad_8acf41 "textureLoad_8acf41"
+ OpName %arg_1 "arg_1"
+ 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 %ext_tex_plane_1 DescriptorSet 1
+ OpDecorate %ext_tex_plane_1 Binding 1
+ OpDecorate %ExternalTextureParams Block
+ OpMemberDecorate %ExternalTextureParams 0 Offset 0
+ OpMemberDecorate %ExternalTextureParams 1 Offset 16
+ OpMemberDecorate %ExternalTextureParams 1 ColMajor
+ OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16
+ OpMemberDecorate %ExternalTextureParams 2 Offset 64
+ OpMemberDecorate %GammaTransferParams 0 Offset 0
+ OpMemberDecorate %GammaTransferParams 1 Offset 4
+ OpMemberDecorate %GammaTransferParams 2 Offset 8
+ OpMemberDecorate %GammaTransferParams 3 Offset 12
+ OpMemberDecorate %GammaTransferParams 4 Offset 16
+ OpMemberDecorate %GammaTransferParams 5 Offset 20
+ OpMemberDecorate %GammaTransferParams 6 Offset 24
+ OpMemberDecorate %GammaTransferParams 7 Offset 28
+ OpMemberDecorate %ExternalTextureParams 3 Offset 96
+ OpMemberDecorate %ExternalTextureParams 4 Offset 128
+ OpMemberDecorate %ExternalTextureParams 4 ColMajor
+ OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16
+ OpDecorate %ext_tex_params NonWritable
+ OpDecorate %ext_tex_params DescriptorSet 1
+ OpDecorate %ext_tex_params Binding 2
+ 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
+%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %uint = OpTypeInt 32 0
+%mat3v4float = OpTypeMatrix %v4float 3
+%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
+ %v3float = OpTypeVector %float 3
+%mat3v3float = OpTypeMatrix %v3float 3
+%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float
+%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
+%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %21 = OpTypeFunction %v3float %v3float %GammaTransferParams
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %41 = OpConstantNull %v3float
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %61 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams
+ %uint_1 = OpConstant %uint 1
+ %78 = OpConstantNull %int
+ %v2float = OpTypeVector %float 2
+ %float_1 = OpConstant %float 1
+ %void = OpTypeVoid
+ %105 = OpTypeFunction %void
+ %109 = OpConstantNull %v2int
+%_ptr_Function_v2int = OpTypePointer Function %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %119 = OpTypeFunction %v4float
+%gammaCorrection = OpFunction %v3float None %21
+ %v = OpFunctionParameter %v3float
+ %params = OpFunctionParameter %GammaTransferParams
+ %25 = OpLabel
+ %39 = OpVariable %_ptr_Function_v3float Function %41
+ %51 = OpVariable %_ptr_Function_v3float Function %41
+ %57 = OpVariable %_ptr_Function_v3float Function %41
+ %26 = OpExtInst %v3float %27 FAbs %v
+ %28 = OpCompositeExtract %float %params 4
+ %29 = OpCompositeConstruct %v3float %28 %28 %28
+ %30 = OpFOrdLessThan %v3bool %26 %29
+ %33 = OpExtInst %v3float %27 FSign %v
+ %34 = OpCompositeExtract %float %params 3
+ %35 = OpExtInst %v3float %27 FAbs %v
+ %36 = OpVectorTimesScalar %v3float %35 %34
+ %37 = OpCompositeExtract %float %params 6
+ %42 = OpCompositeConstruct %v3float %37 %37 %37
+ %38 = OpFAdd %v3float %36 %42
+ %43 = OpFMul %v3float %33 %38
+ %44 = OpExtInst %v3float %27 FSign %v
+ %46 = OpCompositeExtract %float %params 1
+ %47 = OpExtInst %v3float %27 FAbs %v
+ %48 = OpVectorTimesScalar %v3float %47 %46
+ %49 = OpCompositeExtract %float %params 2
+ %52 = OpCompositeConstruct %v3float %49 %49 %49
+ %50 = OpFAdd %v3float %48 %52
+ %53 = OpCompositeExtract %float %params 0
+ %54 = OpCompositeConstruct %v3float %53 %53 %53
+ %45 = OpExtInst %v3float %27 Pow %50 %54
+ %55 = OpCompositeExtract %float %params 5
+ %58 = OpCompositeConstruct %v3float %55 %55 %55
+ %56 = OpFAdd %v3float %45 %58
+ %59 = OpFMul %v3float %44 %56
+ %60 = OpSelect %v3float %30 %43 %59
+ OpReturnValue %60
+ OpFunctionEnd
+%textureLoadExternal = OpFunction %v4float None %61
+ %plane0 = OpFunctionParameter %11
+ %plane1 = OpFunctionParameter %11
+ %coord = OpFunctionParameter %v2int
+ %params_0 = OpFunctionParameter %ExternalTextureParams
+ %69 = OpLabel
+ %color = OpVariable %_ptr_Function_v3float Function %41
+ %71 = OpCompositeExtract %uint %params_0 0
+ %73 = OpIEqual %bool %71 %uint_1
+ 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
+ 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 1
+ %90 = OpVectorTimesMatrix %v3float %88 %89
+ OpStore %color %90
+ OpBranch %74
+ %74 = OpLabel
+ %92 = OpLoad %v3float %color
+ %93 = OpCompositeExtract %GammaTransferParams %params_0 2
+ %91 = OpFunctionCall %v3float %gammaCorrection %92 %93
+ OpStore %color %91
+ %94 = OpCompositeExtract %mat3v3float %params_0 4
+ %95 = OpLoad %v3float %color
+ %96 = OpMatrixTimesVector %v3float %94 %95
+ OpStore %color %96
+ %98 = OpLoad %v3float %color
+ %99 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %97 = OpFunctionCall %v3float %gammaCorrection %98 %99
+ OpStore %color %97
+ %100 = OpLoad %v3float %color
+ %101 = OpCompositeExtract %float %100 0
+ %102 = OpCompositeExtract %float %100 1
+ %103 = OpCompositeExtract %float %100 2
+ %104 = OpCompositeConstruct %v4float %101 %102 %103 %float_1
+ OpReturnValue %104
+ OpFunctionEnd
+%textureLoad_8acf41 = OpFunction %void None %105
+ %108 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %109
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %109
+ %113 = OpLoad %11 %arg_0
+ %114 = OpLoad %11 %ext_tex_plane_1
+ %115 = OpLoad %v2int %arg_1
+ %116 = OpLoad %ExternalTextureParams %ext_tex_params
+ %112 = OpFunctionCall %v4float %textureLoadExternal %113 %114 %115 %116
+ OpStore %res %112
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %119
+ %121 = OpLabel
+ %122 = OpFunctionCall %void %textureLoad_8acf41
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %105
+ %124 = OpLabel
+ %125 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %125
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %105
+ %127 = OpLabel
+ %128 = OpFunctionCall %void %textureLoad_8acf41
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %105
+ %130 = OpLabel
+ %131 = OpFunctionCall %void %textureLoad_8acf41
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl
new file mode 100644
index 0000000..bcabc7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/8acf41.wgsl.expected.wgsl
@@ -0,0 +1,22 @@
+@group(1) @binding(0) var arg_0 : texture_external;
+
+fn textureLoad_8acf41() {
+ var arg_1 = vec2<i32>();
+ var res : vec4<f32> = textureLoad(arg_0, arg_1);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_8acf41();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_8acf41();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_8acf41();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl
new file mode 100644
index 0000000..437dd0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> f32
+fn textureLoad_9b2667() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res: f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9b2667();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_9b2667();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9b2667();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl
new file mode 100644
index 0000000..59244eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_9b2667() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x;
+}
+
+vec4 vertex_main() {
+ textureLoad_9b2667();
+ 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_9b2667() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x;
+}
+
+void fragment_main() {
+ textureLoad_9b2667();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureLoad_9b2667() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ float res = texelFetch(arg_0_1, ivec3(arg_1, arg_2), arg_3).x;
+}
+
+void compute_main() {
+ textureLoad_9b2667();
+}
+
+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/9b2667.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.hlsl
new file mode 100644
index 0000000..b354532
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureLoad_9b2667() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int arg_3 = 0;
+ float res = arg_0.Load(int4(int3(arg_1, arg_2), arg_3)).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_9b2667();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_9b2667();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_9b2667();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl
new file mode 100644
index 0000000..456f44d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_9b2667(depth2d_array<float, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 1;
+ int arg_3 = 0;
+ 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_9b2667(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_9b2667(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_9b2667(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm
new file mode 100644
index 0000000..4d0af88
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; 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 %textureLoad_9b2667 "textureLoad_9b2667"
+ 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
+ %v3int = OpTypeVector %int 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_9b2667 = 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_int Function %24
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %24
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %int %arg_3
+ %27 = OpImageFetch %v4float %28 %34 Lod %35
+ %26 = OpCompositeExtract %float %27 0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_9b2667
+ 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 %textureLoad_9b2667
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureLoad_9b2667
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl
new file mode 100644
index 0000000..157799e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/9b2667.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureLoad_9b2667() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = 0;
+ var res : f32 = textureLoad(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_9b2667();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_9b2667();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_9b2667();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl
new file mode 100644
index 0000000..da8572a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<f32>
+fn textureLoad_a583c9() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res: vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a583c9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_a583c9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a583c9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl
new file mode 100644
index 0000000..2d7faec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_a583c9() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_a583c9();
+ 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_a583c9() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_a583c9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureLoad_a583c9() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_a583c9();
+}
+
+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/a583c9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.hlsl
new file mode 100644
index 0000000..c8c40f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureLoad_a583c9() {
+ int2 arg_1 = (0).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_a583c9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_a583c9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_a583c9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl
new file mode 100644
index 0000000..666d009
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_a583c9(texture2d_ms<float, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_a583c9(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_a583c9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_a583c9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm
new file mode 100644
index 0000000..c9e24f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; 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_a583c9 "textureLoad_a583c9"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %31 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_a583c9 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %24
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %int %arg_2
+ %25 = OpImageFetch %v4float %26 %27 Sample %28
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %31
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureLoad_a583c9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %37
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureLoad_a583c9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureLoad_a583c9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl
new file mode 100644
index 0000000..2e45ae4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a583c9.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureLoad_a583c9() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res : vec4<f32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a583c9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_a583c9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a583c9();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl
new file mode 100644
index 0000000..2b35241
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<u32>
+fn textureLoad_a9a9f5() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 0;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a9a9f5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_a9a9f5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a9a9f5();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl
new file mode 100644
index 0000000..66f2e8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_a9a9f5() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_a9a9f5();
+ 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_a9a9f5() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_a9a9f5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureLoad_a9a9f5() {
+ ivec3 arg_1 = ivec3(0);
+ int arg_2 = 0;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_a9a9f5();
+}
+
+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/a9a9f5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.hlsl
new file mode 100644
index 0000000..a44b10e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_a9a9f5() {
+ int3 arg_1 = (0).xxx;
+ int arg_2 = 0;
+ uint4 res = arg_0.Load(int4(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_a9a9f5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_a9a9f5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_a9a9f5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl
new file mode 100644
index 0000000..a5491a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_a9a9f5(texture3d<uint, access::sample> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int arg_2 = 0;
+ 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_a9a9f5(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_a9a9f5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_a9a9f5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.spvasm
new file mode 100644
index 0000000..234a175
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.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_a9a9f5 "textureLoad_a9a9f5"
+ 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
+ %22 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v4uint = OpTypeVector %uint 4
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %32 = OpConstantNull %v4uint
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_a9a9f5 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %22
+ %res = OpVariable %_ptr_Function_v4uint Function %32
+ OpStore %arg_1 %19
+ OpStore %arg_2 %22
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %int %arg_2
+ %25 = OpImageFetch %v4uint %27 %28 Lod %29
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_a9a9f5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_a9a9f5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_a9a9f5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl
new file mode 100644
index 0000000..93a3b77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/a9a9f5.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureLoad_a9a9f5() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = 0;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_a9a9f5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_a9a9f5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_a9a9f5();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl
new file mode 100644
index 0000000..62944a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<i32>
+fn textureLoad_c2a480() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c2a480();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_c2a480();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c2a480();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl
new file mode 100644
index 0000000..17b4070
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_c2a480() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_c2a480();
+ 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_c2a480() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_c2a480();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureLoad_c2a480() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 0;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_c2a480();
+}
+
+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/c2a480.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.hlsl
new file mode 100644
index 0000000..772ad7d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureLoad_c2a480() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 0;
+ int4 res = arg_0.Load(int3(arg_1, arg_2));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureLoad_c2a480();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c2a480();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_c2a480();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl
new file mode 100644
index 0000000..8aa51f4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_c2a480(texture2d<int, access::sample> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int arg_2 = 0;
+ 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_c2a480(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_c2a480(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_c2a480(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.spvasm
new file mode 100644
index 0000000..60ed545
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.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_c2a480 "textureLoad_c2a480"
+ 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
+ %21 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %31 = OpConstantNull %v4int
+ %32 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_c2a480 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %21
+ %res = OpVariable %_ptr_Function_v4int Function %31
+ OpStore %arg_1 %18
+ OpStore %arg_2 %21
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %int %arg_2
+ %24 = OpImageFetch %v4int %26 %27 Lod %28
+ OpStore %res %24
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_c2a480
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_c2a480
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_c2a480
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl
new file mode 100644
index 0000000..a28a80c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c2a480.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureLoad_c2a480() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 0;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c2a480();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_c2a480();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c2a480();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl
new file mode 100644
index 0000000..fad4ac3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<u32>
+fn textureLoad_c378ee() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res: vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c378ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_c378ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c378ee();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl
new file mode 100644
index 0000000..9d3f844
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_c378ee() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_c378ee();
+ 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_c378ee() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_c378ee();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureLoad_c378ee() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_c378ee();
+}
+
+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/c378ee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.hlsl
new file mode 100644
index 0000000..20193da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureLoad_c378ee() {
+ int2 arg_1 = (0).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_c378ee();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c378ee();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_c378ee();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl
new file mode 100644
index 0000000..c6192ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_c378ee(texture2d_ms<uint, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_c378ee(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_c378ee(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_c378ee(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.spvasm
new file mode 100644
index 0000000..190f4ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.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_c378ee "textureLoad_c378ee"
+ 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
+ %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_c378ee = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_int Function %25
+ %res = OpVariable %_ptr_Function_v4uint Function %33
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_1
+ %28 = OpLoad %11 %arg_0
+ %29 = OpLoad %v2int %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_c378ee
+ 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_c378ee
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureLoad_c378ee
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl
new file mode 100644
index 0000000..b957d4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/c378ee.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureLoad_c378ee() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res : vec4<u32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_c378ee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_c378ee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_c378ee();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl
new file mode 100644
index 0000000..a8f4f09
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> vec4<i32>
+fn textureLoad_e3d2cc() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res: vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_e3d2cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_e3d2cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_e3d2cc();
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl
new file mode 100644
index 0000000..6c70fb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_e3d2cc() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureLoad_e3d2cc();
+ 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_e3d2cc() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureLoad_e3d2cc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureLoad_e3d2cc() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 res = texelFetch(arg_0_1, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureLoad_e3d2cc();
+}
+
+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/e3d2cc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.hlsl
new file mode 100644
index 0000000..2599303
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureLoad_e3d2cc() {
+ int2 arg_1 = (0).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_e3d2cc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_e3d2cc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureLoad_e3d2cc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl
new file mode 100644
index 0000000..37f3ac3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureLoad_e3d2cc(texture2d_ms<int, access::read> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_e3d2cc(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_e3d2cc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureLoad_e3d2cc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.spvasm
new file mode 100644
index 0000000..31837df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.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_e3d2cc "textureLoad_e3d2cc"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %32 = OpConstantNull %v4int
+ %33 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureLoad_e3d2cc = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_int Function %24
+ %res = OpVariable %_ptr_Function_v4int Function %32
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %int %arg_2
+ %25 = OpImageFetch %v4int %27 %28 Sample %29
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_e3d2cc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_e3d2cc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_e3d2cc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl
new file mode 100644
index 0000000..97cb8d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureLoad/e3d2cc.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureLoad_e3d2cc() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var res : vec4<i32> = textureLoad(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureLoad_e3d2cc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureLoad_e3d2cc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureLoad_e3d2cc();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl
new file mode 100644
index 0000000..ee39dbb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureNumLayers(texture: texture_2d_array<f32>) -> i32
+fn textureNumLayers_024820() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_024820();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_024820();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_024820();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl
new file mode 100644
index 0000000..9e3639f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLayers_024820() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_024820();
+ 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 textureNumLayers_024820() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_024820();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLayers_024820() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_024820();
+}
+
+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/textureNumLayers/024820.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.hlsl
new file mode 100644
index 0000000..c54de32
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureNumLayers_024820() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_024820();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_024820();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_024820();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl
new file mode 100644
index 0000000..62c3cda
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_024820(texture2d_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureNumLayers_024820(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)]]) {
+ textureNumLayers_024820(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_024820(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm
new file mode 100644
index 0000000..5c65a19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_024820 "textureNumLayers_024820"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_024820 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySizeLod %v3int %20 %int_0
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_024820
+ 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 %textureNumLayers_024820
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_024820
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl
new file mode 100644
index 0000000..f58c93c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/024820.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureNumLayers_024820() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_024820();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_024820();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_024820();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl
new file mode 100644
index 0000000..f906fef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<u32>;
+
+// fn textureNumLayers(texture: texture_cube_array<u32>) -> i32
+fn textureNumLayers_053df7() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_053df7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_053df7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_053df7();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl
new file mode 100644
index 0000000..e995abb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_0_1;
+void textureNumLayers_053df7() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_053df7();
+ 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_0_1;
+void textureNumLayers_053df7() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_053df7();
+}
+
+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_0_1;
+void textureNumLayers_053df7() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_053df7();
+}
+
+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/textureNumLayers/053df7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.hlsl
new file mode 100644
index 0000000..ec08652
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<uint4> arg_0 : register(t0, space1);
+
+void textureNumLayers_053df7() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_053df7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_053df7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_053df7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl
new file mode 100644
index 0000000..68ceeb4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_053df7(texturecube_array<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_2) {
+ textureNumLayers_053df7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLayers_053df7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_053df7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm
new file mode 100644
index 0000000..a8336ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLayers_053df7 "textureNumLayers_053df7"
+ 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 Cube 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_053df7 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureNumLayers_053df7
+ 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 %textureNumLayers_053df7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureNumLayers_053df7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl
new file mode 100644
index 0000000..fae44b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/053df7.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<u32>;
+
+fn textureNumLayers_053df7() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_053df7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_053df7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_053df7();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl
new file mode 100644
index 0000000..55e7ee0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32sint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rg32sint, write>) -> i32
+fn textureNumLayers_058cc3() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_058cc3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_058cc3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_058cc3();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl
new file mode 100644
index 0000000..0730d3a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_058cc3() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_058cc3();
+ 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 textureNumLayers_058cc3() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_058cc3();
+}
+
+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 textureNumLayers_058cc3() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_058cc3();
+}
+
+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/textureNumLayers/058cc3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.hlsl
new file mode 100644
index 0000000..0f9f61a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureNumLayers_058cc3() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_058cc3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_058cc3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_058cc3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl
new file mode 100644
index 0000000..f89aa00
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_058cc3(texture2d_array<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureNumLayers_058cc3(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)]]) {
+ textureNumLayers_058cc3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_058cc3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm
new file mode 100644
index 0000000..4737d7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureNumLayers_058cc3 "textureNumLayers_058cc3"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_058cc3 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_058cc3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureNumLayers_058cc3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_058cc3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl
new file mode 100644
index 0000000..ee5d2e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/058cc3.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureNumLayers_058cc3() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_058cc3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_058cc3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_058cc3();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl
new file mode 100644
index 0000000..baf9538
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8unorm, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba8unorm, write>) -> i32
+fn textureNumLayers_09d05d() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_09d05d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_09d05d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_09d05d();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl
new file mode 100644
index 0000000..25b7ded
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_09d05d() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_09d05d();
+ 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 textureNumLayers_09d05d() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_09d05d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_09d05d() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_09d05d();
+}
+
+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/textureNumLayers/09d05d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.hlsl
new file mode 100644
index 0000000..c52cd47
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureNumLayers_09d05d() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_09d05d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_09d05d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_09d05d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl
new file mode 100644
index 0000000..6666c52
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_09d05d(texture2d_array<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureNumLayers_09d05d(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)]]) {
+ textureNumLayers_09d05d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_09d05d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm
new file mode 100644
index 0000000..e70fdfc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_09d05d "textureNumLayers_09d05d"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_09d05d = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_09d05d
+ 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 %textureNumLayers_09d05d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_09d05d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl
new file mode 100644
index 0000000..2034fa4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/09d05d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureNumLayers_09d05d() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_09d05d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_09d05d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_09d05d();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl
new file mode 100644
index 0000000..e21134d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32sint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba32sint, write>) -> i32
+fn textureNumLayers_13b4ce() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_13b4ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_13b4ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_13b4ce();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl
new file mode 100644
index 0000000..f090067
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_13b4ce() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_13b4ce();
+ 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 textureNumLayers_13b4ce() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_13b4ce();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_13b4ce() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_13b4ce();
+}
+
+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/textureNumLayers/13b4ce.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.hlsl
new file mode 100644
index 0000000..4d9ac8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureNumLayers_13b4ce() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_13b4ce();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_13b4ce();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_13b4ce();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl
new file mode 100644
index 0000000..bb33ae6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_13b4ce(texture2d_array<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureNumLayers_13b4ce(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)]]) {
+ textureNumLayers_13b4ce(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_13b4ce(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm
new file mode 100644
index 0000000..651790d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_13b4ce "textureNumLayers_13b4ce"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_13b4ce = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_13b4ce
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureNumLayers_13b4ce
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_13b4ce
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl
new file mode 100644
index 0000000..5061e7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/13b4ce.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureNumLayers_13b4ce() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_13b4ce();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_13b4ce();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_13b4ce();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl
new file mode 100644
index 0000000..a74f529
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32sint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<r32sint, write>) -> i32
+fn textureNumLayers_22e53b() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_22e53b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_22e53b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_22e53b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl
new file mode 100644
index 0000000..3902bb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_22e53b() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_22e53b();
+ 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 textureNumLayers_22e53b() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_22e53b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_22e53b() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_22e53b();
+}
+
+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/textureNumLayers/22e53b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.hlsl
new file mode 100644
index 0000000..8611a52
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureNumLayers_22e53b() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_22e53b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_22e53b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_22e53b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl
new file mode 100644
index 0000000..5c5fa33
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_22e53b(texture2d_array<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureNumLayers_22e53b(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)]]) {
+ textureNumLayers_22e53b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_22e53b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm
new file mode 100644
index 0000000..953a4a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_22e53b "textureNumLayers_22e53b"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_22e53b = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_22e53b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureNumLayers_22e53b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_22e53b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl
new file mode 100644
index 0000000..6d9957b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/22e53b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureNumLayers_22e53b() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_22e53b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_22e53b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_22e53b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl
new file mode 100644
index 0000000..b6f1c48
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16float, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba16float, write>) -> i32
+fn textureNumLayers_562013() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_562013();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_562013();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_562013();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl
new file mode 100644
index 0000000..713a325
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_562013() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_562013();
+ 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 textureNumLayers_562013() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_562013();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_562013() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_562013();
+}
+
+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/textureNumLayers/562013.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.hlsl
new file mode 100644
index 0000000..59664cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureNumLayers_562013() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_562013();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_562013();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_562013();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl
new file mode 100644
index 0000000..97a5498
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_562013(texture2d_array<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureNumLayers_562013(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)]]) {
+ textureNumLayers_562013(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_562013(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm
new file mode 100644
index 0000000..96b0fc2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_562013 "textureNumLayers_562013"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_562013 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_562013
+ 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 %textureNumLayers_562013
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_562013
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl
new file mode 100644
index 0000000..7223170
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/562013.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureNumLayers_562013() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_562013();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_562013();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_562013();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl
new file mode 100644
index 0000000..d808df9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+
+// fn textureNumLayers(texture: texture_cube_array<f32>) -> i32
+fn textureNumLayers_5d59cd() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_5d59cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_5d59cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_5d59cd();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl
new file mode 100644
index 0000000..c469183
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureNumLayers_5d59cd() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_5d59cd();
+ 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_0_1;
+void textureNumLayers_5d59cd() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_5d59cd();
+}
+
+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_0_1;
+void textureNumLayers_5d59cd() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_5d59cd();
+}
+
+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/textureNumLayers/5d59cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.hlsl
new file mode 100644
index 0000000..063ac3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+
+void textureNumLayers_5d59cd() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_5d59cd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_5d59cd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_5d59cd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl
new file mode 100644
index 0000000..aa7890e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_5d59cd(texturecube_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_2) {
+ textureNumLayers_5d59cd(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLayers_5d59cd(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_5d59cd(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm
new file mode 100644
index 0000000..e7f1f9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLayers_5d59cd "textureNumLayers_5d59cd"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_5d59cd = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySizeLod %v3int %20 %int_0
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_5d59cd
+ 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 %textureNumLayers_5d59cd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_5d59cd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl
new file mode 100644
index 0000000..170c763
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/5d59cd.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+fn textureNumLayers_5d59cd() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_5d59cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_5d59cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_5d59cd();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl
new file mode 100644
index 0000000..680221f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32float, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba32float, write>) -> i32
+fn textureNumLayers_68a65b() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_68a65b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_68a65b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_68a65b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl
new file mode 100644
index 0000000..38cd9e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_68a65b() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_68a65b();
+ 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 textureNumLayers_68a65b() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_68a65b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_68a65b() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_68a65b();
+}
+
+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/textureNumLayers/68a65b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.hlsl
new file mode 100644
index 0000000..cefd820
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureNumLayers_68a65b() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_68a65b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_68a65b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_68a65b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl
new file mode 100644
index 0000000..906ffc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_68a65b(texture2d_array<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureNumLayers_68a65b(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)]]) {
+ textureNumLayers_68a65b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_68a65b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm
new file mode 100644
index 0000000..53d6ff2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_68a65b "textureNumLayers_68a65b"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_68a65b = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_68a65b
+ 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 %textureNumLayers_68a65b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_68a65b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl
new file mode 100644
index 0000000..f358993
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/68a65b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureNumLayers_68a65b() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_68a65b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_68a65b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_68a65b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl
new file mode 100644
index 0000000..814bad1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+
+// fn textureNumLayers(texture: texture_depth_cube_array) -> i32
+fn textureNumLayers_778bd1() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_778bd1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_778bd1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_778bd1();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl
new file mode 100644
index 0000000..40debcc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureNumLayers_778bd1() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_778bd1();
+ 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_0_1;
+void textureNumLayers_778bd1() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_778bd1();
+}
+
+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_0_1;
+void textureNumLayers_778bd1() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_778bd1();
+}
+
+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/textureNumLayers/778bd1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.hlsl
new file mode 100644
index 0000000..198c36b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray arg_0 : register(t0, space1);
+
+void textureNumLayers_778bd1() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_778bd1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_778bd1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_778bd1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl
new file mode 100644
index 0000000..fc13fba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_778bd1(depthcube_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_2) {
+ textureNumLayers_778bd1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_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(depthcube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLayers_778bd1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_778bd1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm
new file mode 100644
index 0000000..b1fd36b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLayers_778bd1 "textureNumLayers_778bd1"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_778bd1 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySizeLod %v3int %20 %int_0
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_778bd1
+ 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 %textureNumLayers_778bd1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_778bd1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl
new file mode 100644
index 0000000..c13e994
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/778bd1.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+fn textureNumLayers_778bd1() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_778bd1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_778bd1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_778bd1();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl
new file mode 100644
index 0000000..7e843bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rg32float, write>) -> i32
+fn textureNumLayers_7f1937() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_7f1937();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_7f1937();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_7f1937();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl
new file mode 100644
index 0000000..f6fdbf0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_7f1937() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_7f1937();
+ 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 textureNumLayers_7f1937() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_7f1937();
+}
+
+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 textureNumLayers_7f1937() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_7f1937();
+}
+
+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/textureNumLayers/7f1937.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.hlsl
new file mode 100644
index 0000000..edd423a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureNumLayers_7f1937() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_7f1937();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_7f1937();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_7f1937();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl
new file mode 100644
index 0000000..05239da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_7f1937(texture2d_array<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureNumLayers_7f1937(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)]]) {
+ textureNumLayers_7f1937(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_7f1937(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm
new file mode 100644
index 0000000..59d909d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureNumLayers_7f1937 "textureNumLayers_7f1937"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_7f1937 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_7f1937
+ 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 %textureNumLayers_7f1937
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_7f1937
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl
new file mode 100644
index 0000000..4450ceb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/7f1937.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureNumLayers_7f1937() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_7f1937();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_7f1937();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_7f1937();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl
new file mode 100644
index 0000000..dc95da7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<i32>;
+
+// fn textureNumLayers(texture: texture_cube_array<i32>) -> i32
+fn textureNumLayers_85f980() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_85f980();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_85f980();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_85f980();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl
new file mode 100644
index 0000000..529bfb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_0_1;
+void textureNumLayers_85f980() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_85f980();
+ 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_0_1;
+void textureNumLayers_85f980() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_85f980();
+}
+
+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_0_1;
+void textureNumLayers_85f980() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_85f980();
+}
+
+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/textureNumLayers/85f980.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.hlsl
new file mode 100644
index 0000000..bd6cdc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<int4> arg_0 : register(t0, space1);
+
+void textureNumLayers_85f980() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_85f980();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_85f980();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_85f980();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl
new file mode 100644
index 0000000..e1b10eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_85f980(texturecube_array<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_2) {
+ textureNumLayers_85f980(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLayers_85f980(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_85f980(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm
new file mode 100644
index 0000000..4484cad
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLayers_85f980 "textureNumLayers_85f980"
+ 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 Cube 0 1 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
+ %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_85f980 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySizeLod %v3int %20 %int_0
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_85f980
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_85f980
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_85f980
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl
new file mode 100644
index 0000000..4dc70c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/85f980.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<i32>;
+
+fn textureNumLayers_85f980() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_85f980();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_85f980();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_85f980();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl
new file mode 100644
index 0000000..09bb3e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureNumLayers(texture: texture_2d_array<u32>) -> i32
+fn textureNumLayers_87953e() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_87953e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_87953e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_87953e();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl
new file mode 100644
index 0000000..83bae63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureNumLayers_87953e() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_87953e();
+ 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 textureNumLayers_87953e() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_87953e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureNumLayers_87953e() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_87953e();
+}
+
+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/textureNumLayers/87953e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.hlsl
new file mode 100644
index 0000000..5c563c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureNumLayers_87953e() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_87953e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_87953e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_87953e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl
new file mode 100644
index 0000000..971482f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_87953e(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureNumLayers_87953e(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)]]) {
+ textureNumLayers_87953e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_87953e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm
new file mode 100644
index 0000000..109f2d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_87953e "textureNumLayers_87953e"
+ 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %25 = OpConstantNull %int
+ %26 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_87953e = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %25
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySizeLod %v3int %21 %int_0
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureNumLayers_87953e
+ 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 %textureNumLayers_87953e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureNumLayers_87953e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl
new file mode 100644
index 0000000..26f73ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/87953e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureNumLayers_87953e() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_87953e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_87953e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_87953e();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl
new file mode 100644
index 0000000..3431985
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureNumLayers(texture: texture_2d_array<i32>) -> i32
+fn textureNumLayers_893e7c() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_893e7c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_893e7c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_893e7c();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl
new file mode 100644
index 0000000..e2d0eb6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureNumLayers_893e7c() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_893e7c();
+ 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 textureNumLayers_893e7c() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_893e7c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureNumLayers_893e7c() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_893e7c();
+}
+
+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/textureNumLayers/893e7c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.hlsl
new file mode 100644
index 0000000..0991385
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureNumLayers_893e7c() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_893e7c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_893e7c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_893e7c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl
new file mode 100644
index 0000000..66d329d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_893e7c(texture2d_array<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureNumLayers_893e7c(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)]]) {
+ textureNumLayers_893e7c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_893e7c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm
new file mode 100644
index 0000000..22bfd83
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_893e7c "textureNumLayers_893e7c"
+ 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
+ %v3int = OpTypeVector %int 3
+ %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_893e7c = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySizeLod %v3int %20 %int_0
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_893e7c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_893e7c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_893e7c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl
new file mode 100644
index 0000000..3cda546
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/893e7c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureNumLayers_893e7c() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_893e7c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_893e7c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_893e7c();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl
new file mode 100644
index 0000000..096b3e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16uint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba16uint, write>) -> i32
+fn textureNumLayers_9700fb() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_9700fb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_9700fb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_9700fb();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl
new file mode 100644
index 0000000..24b2d5d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_9700fb() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_9700fb();
+ 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 textureNumLayers_9700fb() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_9700fb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_9700fb() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_9700fb();
+}
+
+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/textureNumLayers/9700fb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.hlsl
new file mode 100644
index 0000000..63205b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureNumLayers_9700fb() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_9700fb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_9700fb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_9700fb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl
new file mode 100644
index 0000000..1b296c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_9700fb(texture2d_array<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureNumLayers_9700fb(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)]]) {
+ textureNumLayers_9700fb(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_9700fb(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm
new file mode 100644
index 0000000..4986494
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_9700fb "textureNumLayers_9700fb"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_9700fb = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_9700fb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_9700fb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_9700fb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl
new file mode 100644
index 0000000..ce6acab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/9700fb.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureNumLayers_9700fb() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_9700fb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_9700fb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_9700fb();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl
new file mode 100644
index 0000000..176205a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8sint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba8sint, write>) -> i32
+fn textureNumLayers_a216d2() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_a216d2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_a216d2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_a216d2();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl
new file mode 100644
index 0000000..a6deec3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_a216d2() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_a216d2();
+ 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 textureNumLayers_a216d2() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_a216d2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_a216d2() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_a216d2();
+}
+
+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/textureNumLayers/a216d2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.hlsl
new file mode 100644
index 0000000..d9cf500
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureNumLayers_a216d2() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_a216d2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_a216d2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_a216d2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl
new file mode 100644
index 0000000..427fe4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_a216d2(texture2d_array<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureNumLayers_a216d2(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)]]) {
+ textureNumLayers_a216d2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_a216d2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm
new file mode 100644
index 0000000..2d82417
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_a216d2 "textureNumLayers_a216d2"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_a216d2 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_a216d2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureNumLayers_a216d2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_a216d2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl
new file mode 100644
index 0000000..38fbc89
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/a216d2.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureNumLayers_a216d2() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_a216d2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_a216d2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_a216d2();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl
new file mode 100644
index 0000000..f99e118
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba32uint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba32uint, write>) -> i32
+fn textureNumLayers_cd5dc8() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_cd5dc8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_cd5dc8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_cd5dc8();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl
new file mode 100644
index 0000000..95fdcf4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_cd5dc8() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_cd5dc8();
+ 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 textureNumLayers_cd5dc8() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_cd5dc8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_cd5dc8() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_cd5dc8();
+}
+
+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/textureNumLayers/cd5dc8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.hlsl
new file mode 100644
index 0000000..ca5a80c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureNumLayers_cd5dc8() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_cd5dc8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_cd5dc8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_cd5dc8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl
new file mode 100644
index 0000000..bff98ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_cd5dc8(texture2d_array<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureNumLayers_cd5dc8(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)]]) {
+ textureNumLayers_cd5dc8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_cd5dc8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm
new file mode 100644
index 0000000..996f85e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_cd5dc8 "textureNumLayers_cd5dc8"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_cd5dc8 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_cd5dc8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_cd5dc8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_cd5dc8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl
new file mode 100644
index 0000000..870778b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/cd5dc8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureNumLayers_cd5dc8() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_cd5dc8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_cd5dc8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_cd5dc8();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl
new file mode 100644
index 0000000..ba8d85e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32float, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<r32float, write>) -> i32
+fn textureNumLayers_d5b228() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_d5b228();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_d5b228();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_d5b228();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl
new file mode 100644
index 0000000..0daa0a3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_d5b228() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_d5b228();
+ 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 textureNumLayers_d5b228() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_d5b228();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_d5b228() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_d5b228();
+}
+
+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/textureNumLayers/d5b228.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.hlsl
new file mode 100644
index 0000000..a8c82b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureNumLayers_d5b228() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_d5b228();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_d5b228();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_d5b228();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl
new file mode 100644
index 0000000..d2a1011
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_d5b228(texture2d_array<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureNumLayers_d5b228(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)]]) {
+ textureNumLayers_d5b228(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_d5b228(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm
new file mode 100644
index 0000000..08a45ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_d5b228 "textureNumLayers_d5b228"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_d5b228 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_d5b228
+ 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 %textureNumLayers_d5b228
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_d5b228
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl
new file mode 100644
index 0000000..798b0a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/d5b228.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureNumLayers_d5b228() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_d5b228();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_d5b228();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_d5b228();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl
new file mode 100644
index 0000000..fa0eed7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8snorm, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba8snorm, write>) -> i32
+fn textureNumLayers_e31be1() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_e31be1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_e31be1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_e31be1();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl
new file mode 100644
index 0000000..e5e4797
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_e31be1() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_e31be1();
+ 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 textureNumLayers_e31be1() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_e31be1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureNumLayers_e31be1() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_e31be1();
+}
+
+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/textureNumLayers/e31be1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.hlsl
new file mode 100644
index 0000000..6aca3c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureNumLayers_e31be1() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_e31be1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_e31be1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_e31be1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl
new file mode 100644
index 0000000..3b5b47f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_e31be1(texture2d_array<float, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
+ textureNumLayers_e31be1(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)]]) {
+ textureNumLayers_e31be1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_e31be1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm
new file mode 100644
index 0000000..192aa63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_e31be1 "textureNumLayers_e31be1"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_e31be1 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_e31be1
+ 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 %textureNumLayers_e31be1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_e31be1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl
new file mode 100644
index 0000000..e47d202
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e31be1.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureNumLayers_e31be1() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_e31be1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_e31be1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_e31be1();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl
new file mode 100644
index 0000000..4ee178c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureNumLayers(texture: texture_depth_2d_array) -> i32
+fn textureNumLayers_e653c0() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_e653c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_e653c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_e653c0();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl
new file mode 100644
index 0000000..c622a34
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLayers_e653c0() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_e653c0();
+ 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 textureNumLayers_e653c0() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_e653c0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLayers_e653c0() {
+ int res = textureSize(arg_0_1, 0).z;
+}
+
+void compute_main() {
+ textureNumLayers_e653c0();
+}
+
+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/textureNumLayers/e653c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.hlsl
new file mode 100644
index 0000000..07d21c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureNumLayers_e653c0() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_e653c0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_e653c0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_e653c0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl
new file mode 100644
index 0000000..ade75dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_e653c0(depth2d_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureNumLayers_e653c0(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)]]) {
+ textureNumLayers_e653c0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_e653c0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm
new file mode 100644
index 0000000..52ed923
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_e653c0 "textureNumLayers_e653c0"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_e653c0 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySizeLod %v3int %20 %int_0
+ %16 = OpCompositeExtract %int %18 2
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_e653c0
+ 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 %textureNumLayers_e653c0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_e653c0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl
new file mode 100644
index 0000000..4adddfb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/e653c0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureNumLayers_e653c0() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_e653c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_e653c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_e653c0();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl
new file mode 100644
index 0000000..ea1d4a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<r32uint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<r32uint, write>) -> i32
+fn textureNumLayers_ee942f() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_ee942f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_ee942f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_ee942f();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl
new file mode 100644
index 0000000..f5996d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_ee942f() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_ee942f();
+ 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 textureNumLayers_ee942f() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_ee942f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_ee942f() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_ee942f();
+}
+
+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/textureNumLayers/ee942f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.hlsl
new file mode 100644
index 0000000..6b49235
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureNumLayers_ee942f() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_ee942f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_ee942f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_ee942f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl
new file mode 100644
index 0000000..d8f0821
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_ee942f(texture2d_array<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureNumLayers_ee942f(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)]]) {
+ textureNumLayers_ee942f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_ee942f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm
new file mode 100644
index 0000000..e0a11d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_ee942f "textureNumLayers_ee942f"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_ee942f = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_ee942f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_ee942f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_ee942f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl
new file mode 100644
index 0000000..4d48fac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ee942f.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureNumLayers_ee942f() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_ee942f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_ee942f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_ee942f();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl
new file mode 100644
index 0000000..6445227
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba16sint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba16sint, write>) -> i32
+fn textureNumLayers_f33005() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_f33005();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_f33005();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_f33005();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl
new file mode 100644
index 0000000..541d029
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_f33005() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_f33005();
+ 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 textureNumLayers_f33005() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_f33005();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureNumLayers_f33005() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_f33005();
+}
+
+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/textureNumLayers/f33005.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.hlsl
new file mode 100644
index 0000000..4f341b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureNumLayers_f33005() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_f33005();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_f33005();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_f33005();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl
new file mode 100644
index 0000000..d415304
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_f33005(texture2d_array<int, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::write> tint_symbol_2) {
+ textureNumLayers_f33005(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)]]) {
+ textureNumLayers_f33005(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_f33005(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm
new file mode 100644
index 0000000..a6a6224
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.spvasm
@@ -0,0 +1,77 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_f33005 "textureNumLayers_f33005"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %23 = OpConstantNull %int
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_f33005 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %20 = OpLoad %11 %arg_0
+ %18 = OpImageQuerySize %v3int %20
+ %17 = OpCompositeExtract %int %18 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %textureNumLayers_f33005
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %textureNumLayers_f33005
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %textureNumLayers_f33005
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl
new file mode 100644
index 0000000..35bd8ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/f33005.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureNumLayers_f33005() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_f33005();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_f33005();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_f33005();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl
new file mode 100644
index 0000000..0fef907
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32uint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rg32uint, write>) -> i32
+fn textureNumLayers_fcec98() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_fcec98();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_fcec98();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_fcec98();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl
new file mode 100644
index 0000000..bfaa76f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_fcec98() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_fcec98();
+ 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 textureNumLayers_fcec98() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_fcec98();
+}
+
+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 textureNumLayers_fcec98() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_fcec98();
+}
+
+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/textureNumLayers/fcec98.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.hlsl
new file mode 100644
index 0000000..5ded29d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureNumLayers_fcec98() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_fcec98();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_fcec98();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_fcec98();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl
new file mode 100644
index 0000000..6233574
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_fcec98(texture2d_array<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureNumLayers_fcec98(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)]]) {
+ textureNumLayers_fcec98(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_fcec98(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm
new file mode 100644
index 0000000..b33d57b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability StorageImageExtendedFormats
+ OpCapability ImageQuery
+ 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 %textureNumLayers_fcec98 "textureNumLayers_fcec98"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_fcec98 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_fcec98
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_fcec98
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_fcec98
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl
new file mode 100644
index 0000000..6a1723e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/fcec98.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureNumLayers_fcec98() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_fcec98();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_fcec98();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_fcec98();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl
new file mode 100644
index 0000000..f12ea65
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d_array<rgba8uint, write>;
+
+// fn textureNumLayers(texture: texture_storage_2d_array<rgba8uint, write>) -> i32
+fn textureNumLayers_ff5e89() {
+ var res: i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_ff5e89();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_ff5e89();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_ff5e89();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl
new file mode 100644
index 0000000..76ca5cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_ff5e89() {
+ int res = imageSize(arg_0).z;
+}
+
+vec4 vertex_main() {
+ textureNumLayers_ff5e89();
+ 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 textureNumLayers_ff5e89() {
+ int res = imageSize(arg_0).z;
+}
+
+void fragment_main() {
+ textureNumLayers_ff5e89();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureNumLayers_ff5e89() {
+ int res = imageSize(arg_0).z;
+}
+
+void compute_main() {
+ textureNumLayers_ff5e89();
+}
+
+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/textureNumLayers/ff5e89.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.hlsl
new file mode 100644
index 0000000..4ff6d2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureNumLayers_ff5e89() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLayers_ff5e89();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLayers_ff5e89();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLayers_ff5e89();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl
new file mode 100644
index 0000000..2fb0509
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLayers_ff5e89(texture2d_array<uint, access::write> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_array_size());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::write> tint_symbol_2) {
+ textureNumLayers_ff5e89(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)]]) {
+ textureNumLayers_ff5e89(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureNumLayers_ff5e89(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm
new file mode 100644
index 0000000..ae6e277
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLayers_ff5e89 "textureNumLayers_ff5e89"
+ 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 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLayers_ff5e89 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %24
+ %21 = OpLoad %11 %arg_0
+ %19 = OpImageQuerySize %v3int %21
+ %17 = OpCompositeExtract %int %19 2
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureNumLayers_ff5e89
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLayers_ff5e89
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureNumLayers_ff5e89
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl
new file mode 100644
index 0000000..cd8cb2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLayers/ff5e89.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureNumLayers_ff5e89() {
+ var res : i32 = textureNumLayers(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLayers_ff5e89();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLayers_ff5e89();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLayers_ff5e89();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl
new file mode 100644
index 0000000..96b8e96
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+
+// fn textureNumLevels(texture: texture_depth_cube) -> i32
+fn textureNumLevels_076cb5() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_076cb5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_076cb5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_076cb5();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl
new file mode 100644
index 0000000..6b93674
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureNumLevels_076cb5() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_076cb5();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCube arg_0_1;
+void textureNumLevels_076cb5() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_076cb5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureNumLevels_076cb5() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_076cb5();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl
new file mode 100644
index 0000000..7688db9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube arg_0 : register(t0, space1);
+
+void textureNumLevels_076cb5() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_076cb5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_076cb5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_076cb5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl
new file mode 100644
index 0000000..db09bf4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_076cb5(depthcube<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_2) {
+ textureNumLevels_076cb5(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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(depthcube<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_076cb5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_076cb5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm
new file mode 100644
index 0000000..7b36c19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_076cb5 "textureNumLevels_076cb5"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_076cb5 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_076cb5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_076cb5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_076cb5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl
new file mode 100644
index 0000000..c04d6e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/076cb5.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+fn textureNumLevels_076cb5() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_076cb5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_076cb5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_076cb5();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl
new file mode 100644
index 0000000..172e090
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<i32>;
+
+// fn textureNumLevels(texture: texture_cube<i32>) -> i32
+fn textureNumLevels_080d95() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_080d95();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_080d95();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_080d95();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl
new file mode 100644
index 0000000..367bb7a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCube arg_0_1;
+void textureNumLevels_080d95() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_080d95();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isamplerCube arg_0_1;
+void textureNumLevels_080d95() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_080d95();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isamplerCube arg_0_1;
+void textureNumLevels_080d95() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_080d95();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl
new file mode 100644
index 0000000..633e7be
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<int4> arg_0 : register(t0, space1);
+
+void textureNumLevels_080d95() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_080d95();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_080d95();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_080d95();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl
new file mode 100644
index 0000000..c592ea2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_080d95(texturecube<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<int, access::sample> tint_symbol_2) {
+ textureNumLevels_080d95(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_080d95(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_080d95(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm
new file mode 100644
index 0000000..bcbd3c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_080d95 "textureNumLevels_080d95"
+ 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 Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_080d95 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_080d95
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_080d95
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_080d95
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl
new file mode 100644
index 0000000..686c908
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/080d95.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube<i32>;
+
+fn textureNumLevels_080d95() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_080d95();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_080d95();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_080d95();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl
new file mode 100644
index 0000000..dea8f54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<u32>;
+
+// fn textureNumLevels(texture: texture_2d<u32>) -> i32
+fn textureNumLevels_09ddd0() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_09ddd0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_09ddd0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_09ddd0();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl
new file mode 100644
index 0000000..0691d9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureNumLevels_09ddd0() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_09ddd0();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2D arg_0_1;
+void textureNumLevels_09ddd0() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_09ddd0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler2D arg_0_1;
+void textureNumLevels_09ddd0() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_09ddd0();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl
new file mode 100644
index 0000000..fa2c673
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<uint4> arg_0 : register(t0, space1);
+
+void textureNumLevels_09ddd0() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_09ddd0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_09ddd0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_09ddd0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl
new file mode 100644
index 0000000..43e4904
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_09ddd0(texture2d<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_2) {
+ textureNumLevels_09ddd0(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)]]) {
+ textureNumLevels_09ddd0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_09ddd0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm
new file mode 100644
index 0000000..13e73f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_09ddd0 "textureNumLevels_09ddd0"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_09ddd0 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumLevels_09ddd0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumLevels_09ddd0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumLevels_09ddd0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl
new file mode 100644
index 0000000..7a4d344
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/09ddd0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<u32>;
+
+fn textureNumLevels_09ddd0() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_09ddd0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_09ddd0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_09ddd0();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl
new file mode 100644
index 0000000..67775fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+
+// fn textureNumLevels(texture: texture_2d_array<f32>) -> i32
+fn textureNumLevels_105988() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_105988();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_105988();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_105988();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl
new file mode 100644
index 0000000..90e28da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLevels_105988() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_105988();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLevels_105988() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_105988();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLevels_105988() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_105988();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl
new file mode 100644
index 0000000..608355f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+
+void textureNumLevels_105988() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_105988();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_105988();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_105988();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl
new file mode 100644
index 0000000..c27305e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_105988(texture2d_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_2) {
+ textureNumLevels_105988(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)]]) {
+ textureNumLevels_105988(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_105988(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm
new file mode 100644
index 0000000..fd629e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_105988 "textureNumLevels_105988"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_105988 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_105988
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_105988
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_105988
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl
new file mode 100644
index 0000000..1466976
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/105988.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+fn textureNumLevels_105988() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_105988();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_105988();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_105988();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl
new file mode 100644
index 0000000..a921b0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<u32>;
+
+// fn textureNumLevels(texture: texture_1d<u32>) -> i32
+fn textureNumLevels_1e6f3b() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_1e6f3b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_1e6f3b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_1e6f3b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl
new file mode 100644
index 0000000..50f6f13
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler1D arg_0_1;
+void textureNumLevels_1e6f3b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_1e6f3b();
+ 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 textureNumLevels_1e6f3b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_1e6f3b();
+}
+
+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 textureNumLevels_1e6f3b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_1e6f3b();
+}
+
+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/textureNumLevels/1e6f3b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.hlsl
new file mode 100644
index 0000000..938309a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureNumLevels_1e6f3b() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.y;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_1e6f3b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_1e6f3b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_1e6f3b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl
new file mode 100644
index 0000000..00356f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_1e6f3b(texture1d<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::sample> tint_symbol_2) {
+ textureNumLevels_1e6f3b(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)]]) {
+ textureNumLevels_1e6f3b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_1e6f3b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm
new file mode 100644
index 0000000..80c21ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureNumLevels_1e6f3b "textureNumLevels_1e6f3b"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_1e6f3b = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumLevels_1e6f3b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumLevels_1e6f3b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumLevels_1e6f3b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl
new file mode 100644
index 0000000..3643d3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/1e6f3b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<u32>;
+
+fn textureNumLevels_1e6f3b() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_1e6f3b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_1e6f3b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_1e6f3b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl
new file mode 100644
index 0000000..c44baad
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<i32>;
+
+// fn textureNumLevels(texture: texture_2d<i32>) -> i32
+fn textureNumLevels_23f750() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_23f750();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_23f750();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_23f750();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl
new file mode 100644
index 0000000..8b96498
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureNumLevels_23f750() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_23f750();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2D arg_0_1;
+void textureNumLevels_23f750() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_23f750();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler2D arg_0_1;
+void textureNumLevels_23f750() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_23f750();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl
new file mode 100644
index 0000000..230c77c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<int4> arg_0 : register(t0, space1);
+
+void textureNumLevels_23f750() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_23f750();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_23f750();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_23f750();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl
new file mode 100644
index 0000000..571d0a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_23f750(texture2d<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_2) {
+ textureNumLevels_23f750(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)]]) {
+ textureNumLevels_23f750(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_23f750(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm
new file mode 100644
index 0000000..8dd3517
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_23f750 "textureNumLevels_23f750"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_23f750 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_23f750
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_23f750
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_23f750
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl
new file mode 100644
index 0000000..86bf588
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/23f750.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<i32>;
+
+fn textureNumLevels_23f750() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_23f750();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_23f750();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_23f750();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl
new file mode 100644
index 0000000..e94cb62
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube_array;
+
+// fn textureNumLevels(texture: texture_depth_cube_array) -> i32
+fn textureNumLevels_2c3575() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_2c3575();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_2c3575();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_2c3575();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl
new file mode 100644
index 0000000..2de59fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureNumLevels_2c3575() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_2c3575();
+ 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_0_1;
+void textureNumLevels_2c3575() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_2c3575();
+}
+
+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_0_1;
+void textureNumLevels_2c3575() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_2c3575();
+}
+
+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/textureNumLevels/2c3575.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.hlsl
new file mode 100644
index 0000000..969b67a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray arg_0 : register(t0, space1);
+
+void textureNumLevels_2c3575() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_2c3575();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_2c3575();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_2c3575();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl
new file mode 100644
index 0000000..8f7ed02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_2c3575(depthcube_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_2) {
+ textureNumLevels_2c3575(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube_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(depthcube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_2c3575(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_2c3575(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm
new file mode 100644
index 0000000..ef03d8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLevels_2c3575 "textureNumLevels_2c3575"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_2c3575 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_2c3575
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_2c3575
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_2c3575
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl
new file mode 100644
index 0000000..6f2f54d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/2c3575.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+fn textureNumLevels_2c3575() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_2c3575();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_2c3575();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_2c3575();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl
new file mode 100644
index 0000000..d7c7297
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<i32>;
+
+// fn textureNumLevels(texture: texture_1d<i32>) -> i32
+fn textureNumLevels_32a0ae() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_32a0ae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_32a0ae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_32a0ae();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl
new file mode 100644
index 0000000..b0cdc31
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler1D arg_0_1;
+void textureNumLevels_32a0ae() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_32a0ae();
+ 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 textureNumLevels_32a0ae() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_32a0ae();
+}
+
+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 textureNumLevels_32a0ae() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_32a0ae();
+}
+
+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/textureNumLevels/32a0ae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.hlsl
new file mode 100644
index 0000000..8caa756
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureNumLevels_32a0ae() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.y;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_32a0ae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_32a0ae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_32a0ae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl
new file mode 100644
index 0000000..11c0362
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_32a0ae(texture1d<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::sample> tint_symbol_2) {
+ textureNumLevels_32a0ae(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)]]) {
+ textureNumLevels_32a0ae(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_32a0ae(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm
new file mode 100644
index 0000000..283d160
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureNumLevels_32a0ae "textureNumLevels_32a0ae"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_32a0ae = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_32a0ae
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_32a0ae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_32a0ae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl
new file mode 100644
index 0000000..e5016eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/32a0ae.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<i32>;
+
+fn textureNumLevels_32a0ae() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_32a0ae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_32a0ae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_32a0ae();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl
new file mode 100644
index 0000000..371315a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<u32>;
+
+// fn textureNumLevels(texture: texture_2d_array<u32>) -> i32
+fn textureNumLevels_5101cf() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_5101cf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_5101cf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_5101cf();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl
new file mode 100644
index 0000000..e372765
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureNumLevels_5101cf() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_5101cf();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DArray arg_0_1;
+void textureNumLevels_5101cf() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_5101cf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler2DArray arg_0_1;
+void textureNumLevels_5101cf() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_5101cf();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl
new file mode 100644
index 0000000..f638579
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<uint4> arg_0 : register(t0, space1);
+
+void textureNumLevels_5101cf() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_5101cf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_5101cf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_5101cf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl
new file mode 100644
index 0000000..4a17faa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_5101cf(texture2d_array<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_2) {
+ textureNumLevels_5101cf(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)]]) {
+ textureNumLevels_5101cf(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_5101cf(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm
new file mode 100644
index 0000000..321f409
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_5101cf "textureNumLevels_5101cf"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_5101cf = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumLevels_5101cf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumLevels_5101cf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumLevels_5101cf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl
new file mode 100644
index 0000000..694397b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/5101cf.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<u32>;
+
+fn textureNumLevels_5101cf() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_5101cf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_5101cf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_5101cf();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl
new file mode 100644
index 0000000..de1c30b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+
+// fn textureNumLevels(texture: texture_1d<f32>) -> i32
+fn textureNumLevels_51b5bb() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_51b5bb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_51b5bb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_51b5bb();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl
new file mode 100644
index 0000000..8969352
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler1D arg_0_1;
+void textureNumLevels_51b5bb() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_51b5bb();
+ 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 textureNumLevels_51b5bb() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_51b5bb();
+}
+
+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 textureNumLevels_51b5bb() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_51b5bb();
+}
+
+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/textureNumLevels/51b5bb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.hlsl
new file mode 100644
index 0000000..e41c4df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureNumLevels_51b5bb() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.y;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_51b5bb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_51b5bb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_51b5bb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl
new file mode 100644
index 0000000..7acc809
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_51b5bb(texture1d<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::sample> tint_symbol_2) {
+ textureNumLevels_51b5bb(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)]]) {
+ textureNumLevels_51b5bb(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_51b5bb(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm
new file mode 100644
index 0000000..2fa2c76
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpCapability ImageQuery
+ 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 %textureNumLevels_51b5bb "textureNumLevels_51b5bb"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_51b5bb = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_51b5bb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_51b5bb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_51b5bb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl
new file mode 100644
index 0000000..2ee7aa9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/51b5bb.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+fn textureNumLevels_51b5bb() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_51b5bb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_51b5bb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_51b5bb();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl
new file mode 100644
index 0000000..b4559d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+
+// fn textureNumLevels(texture: texture_cube<f32>) -> i32
+fn textureNumLevels_897aaf() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_897aaf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_897aaf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_897aaf();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl
new file mode 100644
index 0000000..f7d707e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureNumLevels_897aaf() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_897aaf();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCube arg_0_1;
+void textureNumLevels_897aaf() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_897aaf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp samplerCube arg_0_1;
+void textureNumLevels_897aaf() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_897aaf();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl
new file mode 100644
index 0000000..1dc79b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+
+void textureNumLevels_897aaf() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_897aaf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_897aaf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_897aaf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl
new file mode 100644
index 0000000..5f6ffc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_897aaf(texturecube<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_2) {
+ textureNumLevels_897aaf(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_897aaf(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_897aaf(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm
new file mode 100644
index 0000000..2daa6e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_897aaf "textureNumLevels_897aaf"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_897aaf = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_897aaf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_897aaf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_897aaf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl
new file mode 100644
index 0000000..97e9275
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/897aaf.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+fn textureNumLevels_897aaf() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_897aaf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_897aaf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_897aaf();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl
new file mode 100644
index 0000000..75623c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<i32>;
+
+// fn textureNumLevels(texture: texture_3d<i32>) -> i32
+fn textureNumLevels_9da7a5() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_9da7a5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_9da7a5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_9da7a5();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl
new file mode 100644
index 0000000..83706c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureNumLevels_9da7a5() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_9da7a5();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler3D arg_0_1;
+void textureNumLevels_9da7a5() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_9da7a5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler3D arg_0_1;
+void textureNumLevels_9da7a5() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_9da7a5();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl
new file mode 100644
index 0000000..621c547
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<int4> arg_0 : register(t0, space1);
+
+void textureNumLevels_9da7a5() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_9da7a5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_9da7a5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_9da7a5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl
new file mode 100644
index 0000000..f813901
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_9da7a5(texture3d<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::sample> tint_symbol_2) {
+ textureNumLevels_9da7a5(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)]]) {
+ textureNumLevels_9da7a5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_9da7a5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm
new file mode 100644
index 0000000..522fe68
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_9da7a5 "textureNumLevels_9da7a5"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_9da7a5 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_9da7a5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_9da7a5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_9da7a5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl
new file mode 100644
index 0000000..5980b48
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/9da7a5.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<i32>;
+
+fn textureNumLevels_9da7a5() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_9da7a5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_9da7a5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_9da7a5();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl
new file mode 100644
index 0000000..1f9d9ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<i32>;
+
+// fn textureNumLevels(texture: texture_cube_array<i32>) -> i32
+fn textureNumLevels_a91c03() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_a91c03();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_a91c03();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_a91c03();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl
new file mode 100644
index 0000000..684bc1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isamplerCubeArray arg_0_1;
+void textureNumLevels_a91c03() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_a91c03();
+ 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_0_1;
+void textureNumLevels_a91c03() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_a91c03();
+}
+
+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_0_1;
+void textureNumLevels_a91c03() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_a91c03();
+}
+
+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/textureNumLevels/a91c03.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.hlsl
new file mode 100644
index 0000000..97c379d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<int4> arg_0 : register(t0, space1);
+
+void textureNumLevels_a91c03() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_a91c03();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_a91c03();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_a91c03();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl
new file mode 100644
index 0000000..4a151f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_a91c03(texturecube_array<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_2) {
+ textureNumLevels_a91c03(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<int, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_a91c03(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_a91c03(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm
new file mode 100644
index 0000000..ba04989
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLevels_a91c03 "textureNumLevels_a91c03"
+ 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 Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_a91c03 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_a91c03
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_a91c03
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_a91c03
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl
new file mode 100644
index 0000000..7212853
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/a91c03.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<i32>;
+
+fn textureNumLevels_a91c03() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_a91c03();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_a91c03();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_a91c03();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl
new file mode 100644
index 0000000..f28913a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+
+// fn textureNumLevels(texture: texture_cube_array<f32>) -> i32
+fn textureNumLevels_aee7c8() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_aee7c8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_aee7c8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_aee7c8();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl
new file mode 100644
index 0000000..6fbe762
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_1;
+void textureNumLevels_aee7c8() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_aee7c8();
+ 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_0_1;
+void textureNumLevels_aee7c8() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_aee7c8();
+}
+
+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_0_1;
+void textureNumLevels_aee7c8() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_aee7c8();
+}
+
+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/textureNumLevels/aee7c8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.hlsl
new file mode 100644
index 0000000..6511a2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+
+void textureNumLevels_aee7c8() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_aee7c8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_aee7c8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_aee7c8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl
new file mode 100644
index 0000000..a4627cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_aee7c8(texturecube_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_2) {
+ textureNumLevels_aee7c8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<float, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_aee7c8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_aee7c8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm
new file mode 100644
index 0000000..d5f9d13
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLevels_aee7c8 "textureNumLevels_aee7c8"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_aee7c8 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_aee7c8
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_aee7c8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_aee7c8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl
new file mode 100644
index 0000000..32c8b5a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/aee7c8.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+fn textureNumLevels_aee7c8() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_aee7c8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_aee7c8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_aee7c8();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl
new file mode 100644
index 0000000..a03922c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+
+// fn textureNumLevels(texture: texture_depth_2d) -> i32
+fn textureNumLevels_b1b12b() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_b1b12b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_b1b12b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_b1b12b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl
new file mode 100644
index 0000000..2a2119a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureNumLevels_b1b12b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_b1b12b();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureNumLevels_b1b12b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_b1b12b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureNumLevels_b1b12b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_b1b12b();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl
new file mode 100644
index 0000000..cd908dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D arg_0 : register(t0, space1);
+
+void textureNumLevels_b1b12b() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_b1b12b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_b1b12b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_b1b12b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl
new file mode 100644
index 0000000..cdda66a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_b1b12b(depth2d<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_2) {
+ textureNumLevels_b1b12b(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)]]) {
+ textureNumLevels_b1b12b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_b1b12b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm
new file mode 100644
index 0000000..dcd4a66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_b1b12b "textureNumLevels_b1b12b"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_b1b12b = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_b1b12b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_b1b12b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_b1b12b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl
new file mode 100644
index 0000000..97fd9a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b1b12b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+fn textureNumLevels_b1b12b() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_b1b12b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_b1b12b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_b1b12b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl
new file mode 100644
index 0000000..4d81449
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<u32>;
+
+// fn textureNumLevels(texture: texture_3d<u32>) -> i32
+fn textureNumLevels_b4f5ea() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_b4f5ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_b4f5ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_b4f5ea();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl
new file mode 100644
index 0000000..a857a8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureNumLevels_b4f5ea() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_b4f5ea();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler3D arg_0_1;
+void textureNumLevels_b4f5ea() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_b4f5ea();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler3D arg_0_1;
+void textureNumLevels_b4f5ea() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_b4f5ea();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl
new file mode 100644
index 0000000..92162ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<uint4> arg_0 : register(t0, space1);
+
+void textureNumLevels_b4f5ea() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_b4f5ea();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_b4f5ea();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_b4f5ea();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl
new file mode 100644
index 0000000..8c251ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_b4f5ea(texture3d<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::sample> tint_symbol_2) {
+ textureNumLevels_b4f5ea(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)]]) {
+ textureNumLevels_b4f5ea(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_b4f5ea(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm
new file mode 100644
index 0000000..6508bca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_b4f5ea "textureNumLevels_b4f5ea"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_b4f5ea = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumLevels_b4f5ea
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumLevels_b4f5ea
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumLevels_b4f5ea
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl
new file mode 100644
index 0000000..ff1823d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/b4f5ea.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<u32>;
+
+fn textureNumLevels_b4f5ea() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_b4f5ea();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_b4f5ea();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_b4f5ea();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl
new file mode 100644
index 0000000..e191da8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<i32>;
+
+// fn textureNumLevels(texture: texture_2d_array<i32>) -> i32
+fn textureNumLevels_d004a9() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_d004a9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_d004a9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_d004a9();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl
new file mode 100644
index 0000000..926ded3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureNumLevels_d004a9() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_d004a9();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DArray arg_0_1;
+void textureNumLevels_d004a9() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_d004a9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler2DArray arg_0_1;
+void textureNumLevels_d004a9() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_d004a9();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl
new file mode 100644
index 0000000..34731d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray<int4> arg_0 : register(t0, space1);
+
+void textureNumLevels_d004a9() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_d004a9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_d004a9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_d004a9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl
new file mode 100644
index 0000000..d0d19fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_d004a9(texture2d_array<int, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_2) {
+ textureNumLevels_d004a9(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)]]) {
+ textureNumLevels_d004a9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_d004a9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm
new file mode 100644
index 0000000..48fe3de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_d004a9 "textureNumLevels_d004a9"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_d004a9 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_d004a9
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_d004a9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_d004a9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl
new file mode 100644
index 0000000..e6efa4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/d004a9.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<i32>;
+
+fn textureNumLevels_d004a9() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_d004a9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_d004a9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_d004a9();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl
new file mode 100644
index 0000000..a058700
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+
+// fn textureNumLevels(texture: texture_3d<f32>) -> i32
+fn textureNumLevels_dca09e() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_dca09e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_dca09e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_dca09e();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl
new file mode 100644
index 0000000..ba0c815
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureNumLevels_dca09e() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_dca09e();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_1;
+void textureNumLevels_dca09e() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_dca09e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler3D arg_0_1;
+void textureNumLevels_dca09e() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_dca09e();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl
new file mode 100644
index 0000000..01307a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+
+void textureNumLevels_dca09e() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_dca09e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_dca09e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_dca09e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl
new file mode 100644
index 0000000..e7813c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_dca09e(texture3d<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_2) {
+ textureNumLevels_dca09e(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)]]) {
+ textureNumLevels_dca09e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_dca09e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm
new file mode 100644
index 0000000..3ee917e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_dca09e "textureNumLevels_dca09e"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_dca09e = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_dca09e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_dca09e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_dca09e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl
new file mode 100644
index 0000000..81c2ed1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/dca09e.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+fn textureNumLevels_dca09e() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_dca09e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_dca09e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_dca09e();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl
new file mode 100644
index 0000000..782d93a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+
+// fn textureNumLevels(texture: texture_2d<f32>) -> i32
+fn textureNumLevels_e67231() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_e67231();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_e67231();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_e67231();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl
new file mode 100644
index 0000000..5345038
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureNumLevels_e67231() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_e67231();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_1;
+void textureNumLevels_e67231() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_e67231();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2D arg_0_1;
+void textureNumLevels_e67231() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_e67231();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl
new file mode 100644
index 0000000..a6f8a6f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+
+void textureNumLevels_e67231() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_e67231();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_e67231();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_e67231();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl
new file mode 100644
index 0000000..0a9f1ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_e67231(texture2d<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_2) {
+ textureNumLevels_e67231(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)]]) {
+ textureNumLevels_e67231(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_e67231(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm
new file mode 100644
index 0000000..f2974bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_e67231 "textureNumLevels_e67231"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_e67231 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_e67231
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_e67231
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_e67231
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl
new file mode 100644
index 0000000..b9b5a95
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/e67231.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+fn textureNumLevels_e67231() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_e67231();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_e67231();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_e67231();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl
new file mode 100644
index 0000000..d3620a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<u32>;
+
+// fn textureNumLevels(texture: texture_cube<u32>) -> i32
+fn textureNumLevels_ed078b() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_ed078b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_ed078b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_ed078b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl
new file mode 100644
index 0000000..3293d1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCube arg_0_1;
+void textureNumLevels_ed078b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_ed078b();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usamplerCube arg_0_1;
+void textureNumLevels_ed078b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_ed078b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usamplerCube arg_0_1;
+void textureNumLevels_ed078b() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_ed078b();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl
new file mode 100644
index 0000000..75d40ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCube<uint4> arg_0 : register(t0, space1);
+
+void textureNumLevels_ed078b() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_ed078b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_ed078b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_ed078b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl
new file mode 100644
index 0000000..74d6563
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_ed078b(texturecube<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<uint, access::sample> tint_symbol_2) {
+ textureNumLevels_ed078b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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(texturecube<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_ed078b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_ed078b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm
new file mode 100644
index 0000000..78cf143
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_ed078b "textureNumLevels_ed078b"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_ed078b = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumLevels_ed078b
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumLevels_ed078b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumLevels_ed078b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl
new file mode 100644
index 0000000..1eb3d87
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/ed078b.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube<u32>;
+
+fn textureNumLevels_ed078b() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_ed078b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_ed078b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_ed078b();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl
new file mode 100644
index 0000000..665436b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<u32>;
+
+// fn textureNumLevels(texture: texture_cube_array<u32>) -> i32
+fn textureNumLevels_f46ec6() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_f46ec6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_f46ec6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_f46ec6();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl
new file mode 100644
index 0000000..1da3a81
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.glsl
@@ -0,0 +1,75 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usamplerCubeArray arg_0_1;
+void textureNumLevels_f46ec6() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_f46ec6();
+ 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_0_1;
+void textureNumLevels_f46ec6() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_f46ec6();
+}
+
+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_0_1;
+void textureNumLevels_f46ec6() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_f46ec6();
+}
+
+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/textureNumLevels/f46ec6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.hlsl
new file mode 100644
index 0000000..3a16309
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+TextureCubeArray<uint4> arg_0 : register(t0, space1);
+
+void textureNumLevels_f46ec6() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_f46ec6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_f46ec6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_f46ec6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl
new file mode 100644
index 0000000..83873b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_f46ec6(texturecube_array<uint, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_2) {
+ textureNumLevels_f46ec6(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube_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(texturecube_array<uint, access::sample> tint_symbol_4 [[texture(0)]]) {
+ textureNumLevels_f46ec6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_f46ec6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm
new file mode 100644
index 0000000..7650c28
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.spvasm
@@ -0,0 +1,76 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpCapability ImageQuery
+ 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 %textureNumLevels_f46ec6 "textureNumLevels_f46ec6"
+ 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 Cube 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_f46ec6 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQueryLevels %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumLevels_f46ec6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumLevels_f46ec6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumLevels_f46ec6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl
new file mode 100644
index 0000000..d380d9b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f46ec6.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<u32>;
+
+fn textureNumLevels_f46ec6() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_f46ec6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_f46ec6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_f46ec6();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl
new file mode 100644
index 0000000..0c000af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d_array;
+
+// fn textureNumLevels(texture: texture_depth_2d_array) -> i32
+fn textureNumLevels_f5828d() {
+ var res: i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_f5828d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_f5828d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_f5828d();
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl
new file mode 100644
index 0000000..e810a1a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLevels_f5828d() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumLevels_f5828d();
+ 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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLevels_f5828d() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumLevels_f5828d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArray arg_0_1;
+void textureNumLevels_f5828d() {
+ int res = textureQueryLevels(arg_0_1);
+}
+
+void compute_main() {
+ textureNumLevels_f5828d();
+}
+
+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:5: 'textureQueryLevels' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl
new file mode 100644
index 0000000..05d604d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DArray arg_0 : register(t0, space1);
+
+void textureNumLevels_f5828d() {
+ int4 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y, tint_tmp.z, tint_tmp.w);
+ int res = tint_tmp.w;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumLevels_f5828d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumLevels_f5828d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumLevels_f5828d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl
new file mode 100644
index 0000000..0a15025
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumLevels_f5828d(depth2d_array<float, access::sample> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_mip_levels());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_2) {
+ textureNumLevels_f5828d(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)]]) {
+ textureNumLevels_f5828d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]]) {
+ textureNumLevels_f5828d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm
new file mode 100644
index 0000000..6af2f4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumLevels_f5828d "textureNumLevels_f5828d"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumLevels_f5828d = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQueryLevels %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumLevels_f5828d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumLevels_f5828d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumLevels_f5828d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl
new file mode 100644
index 0000000..501fe61
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumLevels/f5828d.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+fn textureNumLevels_f5828d() {
+ var res : i32 = textureNumLevels(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumLevels_f5828d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumLevels_f5828d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumLevels_f5828d();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl
new file mode 100644
index 0000000..749d887
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<f32>;
+
+// fn textureNumSamples(texture: texture_multisampled_2d<f32>) -> i32
+fn textureNumSamples_2c6f14() {
+ var res: i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_2c6f14();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_2c6f14();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_2c6f14();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl
new file mode 100644
index 0000000..5abe128
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureNumSamples_2c6f14() {
+ int res = textureSamples(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumSamples_2c6f14();
+ 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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureNumSamples_2c6f14() {
+ int res = textureSamples(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumSamples_2c6f14();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureSamples' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureNumSamples_2c6f14() {
+ int res = textureSamples(arg_0_1);
+}
+
+void compute_main() {
+ textureNumSamples_2c6f14();
+}
+
+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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl
new file mode 100644
index 0000000..6c3feaf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureNumSamples_2c6f14() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumSamples_2c6f14();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumSamples_2c6f14();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumSamples_2c6f14();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl
new file mode 100644
index 0000000..b062129
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumSamples_2c6f14(texture2d_ms<float, access::read> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_samples());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<float, access::read> tint_symbol_2) {
+ textureNumSamples_2c6f14(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)]]) {
+ textureNumSamples_2c6f14(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureNumSamples_2c6f14(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm
new file mode 100644
index 0000000..f1b55e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumSamples_2c6f14 "textureNumSamples_2c6f14"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumSamples_2c6f14 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySamples %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumSamples_2c6f14
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumSamples_2c6f14
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumSamples_2c6f14
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl
new file mode 100644
index 0000000..be49934
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/2c6f14.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<f32>;
+
+fn textureNumSamples_2c6f14() {
+ var res : i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_2c6f14();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_2c6f14();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_2c6f14();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl
new file mode 100644
index 0000000..429e2eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<u32>;
+
+// fn textureNumSamples(texture: texture_multisampled_2d<u32>) -> i32
+fn textureNumSamples_42f8bb() {
+ var res: i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_42f8bb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_42f8bb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_42f8bb();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl
new file mode 100644
index 0000000..8a06334
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureNumSamples_42f8bb() {
+ int res = textureSamples(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumSamples_42f8bb();
+ 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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp usampler2DMS arg_0_1;
+void textureNumSamples_42f8bb() {
+ int res = textureSamples(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumSamples_42f8bb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureSamples' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp usampler2DMS arg_0_1;
+void textureNumSamples_42f8bb() {
+ int res = textureSamples(arg_0_1);
+}
+
+void compute_main() {
+ textureNumSamples_42f8bb();
+}
+
+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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl
new file mode 100644
index 0000000..415abda
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<uint4> arg_0 : register(t0, space1);
+
+void textureNumSamples_42f8bb() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumSamples_42f8bb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumSamples_42f8bb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumSamples_42f8bb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl
new file mode 100644
index 0000000..d951a7e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumSamples_42f8bb(texture2d_ms<uint, access::read> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_samples());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<uint, access::read> tint_symbol_2) {
+ textureNumSamples_42f8bb(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)]]) {
+ textureNumSamples_42f8bb(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<uint, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureNumSamples_42f8bb(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm
new file mode 100644
index 0000000..a8b6504
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumSamples_42f8bb "textureNumSamples_42f8bb"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumSamples_42f8bb = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %19 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySamples %int %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %textureNumSamples_42f8bb
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureNumSamples_42f8bb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureNumSamples_42f8bb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl
new file mode 100644
index 0000000..ef11b63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/42f8bb.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<u32>;
+
+fn textureNumSamples_42f8bb() {
+ var res : i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_42f8bb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_42f8bb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_42f8bb();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl
new file mode 100644
index 0000000..e5e5baf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_multisampled_2d<i32>;
+
+// fn textureNumSamples(texture: texture_multisampled_2d<i32>) -> i32
+fn textureNumSamples_449d23() {
+ var res: i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_449d23();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_449d23();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_449d23();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl
new file mode 100644
index 0000000..2b60dd5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureNumSamples_449d23() {
+ int res = textureSamples(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumSamples_449d23();
+ 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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp isampler2DMS arg_0_1;
+void textureNumSamples_449d23() {
+ int res = textureSamples(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumSamples_449d23();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureSamples' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp isampler2DMS arg_0_1;
+void textureNumSamples_449d23() {
+ int res = textureSamples(arg_0_1);
+}
+
+void compute_main() {
+ textureNumSamples_449d23();
+}
+
+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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl
new file mode 100644
index 0000000..4dbf2f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<int4> arg_0 : register(t0, space1);
+
+void textureNumSamples_449d23() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumSamples_449d23();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumSamples_449d23();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumSamples_449d23();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl
new file mode 100644
index 0000000..18e0ad7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumSamples_449d23(texture2d_ms<int, access::read> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_samples());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_ms<int, access::read> tint_symbol_2) {
+ textureNumSamples_449d23(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)]]) {
+ textureNumSamples_449d23(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_ms<int, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureNumSamples_449d23(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm
new file mode 100644
index 0000000..f89f901
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumSamples_449d23 "textureNumSamples_449d23"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumSamples_449d23 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %17 = OpImageQuerySamples %int %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumSamples_449d23
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumSamples_449d23
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumSamples_449d23
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl
new file mode 100644
index 0000000..9cab69e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/449d23.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_multisampled_2d<i32>;
+
+fn textureNumSamples_449d23() {
+ var res : i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_449d23();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_449d23();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_449d23();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl
new file mode 100644
index 0000000..11df4fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_multisampled_2d;
+
+// fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32
+fn textureNumSamples_a3c8a0() {
+ var res: i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_a3c8a0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_a3c8a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_a3c8a0();
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl
new file mode 100644
index 0000000..826c680
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.glsl
@@ -0,0 +1,78 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureNumSamples_a3c8a0() {
+ int res = textureSamples(arg_0_1);
+}
+
+vec4 vertex_main() {
+ textureNumSamples_a3c8a0();
+ 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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DMS arg_0_1;
+void textureNumSamples_a3c8a0() {
+ int res = textureSamples(arg_0_1);
+}
+
+void fragment_main() {
+ textureNumSamples_a3c8a0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:6: 'textureSamples' : no matching overloaded function found
+ERROR: 0:6: '=' : cannot convert from ' const float' to ' temp mediump int'
+ERROR: 0:6: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DMS arg_0_1;
+void textureNumSamples_a3c8a0() {
+ int res = textureSamples(arg_0_1);
+}
+
+void compute_main() {
+ textureNumSamples_a3c8a0();
+}
+
+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:5: 'textureSamples' : no matching overloaded function found
+ERROR: 0:5: '=' : cannot convert from ' const float' to ' temp highp int'
+ERROR: 0:5: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl
new file mode 100644
index 0000000..0eb375a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+Texture2DMS<float4> arg_0 : register(t0, space1);
+
+void textureNumSamples_a3c8a0() {
+ int3 tint_tmp;
+ arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
+ int res = tint_tmp.z;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureNumSamples_a3c8a0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureNumSamples_a3c8a0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureNumSamples_a3c8a0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl
new file mode 100644
index 0000000..c3db04e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureNumSamples_a3c8a0(depth2d_ms<float, access::read> tint_symbol_1) {
+ int res = int(tint_symbol_1.get_num_samples());
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_ms<float, access::read> tint_symbol_2) {
+ textureNumSamples_a3c8a0(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)]]) {
+ textureNumSamples_a3c8a0(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(depth2d_ms<float, access::read> tint_symbol_5 [[texture(0)]]) {
+ textureNumSamples_a3c8a0(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm
new file mode 100644
index 0000000..a6f64b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 36
+; Schema: 0
+ OpCapability Shader
+ OpCapability ImageQuery
+ 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 %textureNumSamples_a3c8a0 "textureNumSamples_a3c8a0"
+ 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
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %22 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureNumSamples_a3c8a0 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %21
+ %18 = OpLoad %11 %arg_0
+ %16 = OpImageQuerySamples %int %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %22
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %textureNumSamples_a3c8a0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %27 = OpLabel
+ %28 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %28
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureNumSamples_a3c8a0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureNumSamples_a3c8a0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl
new file mode 100644
index 0000000..29a914a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureNumSamples/a3c8a0.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+@group(1) @binding(0) var arg_0 : texture_depth_multisampled_2d;
+
+fn textureNumSamples_a3c8a0() {
+ var res : i32 = textureNumSamples(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureNumSamples_a3c8a0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureNumSamples_a3c8a0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureNumSamples_a3c8a0();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl
new file mode 100644
index 0000000..0add540
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> f32
+fn textureSample_0dff6c() {
+ var arg_2 = vec2<f32>();
+ var res: f32 = textureSample(arg_0, arg_1, arg_2, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_0dff6c();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl
new file mode 100644
index 0000000..29464a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSample_0dff6c() {
+ vec2 arg_2 = vec2(0.0f);
+ float res = textureOffset(arg_0_arg_1, vec3(arg_2, 0.0f), ivec2(0));
+}
+
+void fragment_main() {
+ textureSample_0dff6c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl
new file mode 100644
index 0000000..4bd60c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_0dff6c() {
+ float2 arg_2 = (0.0f).xx;
+ float res = arg_0.Sample(arg_1, arg_2, (0).xx).x;
+}
+
+void fragment_main() {
+ textureSample_0dff6c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl
new file mode 100644
index 0000000..b6fd486
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_0dff6c(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float res = tint_symbol.sample(tint_symbol_1, arg_2, int2(0));
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_0dff6c(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm
new file mode 100644
index 0000000..d548219
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_0dff6c "textureSample_0dff6c"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %v4float = OpTypeVector %float 4
+ %21 = OpTypeSampledImage %3
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %26 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpConstantNull %float
+%textureSample_0dff6c = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %res = OpVariable %_ptr_Function_float Function %29
+ OpStore %arg_2 %13
+ %19 = OpLoad %7 %arg_1
+ %20 = OpLoad %3 %arg_0
+ %22 = OpSampledImage %21 %20 %19
+ %23 = OpLoad %v2float %arg_2
+ %17 = OpImageSampleImplicitLod %v4float %22 %23 ConstOffset %26
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureSample_0dff6c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl
new file mode 100644
index 0000000..20cb56f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/0dff6c.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_0dff6c() {
+ var arg_2 = vec2<f32>();
+ var res : f32 = textureSample(arg_0, arg_1, arg_2, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_0dff6c();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl
new file mode 100644
index 0000000..96fe6ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSample_17e988() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_17e988();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl
new file mode 100644
index 0000000..95e45f8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSample_17e988() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = textureOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), ivec2(0));
+}
+
+void fragment_main() {
+ textureSample_17e988();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl
new file mode 100644
index 0000000..87521f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_17e988() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx);
+}
+
+void fragment_main() {
+ textureSample_17e988();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl
new file mode 100644
index 0000000..19433eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_17e988(texture2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, int2(0));
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_17e988(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm
new file mode 100644
index 0000000..4bb6bba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.spvasm
@@ -0,0 +1,68 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_17e988 "textureSample_17e988"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %v4float = OpTypeVector %float 4
+ %25 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %35 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %38 = OpConstantNull %v4float
+%textureSample_17e988 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %38
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ %23 = OpLoad %7 %arg_1
+ %24 = OpLoad %3 %arg_0
+ %26 = OpSampledImage %25 %24 %23
+ %28 = OpLoad %v2float %arg_2
+ %29 = OpCompositeExtract %float %28 0
+ %30 = OpCompositeExtract %float %28 1
+ %32 = OpLoad %int %arg_3
+ %31 = OpConvertSToF %float %32
+ %33 = OpCompositeConstruct %v3float %29 %30 %31
+ %21 = OpImageSampleImplicitLod %v4float %26 %33 ConstOffset %35
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSample_17e988
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl
new file mode 100644
index 0000000..f2733c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/17e988.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_17e988() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_17e988();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl
new file mode 100644
index 0000000..04300d36
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, @const offset: vec3<i32>) -> vec4<f32>
+fn textureSample_2149ec() {
+ var arg_2 = vec3<f32>();
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2, vec3<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_2149ec();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl
new file mode 100644
index 0000000..67fde95
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSample_2149ec() {
+ vec3 arg_2 = vec3(0.0f);
+ vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(0));
+}
+
+void fragment_main() {
+ textureSample_2149ec();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl
new file mode 100644
index 0000000..1528b90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_2149ec() {
+ float3 arg_2 = (0.0f).xxx;
+ float4 res = arg_0.Sample(arg_1, arg_2, (0).xxx);
+}
+
+void fragment_main() {
+ textureSample_2149ec();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl
new file mode 100644
index 0000000..96ab51e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_2149ec(texture3d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, int3(0));
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_2149ec(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm
new file mode 100644
index 0000000..8e435b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_2149ec "textureSample_2149ec"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %v4float = OpTypeVector %float 4
+ %20 = OpTypeSampledImage %3
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %25 = OpConstantNull %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %28 = OpConstantNull %v4float
+%textureSample_2149ec = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %res = OpVariable %_ptr_Function_v4float Function %28
+ OpStore %arg_2 %13
+ %18 = OpLoad %7 %arg_1
+ %19 = OpLoad %3 %arg_0
+ %21 = OpSampledImage %20 %19 %18
+ %22 = OpLoad %v3float %arg_2
+ %16 = OpImageSampleImplicitLod %v4float %21 %22 ConstOffset %25
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureSample_2149ec
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl
new file mode 100644
index 0000000..8b881c3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/2149ec.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_2149ec() {
+ var arg_2 = vec3<f32>();
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2, vec3<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_2149ec();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl
new file mode 100644
index 0000000..fc21827
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>) -> f32
+fn textureSample_38bbb9() {
+ var arg_2 = vec2<f32>();
+ var res: f32 = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_38bbb9();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl
new file mode 100644
index 0000000..31f10fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSample_38bbb9() {
+ vec2 arg_2 = vec2(0.0f);
+ float res = texture(arg_0_arg_1, vec3(arg_2, 0.0f));
+}
+
+void fragment_main() {
+ textureSample_38bbb9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl
new file mode 100644
index 0000000..ffedf8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_38bbb9() {
+ float2 arg_2 = (0.0f).xx;
+ float res = arg_0.Sample(arg_1, arg_2).x;
+}
+
+void fragment_main() {
+ textureSample_38bbb9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl
new file mode 100644
index 0000000..6482503
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_38bbb9(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float res = tint_symbol.sample(tint_symbol_1, arg_2);
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_38bbb9(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm
new file mode 100644
index 0000000..05511e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_38bbb9 "textureSample_38bbb9"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %v4float = OpTypeVector %float 4
+ %21 = OpTypeSampledImage %3
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpConstantNull %float
+%textureSample_38bbb9 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %res = OpVariable %_ptr_Function_float Function %26
+ OpStore %arg_2 %13
+ %19 = OpLoad %7 %arg_1
+ %20 = OpLoad %3 %arg_0
+ %22 = OpSampledImage %21 %20 %19
+ %23 = OpLoad %v2float %arg_2
+ %17 = OpImageSampleImplicitLod %v4float %22 %23
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureSample_38bbb9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl
new file mode 100644
index 0000000..b0e17c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/38bbb9.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_38bbb9() {
+ var arg_2 = vec2<f32>();
+ var res : f32 = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_38bbb9();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl
new file mode 100644
index 0000000..903d540
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>) -> vec4<f32>
+fn textureSample_3b50bd() {
+ var arg_2 = vec3<f32>();
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_3b50bd();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl
new file mode 100644
index 0000000..1f936b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSample_3b50bd() {
+ vec3 arg_2 = vec3(0.0f);
+ vec4 res = texture(arg_0_arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_3b50bd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl
new file mode 100644
index 0000000..29a54ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_3b50bd() {
+ float3 arg_2 = (0.0f).xxx;
+ float4 res = arg_0.Sample(arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_3b50bd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl
new file mode 100644
index 0000000..0bf2684
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_3b50bd(texture3d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2);
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_3b50bd(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm
new file mode 100644
index 0000000..2539dd1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_3b50bd "textureSample_3b50bd"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %v4float = OpTypeVector %float 4
+ %20 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpConstantNull %v4float
+%textureSample_3b50bd = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %res = OpVariable %_ptr_Function_v4float Function %25
+ OpStore %arg_2 %13
+ %18 = OpLoad %7 %arg_1
+ %19 = OpLoad %3 %arg_0
+ %21 = OpSampledImage %20 %19 %18
+ %22 = OpLoad %v3float %arg_2
+ %16 = OpImageSampleImplicitLod %v4float %21 %22
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureSample_3b50bd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl
new file mode 100644
index 0000000..3c2755f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/3b50bd.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_3b50bd() {
+ var arg_2 = vec3<f32>();
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_3b50bd();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl
new file mode 100644
index 0000000..c4e81e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
+fn textureSample_4dd1bf() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_4dd1bf();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl
new file mode 100644
index 0000000..8d39802
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.glsl
@@ -0,0 +1,28 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArray arg_0_arg_1;
+
+void textureSample_4dd1bf() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec4 res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)));
+}
+
+void fragment_main() {
+ textureSample_4dd1bf();
+}
+
+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.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl
new file mode 100644
index 0000000..c779be1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_4dd1bf() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float4 res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3)));
+}
+
+void fragment_main() {
+ textureSample_4dd1bf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl
new file mode 100644
index 0000000..89cfd57
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_4dd1bf(texturecube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3);
+}
+
+fragment void fragment_main(texturecube_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_4dd1bf(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm
new file mode 100644
index 0000000..131c440
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_4dd1bf "textureSample_4dd1bf"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %v4float = OpTypeVector %float 4
+ %25 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %36 = OpConstantNull %v4float
+%textureSample_4dd1bf = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %36
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ %23 = OpLoad %7 %arg_1
+ %24 = OpLoad %3 %arg_0
+ %26 = OpSampledImage %25 %24 %23
+ %27 = OpLoad %v3float %arg_2
+ %28 = OpCompositeExtract %float %27 0
+ %29 = OpCompositeExtract %float %27 1
+ %30 = OpCompositeExtract %float %27 2
+ %32 = OpLoad %int %arg_3
+ %31 = OpConvertSToF %float %32
+ %33 = OpCompositeConstruct %v4float %28 %29 %30 %31
+ %21 = OpImageSampleImplicitLod %v4float %26 %33
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureSample_4dd1bf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl
new file mode 100644
index 0000000..8c622de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/4dd1bf.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_4dd1bf() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_4dd1bf();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl
new file mode 100644
index 0000000..323375e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
+fn textureSample_51b514() {
+ var arg_2 = vec2<f32>();
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_51b514();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl
new file mode 100644
index 0000000..ab891bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSample_51b514() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = texture(arg_0_arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_51b514();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl
new file mode 100644
index 0000000..32dce22
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_51b514() {
+ float2 arg_2 = (0.0f).xx;
+ float4 res = arg_0.Sample(arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_51b514();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl
new file mode 100644
index 0000000..bffded9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_51b514(texture2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2);
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_51b514(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm
new file mode 100644
index 0000000..fe14ef4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_51b514 "textureSample_51b514"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %v4float = OpTypeVector %float 4
+ %20 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpConstantNull %v4float
+%textureSample_51b514 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %res = OpVariable %_ptr_Function_v4float Function %25
+ OpStore %arg_2 %13
+ %18 = OpLoad %7 %arg_1
+ %19 = OpLoad %3 %arg_0
+ %21 = OpSampledImage %20 %19 %18
+ %22 = OpLoad %v2float %arg_2
+ %16 = OpImageSampleImplicitLod %v4float %21 %22
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureSample_51b514
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl
new file mode 100644
index 0000000..282e6eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/51b514.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_51b514() {
+ var arg_2 = vec2<f32>();
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_51b514();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl
new file mode 100644
index 0000000..93a8e2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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 textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, @const offset: vec2<i32>) -> f32
+fn textureSample_60bf45() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_60bf45();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl
new file mode 100644
index 0000000..bd4eaf2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.glsl
@@ -0,0 +1,28 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSample_60bf45() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), ivec2(0));
+}
+
+void fragment_main() {
+ textureSample_60bf45();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:9: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl
new file mode 100644
index 0000000..6a9339e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_60bf45() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)), (0).xx).x;
+}
+
+void fragment_main() {
+ textureSample_60bf45();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl
new file mode 100644
index 0000000..b822a47
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_60bf45(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, int2(0));
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_60bf45(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm
new file mode 100644
index 0000000..efd63d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_60bf45 "textureSample_60bf45"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %v4float = OpTypeVector %float 4
+ %26 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %36 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %39 = OpConstantNull %float
+%textureSample_60bf45 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_float Function %39
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ %24 = OpLoad %7 %arg_1
+ %25 = OpLoad %3 %arg_0
+ %27 = OpSampledImage %26 %25 %24
+ %29 = OpLoad %v2float %arg_2
+ %30 = OpCompositeExtract %float %29 0
+ %31 = OpCompositeExtract %float %29 1
+ %33 = OpLoad %int %arg_3
+ %32 = OpConvertSToF %float %33
+ %34 = OpCompositeConstruct %v3float %30 %31 %32
+ %22 = OpImageSampleImplicitLod %v4float %27 %34 ConstOffset %36
+ %21 = OpCompositeExtract %float %22 0
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureSample_60bf45
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl
new file mode 100644
index 0000000..dd2484a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/60bf45.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_60bf45() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_60bf45();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl
new file mode 100644
index 0000000..26bab94
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
+fn textureSample_6717ca() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_6717ca();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl
new file mode 100644
index 0000000..d8cdc14
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSample_6717ca() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec4 res = texture(arg_0_arg_1, vec3(arg_2, float(arg_3)));
+}
+
+void fragment_main() {
+ textureSample_6717ca();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl
new file mode 100644
index 0000000..01c97bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_6717ca() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float4 res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3)));
+}
+
+void fragment_main() {
+ textureSample_6717ca();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl
new file mode 100644
index 0000000..e512eca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_6717ca(texture2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3);
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_6717ca(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm
new file mode 100644
index 0000000..8fd8ccf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 40
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_6717ca "textureSample_6717ca"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %v4float = OpTypeVector %float 4
+ %25 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %36 = OpConstantNull %v4float
+%textureSample_6717ca = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %36
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ %23 = OpLoad %7 %arg_1
+ %24 = OpLoad %3 %arg_0
+ %26 = OpSampledImage %25 %24 %23
+ %28 = OpLoad %v2float %arg_2
+ %29 = OpCompositeExtract %float %28 0
+ %30 = OpCompositeExtract %float %28 1
+ %32 = OpLoad %int %arg_3
+ %31 = OpConvertSToF %float %32
+ %33 = OpCompositeConstruct %v3float %29 %30 %31
+ %21 = OpImageSampleImplicitLod %v4float %26 %33
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureSample_6717ca
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl
new file mode 100644
index 0000000..0e18da9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6717ca.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_6717ca() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_6717ca();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl
new file mode 100644
index 0000000..8218caa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_1d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_1d<f32>, sampler: sampler, coords: f32) -> vec4<f32>
+fn textureSample_6e64fb() {
+ var arg_2 = 1.0;
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_6e64fb();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl
new file mode 100644
index 0000000..15771c5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.glsl
@@ -0,0 +1,27 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler1D arg_0_arg_1;
+
+void textureSample_6e64fb() {
+ float arg_2 = 1.0f;
+ vec4 res = texture(arg_0_arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_6e64fb();
+}
+
+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.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl
new file mode 100644
index 0000000..e62e875
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_6e64fb() {
+ float arg_2 = 1.0f;
+ float4 res = arg_0.Sample(arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_6e64fb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl
new file mode 100644
index 0000000..3a9b0a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_6e64fb(texture1d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float arg_2 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2);
+}
+
+fragment void fragment_main(texture1d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_6e64fb(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm
new file mode 100644
index 0000000..be90026
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpCapability Sampled1D
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_6e64fb "textureSample_6e64fb"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %15 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %20 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpConstantNull %v4float
+%textureSample_6e64fb = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_float Function %15
+ %res = OpVariable %_ptr_Function_v4float Function %25
+ OpStore %arg_2 %float_1
+ %18 = OpLoad %7 %arg_1
+ %19 = OpLoad %3 %arg_0
+ %21 = OpSampledImage %20 %19 %18
+ %22 = OpLoad %float %arg_2
+ %16 = OpImageSampleImplicitLod %v4float %21 %22
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureSample_6e64fb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl
new file mode 100644
index 0000000..77e51ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/6e64fb.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_1d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_6e64fb() {
+ var arg_2 = 1.0;
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_6e64fb();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl
new file mode 100644
index 0000000..b08991a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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 textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32) -> f32
+fn textureSample_7e9ffd() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_7e9ffd();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl
new file mode 100644
index 0000000..1f79b36
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSample_7e9ffd() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f));
+}
+
+void fragment_main() {
+ textureSample_7e9ffd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl
new file mode 100644
index 0000000..88b7a82
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_7e9ffd() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float res = arg_0.Sample(arg_1, float3(arg_2, float(arg_3))).x;
+}
+
+void fragment_main() {
+ textureSample_7e9ffd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl
new file mode 100644
index 0000000..9a29676
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_7e9ffd(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3);
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_7e9ffd(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm
new file mode 100644
index 0000000..76ef866
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.spvasm
@@ -0,0 +1,67 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_7e9ffd "textureSample_7e9ffd"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %v4float = OpTypeVector %float 4
+ %26 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %37 = OpConstantNull %float
+%textureSample_7e9ffd = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_float Function %37
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ %24 = OpLoad %7 %arg_1
+ %25 = OpLoad %3 %arg_0
+ %27 = OpSampledImage %26 %25 %24
+ %29 = OpLoad %v2float %arg_2
+ %30 = OpCompositeExtract %float %29 0
+ %31 = OpCompositeExtract %float %29 1
+ %33 = OpLoad %int %arg_3
+ %32 = OpConvertSToF %float %33
+ %34 = OpCompositeConstruct %v3float %30 %31 %32
+ %22 = OpImageSampleImplicitLod %v4float %27 %34
+ %21 = OpCompositeExtract %float %22 0
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureSample_7e9ffd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl
new file mode 100644
index 0000000..a2a7b82
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/7e9ffd.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_7e9ffd() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_7e9ffd();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl
new file mode 100644
index 0000000..c32bd33
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSample_85c4ba() {
+ var arg_2 = vec2<f32>();
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_85c4ba();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl
new file mode 100644
index 0000000..7ec1594
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSample_85c4ba() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(0));
+}
+
+void fragment_main() {
+ textureSample_85c4ba();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl
new file mode 100644
index 0000000..d96272b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_85c4ba() {
+ float2 arg_2 = (0.0f).xx;
+ float4 res = arg_0.Sample(arg_1, arg_2, (0).xx);
+}
+
+void fragment_main() {
+ textureSample_85c4ba();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl
new file mode 100644
index 0000000..16f9ef6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_85c4ba(texture2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, int2(0));
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_85c4ba(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm
new file mode 100644
index 0000000..96546eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.spvasm
@@ -0,0 +1,56 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_85c4ba "textureSample_85c4ba"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %v4float = OpTypeVector %float 4
+ %20 = OpTypeSampledImage %3
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %25 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %28 = OpConstantNull %v4float
+%textureSample_85c4ba = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %res = OpVariable %_ptr_Function_v4float Function %28
+ OpStore %arg_2 %13
+ %18 = OpLoad %7 %arg_1
+ %19 = OpLoad %3 %arg_0
+ %21 = OpSampledImage %20 %19 %18
+ %22 = OpLoad %v2float %arg_2
+ %16 = OpImageSampleImplicitLod %v4float %21 %22 ConstOffset %25
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %textureSample_85c4ba
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl
new file mode 100644
index 0000000..7d0cdcd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/85c4ba.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_85c4ba() {
+ var arg_2 = vec2<f32>();
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_85c4ba();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl
new file mode 100644
index 0000000..57133e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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 textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32) -> f32
+fn textureSample_c2f4e8() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var res: f32 = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_c2f4e8();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl
new file mode 100644
index 0000000..31ee71f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.glsl
@@ -0,0 +1,28 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSample_c2f4e8() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), 0.0f);
+}
+
+void fragment_main() {
+ textureSample_c2f4e8();
+}
+
+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.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl
new file mode 100644
index 0000000..209b7d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_c2f4e8() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float res = arg_0.Sample(arg_1, float4(arg_2, float(arg_3))).x;
+}
+
+void fragment_main() {
+ textureSample_c2f4e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl
new file mode 100644
index 0000000..0a8ee57
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_c2f4e8(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3);
+}
+
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_c2f4e8(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm
new file mode 100644
index 0000000..357c5ff
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.spvasm
@@ -0,0 +1,68 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_c2f4e8 "textureSample_c2f4e8"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %v4float = OpTypeVector %float 4
+ %26 = OpTypeSampledImage %3
+%_ptr_Function_float = OpTypePointer Function %float
+ %37 = OpConstantNull %float
+%textureSample_c2f4e8 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %res = OpVariable %_ptr_Function_float Function %37
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ %24 = OpLoad %7 %arg_1
+ %25 = OpLoad %3 %arg_0
+ %27 = OpSampledImage %26 %25 %24
+ %28 = OpLoad %v3float %arg_2
+ %29 = OpCompositeExtract %float %28 0
+ %30 = OpCompositeExtract %float %28 1
+ %31 = OpCompositeExtract %float %28 2
+ %33 = OpLoad %int %arg_3
+ %32 = OpConvertSToF %float %33
+ %34 = OpCompositeConstruct %v4float %29 %30 %31 %32
+ %22 = OpImageSampleImplicitLod %v4float %27 %34
+ %21 = OpCompositeExtract %float %22 0
+ OpStore %res %21
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureSample_c2f4e8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl
new file mode 100644
index 0000000..e80cfd0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/c2f4e8.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_c2f4e8() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var res : f32 = textureSample(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_c2f4e8();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl
new file mode 100644
index 0000000..2f1f317
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>) -> vec4<f32>
+fn textureSample_e53267() {
+ var arg_2 = vec3<f32>();
+ var res: vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_e53267();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl
new file mode 100644
index 0000000..7bfc11a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCube arg_0_arg_1;
+
+void textureSample_e53267() {
+ vec3 arg_2 = vec3(0.0f);
+ vec4 res = texture(arg_0_arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_e53267();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl
new file mode 100644
index 0000000..171df8a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_e53267() {
+ float3 arg_2 = (0.0f).xxx;
+ float4 res = arg_0.Sample(arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureSample_e53267();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl
new file mode 100644
index 0000000..f6987da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_e53267(texturecube<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2);
+}
+
+fragment void fragment_main(texturecube<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_e53267(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm
new file mode 100644
index 0000000..7a35d91
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.spvasm
@@ -0,0 +1,53 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_e53267 "textureSample_e53267"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %v4float = OpTypeVector %float 4
+ %20 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %25 = OpConstantNull %v4float
+%textureSample_e53267 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %res = OpVariable %_ptr_Function_v4float Function %25
+ OpStore %arg_2 %13
+ %18 = OpLoad %7 %arg_1
+ %19 = OpLoad %3 %arg_0
+ %21 = OpSampledImage %20 %19 %18
+ %22 = OpLoad %v3float %arg_2
+ %16 = OpImageSampleImplicitLod %v4float %21 %22
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %textureSample_e53267
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl
new file mode 100644
index 0000000..3b43395
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/e53267.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_e53267() {
+ var arg_2 = vec3<f32>();
+ var res : vec4<f32> = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_e53267();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl
new file mode 100644
index 0000000..252c7d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl
@@ -0,0 +1,37 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>) -> f32
+fn textureSample_ea7030() {
+ var arg_2 = vec3<f32>();
+ var res: f32 = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_ea7030();
+}
diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl
new file mode 100644
index 0000000..5658098
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.glsl
@@ -0,0 +1,18 @@
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSample_ea7030() {
+ vec3 arg_2 = vec3(0.0f);
+ float res = texture(arg_0_arg_1, vec4(arg_2, 0.0f));
+}
+
+void fragment_main() {
+ textureSample_ea7030();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl
new file mode 100644
index 0000000..35bbed72
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.hlsl
@@ -0,0 +1,12 @@
+TextureCube arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSample_ea7030() {
+ float3 arg_2 = (0.0f).xxx;
+ float res = arg_0.Sample(arg_1, arg_2).x;
+}
+
+void fragment_main() {
+ textureSample_ea7030();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl
new file mode 100644
index 0000000..daefdff
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.msl
@@ -0,0 +1,13 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSample_ea7030(depthcube<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float res = tint_symbol.sample(tint_symbol_1, arg_2);
+}
+
+fragment void fragment_main(depthcube<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSample_ea7030(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm
new file mode 100644
index 0000000..b7bf9af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.spvasm
@@ -0,0 +1,54 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSample_ea7030 "textureSample_ea7030"
+ OpName %arg_2 "arg_2"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %v4float = OpTypeVector %float 4
+ %21 = OpTypeSampledImage %3
+%_ptr_Function_float = OpTypePointer Function %float
+ %26 = OpConstantNull %float
+%textureSample_ea7030 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %res = OpVariable %_ptr_Function_float Function %26
+ OpStore %arg_2 %13
+ %19 = OpLoad %7 %arg_1
+ %20 = OpLoad %3 %arg_0
+ %22 = OpSampledImage %21 %20 %19
+ %23 = OpLoad %v3float %arg_2
+ %17 = OpImageSampleImplicitLod %v4float %22 %23
+ %16 = OpCompositeExtract %float %17 0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %textureSample_ea7030
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl
new file mode 100644
index 0000000..ad04cbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSample/ea7030.wgsl.expected.wgsl
@@ -0,0 +1,13 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSample_ea7030() {
+ var arg_2 = vec3<f32>();
+ var res : f32 = textureSample(arg_0, arg_1, arg_2);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSample_ea7030();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl
new file mode 100644
index 0000000..f8e76aa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, bias: f32) -> vec4<f32>
+fn textureSampleBias_53b9f7() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_53b9f7();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl
new file mode 100644
index 0000000..2629869
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCube arg_0_arg_1;
+
+void textureSampleBias_53b9f7() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = texture(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_53b9f7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl
new file mode 100644
index 0000000..6fd7133
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_53b9f7() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_53b9f7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl
new file mode 100644
index 0000000..c9ed71a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_53b9f7(texturecube<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3));
+}
+
+fragment void fragment_main(texturecube<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_53b9f7(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm
new file mode 100644
index 0000000..58add66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_53b9f7 "textureSampleBias_53b9f7"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %30 = OpConstantNull %v4float
+%textureSampleBias_53b9f7 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_v4float Function %30
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %22 = OpLoad %7 %arg_1
+ %23 = OpLoad %3 %arg_0
+ %25 = OpSampledImage %24 %23 %22
+ %26 = OpLoad %v3float %arg_2
+ %27 = OpLoad %float %arg_3
+ %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureSampleBias_53b9f7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl
new file mode 100644
index 0000000..f83ff9a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_53b9f7() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_53b9f7();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl
new file mode 100644
index 0000000..01130c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, bias: f32, @const offset: vec3<i32>) -> vec4<f32>
+fn textureSampleBias_594824() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec3<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_594824();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl
new file mode 100644
index 0000000..86b3985
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleBias_594824() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(0), arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_594824();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl
new file mode 100644
index 0000000..fa703bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_594824() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xxx);
+}
+
+void fragment_main() {
+ textureSampleBias_594824();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl
new file mode 100644
index 0000000..b1579e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_594824(texture3d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3), int3(0));
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_594824(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm
new file mode 100644
index 0000000..2360528
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_594824 "textureSampleBias_594824"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %3
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %30 = OpConstantNull %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpConstantNull %v4float
+%textureSampleBias_594824 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_v4float Function %33
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %22 = OpLoad %7 %arg_1
+ %23 = OpLoad %3 %arg_0
+ %25 = OpSampledImage %24 %23 %22
+ %26 = OpLoad %v3float %arg_2
+ %27 = OpLoad %float %arg_3
+ %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias|ConstOffset %27 %30
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureSampleBias_594824
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl
new file mode 100644
index 0000000..3eecbf6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_594824() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec3<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_594824();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl
new file mode 100644
index 0000000..25548f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, bias: f32) -> vec4<f32>
+fn textureSampleBias_6a9113() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_6a9113();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl
new file mode 100644
index 0000000..4ff6ea8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleBias_6a9113() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = texture(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_6a9113();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl
new file mode 100644
index 0000000..95c453b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_6a9113() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_6a9113();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl
new file mode 100644
index 0000000..a60a0d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_6a9113(texture2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3));
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_6a9113(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm
new file mode 100644
index 0000000..75ae173
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_6a9113 "textureSampleBias_6a9113"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %30 = OpConstantNull %v4float
+%textureSampleBias_6a9113 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_v4float Function %30
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %22 = OpLoad %7 %arg_1
+ %23 = OpLoad %3 %arg_0
+ %25 = OpSampledImage %24 %23 %22
+ %26 = OpLoad %v2float %arg_2
+ %27 = OpLoad %float %arg_3
+ %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureSampleBias_6a9113
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl
new file mode 100644
index 0000000..690d164
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_6a9113() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_6a9113();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl
new file mode 100644
index 0000000..8e3b2d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl
@@ -0,0 +1,39 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, bias: f32) -> vec4<f32>
+fn textureSampleBias_80e579() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_80e579();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl
new file mode 100644
index 0000000..4b8b55e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.glsl
@@ -0,0 +1,20 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleBias_80e579() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = texture(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleBias_80e579();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl
new file mode 100644
index 0000000..27ee32d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_80e579() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleBias_80e579();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl
new file mode 100644
index 0000000..310f549
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_80e579(texture2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4));
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_80e579(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm
new file mode 100644
index 0000000..2afe0df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_80e579 "textureSampleBias_80e579"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %29 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %41 = OpConstantNull %v4float
+%textureSampleBias_80e579 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %arg_4 = OpVariable %_ptr_Function_float Function %24
+ %res = OpVariable %_ptr_Function_v4float Function %41
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %27 = OpLoad %7 %arg_1
+ %28 = OpLoad %3 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %32 = OpLoad %v2float %arg_2
+ %33 = OpCompositeExtract %float %32 0
+ %34 = OpCompositeExtract %float %32 1
+ %36 = OpLoad %int %arg_3
+ %35 = OpConvertSToF %float %36
+ %37 = OpCompositeConstruct %v3float %33 %34 %35
+ %38 = OpLoad %float %arg_4
+ %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias %38
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleBias_80e579
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl
new file mode 100644
index 0000000..237a498
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.wgsl
@@ -0,0 +1,15 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_80e579() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_80e579();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl
new file mode 100644
index 0000000..939e239
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl
@@ -0,0 +1,39 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, bias: f32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSampleBias_9dbb51() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_9dbb51();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl
new file mode 100644
index 0000000..fcb897f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.glsl
@@ -0,0 +1,20 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleBias_9dbb51() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), ivec2(0), arg_4);
+}
+
+void fragment_main() {
+ textureSampleBias_9dbb51();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl
new file mode 100644
index 0000000..83ce4b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_9dbb51() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx);
+}
+
+void fragment_main() {
+ textureSampleBias_9dbb51();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl
new file mode 100644
index 0000000..811369d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_9dbb51(texture2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4), int2(0));
+}
+
+fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_9dbb51(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm
new file mode 100644
index 0000000..bca222e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 47
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_9dbb51 "textureSampleBias_9dbb51"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %29 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %40 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %43 = OpConstantNull %v4float
+%textureSampleBias_9dbb51 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %arg_4 = OpVariable %_ptr_Function_float Function %24
+ %res = OpVariable %_ptr_Function_v4float Function %43
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %27 = OpLoad %7 %arg_1
+ %28 = OpLoad %3 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %32 = OpLoad %v2float %arg_2
+ %33 = OpCompositeExtract %float %32 0
+ %34 = OpCompositeExtract %float %32 1
+ %36 = OpLoad %int %arg_3
+ %35 = OpConvertSToF %float %36
+ %37 = OpCompositeConstruct %v3float %33 %34 %35
+ %38 = OpLoad %float %arg_4
+ %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias|ConstOffset %38 %40
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureSampleBias_9dbb51
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl
new file mode 100644
index 0000000..1498066
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.wgsl
@@ -0,0 +1,15 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_9dbb51() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_9dbb51();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl
new file mode 100644
index 0000000..e84735c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, bias: f32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSampleBias_a161cf() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_a161cf();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl
new file mode 100644
index 0000000..fc23dd4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleBias_a161cf() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(0), arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_a161cf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl
new file mode 100644
index 0000000..89d28fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_a161cf() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (0).xx);
+}
+
+void fragment_main() {
+ textureSampleBias_a161cf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl
new file mode 100644
index 0000000..26145c4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_a161cf(texture2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3), int2(0));
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_a161cf(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm
new file mode 100644
index 0000000..b4513e6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_a161cf "textureSampleBias_a161cf"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %3
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %30 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %33 = OpConstantNull %v4float
+%textureSampleBias_a161cf = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_v4float Function %33
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %22 = OpLoad %7 %arg_1
+ %23 = OpLoad %3 %arg_0
+ %25 = OpSampledImage %24 %23 %22
+ %26 = OpLoad %v2float %arg_2
+ %27 = OpLoad %float %arg_3
+ %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias|ConstOffset %27 %30
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureSampleBias_a161cf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl
new file mode 100644
index 0000000..8ff74b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_a161cf() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_a161cf();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl
new file mode 100644
index 0000000..3a77dab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, bias: f32) -> vec4<f32>
+fn textureSampleBias_d3fa1b() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_d3fa1b();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl
new file mode 100644
index 0000000..19f7ed4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleBias_d3fa1b() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = texture(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_d3fa1b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl
new file mode 100644
index 0000000..653f13e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_d3fa1b() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleBias_d3fa1b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl
new file mode 100644
index 0000000..d0ca622
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_d3fa1b(texture3d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, bias(arg_3));
+}
+
+fragment void fragment_main(texture3d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_d3fa1b(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm
new file mode 100644
index 0000000..efaf608
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_d3fa1b "textureSampleBias_d3fa1b"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 3D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %30 = OpConstantNull %v4float
+%textureSampleBias_d3fa1b = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_v4float Function %30
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %22 = OpLoad %7 %arg_1
+ %23 = OpLoad %3 %arg_0
+ %25 = OpSampledImage %24 %23 %22
+ %26 = OpLoad %v3float %arg_2
+ %27 = OpLoad %float %arg_3
+ %20 = OpImageSampleImplicitLod %v4float %25 %26 Bias %27
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureSampleBias_d3fa1b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl
new file mode 100644
index 0000000..7c8dd12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_d3fa1b() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_d3fa1b();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl
new file mode 100644
index 0000000..6e22d23
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl
@@ -0,0 +1,39 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleBias(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32, bias: f32) -> vec4<f32>
+fn textureSampleBias_eed7c4() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_eed7c4();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl
new file mode 100644
index 0000000..e268853
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.glsl
@@ -0,0 +1,29 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArray arg_0_arg_1;
+
+void textureSampleBias_eed7c4() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleBias_eed7c4();
+}
+
+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.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl
new file mode 100644
index 0000000..4c225b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleBias_eed7c4() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.SampleBias(arg_1, float4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleBias_eed7c4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl
new file mode 100644
index 0000000..5017e44
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleBias_eed7c4(texturecube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = tint_symbol.sample(tint_symbol_1, arg_2, arg_3, bias(arg_4));
+}
+
+fragment void fragment_main(texturecube_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleBias_eed7c4(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm
new file mode 100644
index 0000000..82c77fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 45
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleBias_eed7c4 "textureSampleBias_eed7c4"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %v4float = OpTypeVector %float 4
+ %29 = OpTypeSampledImage %3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %41 = OpConstantNull %v4float
+%textureSampleBias_eed7c4 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %arg_4 = OpVariable %_ptr_Function_float Function %24
+ %res = OpVariable %_ptr_Function_v4float Function %41
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %27 = OpLoad %7 %arg_1
+ %28 = OpLoad %3 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpCompositeExtract %float %31 0
+ %33 = OpCompositeExtract %float %31 1
+ %34 = OpCompositeExtract %float %31 2
+ %36 = OpLoad %int %arg_3
+ %35 = OpConvertSToF %float %36
+ %37 = OpCompositeConstruct %v4float %32 %33 %34 %35
+ %38 = OpLoad %float %arg_4
+ %25 = OpImageSampleImplicitLod %v4float %30 %37 Bias %38
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleBias_eed7c4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl
new file mode 100644
index 0000000..df36893
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.wgsl
@@ -0,0 +1,15 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleBias_eed7c4() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureSampleBias(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleBias_eed7c4();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl
new file mode 100644
index 0000000..f8b96de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32) -> f32
+fn textureSampleCompare_3a5923() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_3a5923();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl
new file mode 100644
index 0000000..3de47a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompare_3a5923() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+}
+
+void fragment_main() {
+ textureSampleCompare_3a5923();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl
new file mode 100644
index 0000000..3bc8810
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompare_3a5923() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float res = arg_0.SampleCmp(arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleCompare_3a5923();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl
new file mode 100644
index 0000000..a4ccb01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompare_3a5923(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3);
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleCompare_3a5923(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm
new file mode 100644
index 0000000..b8f13d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleCompare_3a5923 "textureSampleCompare_3a5923"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %23 = OpTypeSampledImage %3
+%textureSampleCompare_3a5923 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_float Function %19
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %21 = OpLoad %7 %arg_1
+ %22 = OpLoad %3 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %25 = OpLoad %v2float %arg_2
+ %26 = OpLoad %float %arg_3
+ %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureSampleCompare_3a5923
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl
new file mode 100644
index 0000000..f2d1921
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/3a5923.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompare_3a5923() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_3a5923();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl
new file mode 100644
index 0000000..04a8dde
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3<f32>, depth_ref: f32) -> f32
+fn textureSampleCompare_63fb83() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_63fb83();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl
new file mode 100644
index 0000000..d83c925
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSampleCompare_63fb83() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+}
+
+void fragment_main() {
+ textureSampleCompare_63fb83();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl
new file mode 100644
index 0000000..01de180
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+TextureCube arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompare_63fb83() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float res = arg_0.SampleCmp(arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleCompare_63fb83();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl
new file mode 100644
index 0000000..826159e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompare_63fb83(depthcube<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3);
+}
+
+fragment void fragment_main(depthcube<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleCompare_63fb83(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm
new file mode 100644
index 0000000..dde09fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.spvasm
@@ -0,0 +1,57 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 31
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleCompare_63fb83 "textureSampleCompare_63fb83"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %23 = OpTypeSampledImage %3
+%textureSampleCompare_63fb83 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_float Function %19
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %21 = OpLoad %7 %arg_1
+ %22 = OpLoad %3 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %25 = OpLoad %v3float %arg_2
+ %26 = OpLoad %float %arg_3
+ %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureSampleCompare_63fb83
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl
new file mode 100644
index 0000000..6763ef1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/63fb83.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompare_63fb83() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_63fb83();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl
new file mode 100644
index 0000000..b3b5cf0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl
@@ -0,0 +1,39 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3<f32>, array_index: i32, depth_ref: f32) -> f32
+fn textureSampleCompare_a3ca7e() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_a3ca7e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl
new file mode 100644
index 0000000..f822276
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.glsl
@@ -0,0 +1,29 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleCompare_a3ca7e() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleCompare_a3ca7e();
+}
+
+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.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl
new file mode 100644
index 0000000..06ac88b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompare_a3ca7e() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = arg_0.SampleCmp(arg_1, float4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleCompare_a3ca7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl
new file mode 100644
index 0000000..884983e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompare_a3ca7e(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4);
+}
+
+fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleCompare_a3ca7e(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm
new file mode 100644
index 0000000..8438b3e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability SampledCubeArray
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleCompare_a3ca7e "textureSampleCompare_a3ca7e"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float Cube 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %13 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %28 = OpTypeSampledImage %3
+ %v4float = OpTypeVector %float 4
+%textureSampleCompare_a3ca7e = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %arg_4 = OpVariable %_ptr_Function_float Function %24
+ %res = OpVariable %_ptr_Function_float Function %24
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %26 = OpLoad %7 %arg_1
+ %27 = OpLoad %3 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpCompositeExtract %float %31 0
+ %33 = OpCompositeExtract %float %31 1
+ %34 = OpCompositeExtract %float %31 2
+ %36 = OpLoad %int %arg_3
+ %35 = OpConvertSToF %float %36
+ %37 = OpCompositeConstruct %v4float %32 %33 %34 %35
+ %38 = OpLoad %float %arg_4
+ %25 = OpImageSampleDrefImplicitLod %float %29 %37 %38
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureSampleCompare_a3ca7e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl
new file mode 100644
index 0000000..7d34be2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/a3ca7e.wgsl.expected.wgsl
@@ -0,0 +1,15 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube_array;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompare_a3ca7e() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_a3ca7e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl
new file mode 100644
index 0000000..c61a1c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl
@@ -0,0 +1,39 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32, @const offset: vec2<i32>) -> f32
+fn textureSampleCompare_af1051() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_af1051();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl
new file mode 100644
index 0000000..3633f07
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.glsl
@@ -0,0 +1,29 @@
+SKIP: FAILED
+
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompare_af1051() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleCompare_af1051();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:10: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile
+ERROR: 0:10: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl
new file mode 100644
index 0000000..ad69564
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompare_af1051() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx);
+}
+
+void fragment_main() {
+ textureSampleCompare_af1051();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl
new file mode 100644
index 0000000..e241a74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompare_af1051(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4, int2(0));
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleCompare_af1051(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm
new file mode 100644
index 0000000..290d5fe
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.spvasm
@@ -0,0 +1,72 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleCompare_af1051 "textureSampleCompare_af1051"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %28 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %39 = OpConstantNull %v2int
+%textureSampleCompare_af1051 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %arg_4 = OpVariable %_ptr_Function_float Function %24
+ %res = OpVariable %_ptr_Function_float Function %24
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %26 = OpLoad %7 %arg_1
+ %27 = OpLoad %3 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpCompositeExtract %float %31 0
+ %33 = OpCompositeExtract %float %31 1
+ %35 = OpLoad %int %arg_3
+ %34 = OpConvertSToF %float %35
+ %36 = OpCompositeConstruct %v3float %32 %33 %34
+ %37 = OpLoad %float %arg_4
+ %25 = OpImageSampleDrefImplicitLod %float %29 %36 %37 ConstOffset %39
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureSampleCompare_af1051
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl
new file mode 100644
index 0000000..6f34ddc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/af1051.wgsl.expected.wgsl
@@ -0,0 +1,15 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompare_af1051() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_af1051();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl
new file mode 100644
index 0000000..287d827
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl
@@ -0,0 +1,39 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32) -> f32
+fn textureSampleCompare_dd431d() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_dd431d();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl
new file mode 100644
index 0000000..edba551
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.glsl
@@ -0,0 +1,20 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompare_dd431d() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4));
+}
+
+void fragment_main() {
+ textureSampleCompare_dd431d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl
new file mode 100644
index 0000000..aed9ea3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.hlsl
@@ -0,0 +1,14 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompare_dd431d() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = arg_0.SampleCmp(arg_1, float3(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleCompare_dd431d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl
new file mode 100644
index 0000000..525ba3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.msl
@@ -0,0 +1,15 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompare_dd431d(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, arg_4);
+}
+
+fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleCompare_dd431d(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm
new file mode 100644
index 0000000..a5fb4fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 42
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleCompare_dd431d "textureSampleCompare_dd431d"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 1 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %int = OpTypeInt 32 1
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %24 = OpConstantNull %float
+ %28 = OpTypeSampledImage %3
+ %v3float = OpTypeVector %float 3
+%textureSampleCompare_dd431d = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_int Function %20
+ %arg_4 = OpVariable %_ptr_Function_float Function %24
+ %res = OpVariable %_ptr_Function_float Function %24
+ OpStore %arg_2 %13
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %26 = OpLoad %7 %arg_1
+ %27 = OpLoad %3 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpCompositeExtract %float %31 0
+ %33 = OpCompositeExtract %float %31 1
+ %35 = OpLoad %int %arg_3
+ %34 = OpConvertSToF %float %35
+ %36 = OpCompositeConstruct %v3float %32 %33 %34
+ %37 = OpLoad %float %arg_4
+ %25 = OpImageSampleDrefImplicitLod %float %29 %36 %37
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleCompare_dd431d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl
new file mode 100644
index 0000000..762d558
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dd431d.wgsl.expected.wgsl
@@ -0,0 +1,15 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d_array;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompare_dd431d() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_dd431d();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl
new file mode 100644
index 0000000..dd9d45e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl
@@ -0,0 +1,38 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32, @const offset: vec2<i32>) -> f32
+fn textureSampleCompare_dec064() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_dec064();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl
new file mode 100644
index 0000000..8adb0ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.glsl
@@ -0,0 +1,19 @@
+#version 310 es
+precision mediump float;
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompare_dec064() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleCompare_dec064();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl
new file mode 100644
index 0000000..21bf5e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.hlsl
@@ -0,0 +1,13 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompare_dec064() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float res = arg_0.SampleCmp(arg_1, arg_2, arg_3, (0).xx);
+}
+
+void fragment_main() {
+ textureSampleCompare_dec064();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl
new file mode 100644
index 0000000..c22e9dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.msl
@@ -0,0 +1,14 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompare_dec064(depth2d<float, access::sample> tint_symbol, sampler tint_symbol_1) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float res = tint_symbol.sample_compare(tint_symbol_1, arg_2, arg_3, int2(0));
+}
+
+fragment void fragment_main(depth2d<float, access::sample> tint_symbol_2 [[texture(0)]], sampler tint_symbol_3 [[sampler(0)]]) {
+ textureSampleCompare_dec064(tint_symbol_2, tint_symbol_3);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm
new file mode 100644
index 0000000..6e55366
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.spvasm
@@ -0,0 +1,60 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleCompare_dec064 "textureSampleCompare_dec064"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %res "res"
+ OpName %fragment_main "fragment_main"
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %arg_1 DescriptorSet 1
+ OpDecorate %arg_1 Binding 1
+ %float = OpTypeFloat 32
+ %3 = OpTypeImage %float 2D 0 0 0 1 Unknown
+%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
+ %arg_0 = OpVariable %_ptr_UniformConstant_3 UniformConstant
+ %7 = OpTypeSampler
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_1 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %void = OpTypeVoid
+ %8 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %13 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %19 = OpConstantNull %float
+ %23 = OpTypeSampledImage %3
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %29 = OpConstantNull %v2int
+%textureSampleCompare_dec064 = OpFunction %void None %8
+ %11 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %13
+ %arg_3 = OpVariable %_ptr_Function_float Function %19
+ %res = OpVariable %_ptr_Function_float Function %19
+ OpStore %arg_2 %13
+ OpStore %arg_3 %float_1
+ %21 = OpLoad %7 %arg_1
+ %22 = OpLoad %3 %arg_0
+ %24 = OpSampledImage %23 %22 %21
+ %25 = OpLoad %v2float %arg_2
+ %26 = OpLoad %float %arg_3
+ %20 = OpImageSampleDrefImplicitLod %float %24 %25 %26 ConstOffset %29
+ OpStore %res %20
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %8
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureSampleCompare_dec064
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl
new file mode 100644
index 0000000..a77c90f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompare/dec064.wgsl.expected.wgsl
@@ -0,0 +1,14 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompare_dec064() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : f32 = textureSampleCompare(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompare_dec064();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl
new file mode 100644
index 0000000..d5f827a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32) -> f32
+fn textureSampleCompareLevel_1116ed() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_1116ed();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_1116ed();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_1116ed();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl
new file mode 100644
index 0000000..c5a1359
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_1116ed() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleCompareLevel_1116ed();
+ 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 sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_1116ed() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4));
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_1116ed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_1116ed() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4));
+}
+
+void compute_main() {
+ textureSampleCompareLevel_1116ed();
+}
+
+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/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl
new file mode 100644
index 0000000..dfdafaa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompareLevel_1116ed() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleCompareLevel_1116ed();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_1116ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleCompareLevel_1116ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl
new file mode 100644
index 0000000..f4bf884
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompareLevel_1116ed(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleCompareLevel_1116ed(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)]]) {
+ textureSampleCompareLevel_1116ed(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)]]) {
+ textureSampleCompareLevel_1116ed(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm
new file mode 100644
index 0000000..fb2da60
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.spvasm
@@ -0,0 +1,105 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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 %textureSampleCompareLevel_1116ed "textureSampleCompareLevel_1116ed"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %46 = OpTypeFunction %v4float
+%textureSampleCompareLevel_1116ed = 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_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %37 = OpLoad %v2float %arg_2
+ %38 = OpCompositeExtract %float %37 0
+ %39 = OpCompositeExtract %float %37 1
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v3float %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod %float_0
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleCompareLevel_1116ed
+ 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
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureSampleCompareLevel_1116ed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureSampleCompareLevel_1116ed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.wgsl
new file mode 100644
index 0000000..87b42dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.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_comparison;
+
+fn textureSampleCompareLevel_1116ed() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_1116ed();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_1116ed();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_1116ed();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl
new file mode 100644
index 0000000..3580ff6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3<f32>, depth_ref: f32) -> f32
+fn textureSampleCompareLevel_1568e3() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_1568e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_1568e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_1568e3();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl
new file mode 100644
index 0000000..d877ce4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_1568e3() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+}
+
+vec4 vertex_main() {
+ textureSampleCompareLevel_1568e3();
+ 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 samplerCubeShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_1568e3() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_1568e3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_1568e3() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+}
+
+void compute_main() {
+ textureSampleCompareLevel_1568e3();
+}
+
+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/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl
new file mode 100644
index 0000000..a0b30fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompareLevel_1568e3() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleCompareLevel_1568e3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_1568e3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleCompareLevel_1568e3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl
new file mode 100644
index 0000000..410b28c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompareLevel_1568e3(depthcube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleCompareLevel_1568e3(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleCompareLevel_1568e3(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleCompareLevel_1568e3(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm
new file mode 100644
index 0000000..b0d97d3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureSampleCompareLevel_1568e3 "textureSampleCompareLevel_1568e3"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %35 = OpTypeFunction %v4float
+%textureSampleCompareLevel_1568e3 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod %float_0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleCompareLevel_1568e3
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleCompareLevel_1568e3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleCompareLevel_1568e3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl
new file mode 100644
index 0000000..408a7da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompareLevel_1568e3() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_1568e3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_1568e3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_1568e3();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl
new file mode 100644
index 0000000..e97fbb7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32) -> f32
+fn textureSampleCompareLevel_2ad2b1() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_2ad2b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_2ad2b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_2ad2b1();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl
new file mode 100644
index 0000000..fb730f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_2ad2b1() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+}
+
+vec4 vertex_main() {
+ textureSampleCompareLevel_2ad2b1();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_2ad2b1() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_2ad2b1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_2ad2b1() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+}
+
+void compute_main() {
+ textureSampleCompareLevel_2ad2b1();
+}
+
+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/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl
new file mode 100644
index 0000000..c47f096
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompareLevel_2ad2b1() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleCompareLevel_2ad2b1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_2ad2b1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleCompareLevel_2ad2b1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl
new file mode 100644
index 0000000..fb1f7ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompareLevel_2ad2b1(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleCompareLevel_2ad2b1(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleCompareLevel_2ad2b1(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleCompareLevel_2ad2b1(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm
new file mode 100644
index 0000000..58b0090
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureSampleCompareLevel_2ad2b1 "textureSampleCompareLevel_2ad2b1"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %35 = OpTypeFunction %v4float
+%textureSampleCompareLevel_2ad2b1 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod %float_0
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleCompareLevel_2ad2b1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl
new file mode 100644
index 0000000..561b936
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompareLevel_2ad2b1() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_2ad2b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_2ad2b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_2ad2b1();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl
new file mode 100644
index 0000000..7b14c47
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3<f32>, array_index: i32, depth_ref: f32) -> f32
+fn textureSampleCompareLevel_4cf3a2() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_4cf3a2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_4cf3a2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_4cf3a2();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl
new file mode 100644
index 0000000..dbec8ba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_4cf3a2() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+vec4 vertex_main() {
+ textureSampleCompareLevel_4cf3a2();
+ 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 textureSampleCompareLevel_4cf3a2() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_4cf3a2();
+}
+
+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 textureSampleCompareLevel_4cf3a2() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = texture(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void compute_main() {
+ textureSampleCompareLevel_4cf3a2();
+}
+
+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/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl
new file mode 100644
index 0000000..7910d95
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompareLevel_4cf3a2() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = arg_0.SampleCmpLevelZero(arg_1, float4(arg_2, float(arg_3)), arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleCompareLevel_4cf3a2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_4cf3a2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleCompareLevel_4cf3a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl
new file mode 100644
index 0000000..0378014
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompareLevel_4cf3a2(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleCompareLevel_4cf3a2(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)]]) {
+ textureSampleCompareLevel_4cf3a2(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)]]) {
+ textureSampleCompareLevel_4cf3a2(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm
new file mode 100644
index 0000000..e5a6856
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.spvasm
@@ -0,0 +1,106 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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 %textureSampleCompareLevel_4cf3a2 "textureSampleCompareLevel_4cf3a2"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %46 = OpTypeFunction %v4float
+%textureSampleCompareLevel_4cf3a2 = 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_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %36 = OpLoad %v3float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %39 = OpCompositeExtract %float %36 2
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v4float %37 %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod %float_0
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2
+ 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
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureSampleCompareLevel_4cf3a2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.wgsl
new file mode 100644
index 0000000..d28a731
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.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_comparison;
+
+fn textureSampleCompareLevel_4cf3a2() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_4cf3a2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_4cf3a2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_4cf3a2();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl
new file mode 100644
index 0000000..a42e7be
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler_comparison;
+
+// fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32, @const offset: vec2<i32>) -> f32
+fn textureSampleCompareLevel_7f2b9a() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_7f2b9a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_7f2b9a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_7f2b9a();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl
new file mode 100644
index 0000000..0dcecc2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_7f2b9a() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleCompareLevel_7f2b9a();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_7f2b9a() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_7f2b9a();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_7f2b9a() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleCompareLevel_7f2b9a();
+}
+
+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/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl
new file mode 100644
index 0000000..6365c43
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompareLevel_7f2b9a() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float res = arg_0.SampleCmpLevelZero(arg_1, arg_2, arg_3, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleCompareLevel_7f2b9a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_7f2b9a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleCompareLevel_7f2b9a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl
new file mode 100644
index 0000000..12a1172
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompareLevel_7f2b9a(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, level(0), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleCompareLevel_7f2b9a(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleCompareLevel_7f2b9a(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleCompareLevel_7f2b9a(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm
new file mode 100644
index 0000000..8e4ef7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; 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 %textureSampleCompareLevel_7f2b9a "textureSampleCompareLevel_7f2b9a"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+ %float_0 = OpConstant %float 0
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %36 = OpConstantNull %v2int
+ %38 = OpTypeFunction %v4float
+%textureSampleCompareLevel_7f2b9a = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleDrefExplicitLod %float %30 %31 %32 Lod|ConstOffset %float_0 %36
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a
+ 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
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureSampleCompareLevel_7f2b9a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl
new file mode 100644
index 0000000..9b8be3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler_comparison;
+
+fn textureSampleCompareLevel_7f2b9a() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_7f2b9a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_7f2b9a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_7f2b9a();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl
new file mode 100644
index 0000000..4772672
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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_comparison;
+
+// fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32, @const offset: vec2<i32>) -> f32
+fn textureSampleCompareLevel_b6e47c() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_b6e47c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_b6e47c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_b6e47c();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl
new file mode 100644
index 0000000..abe4ad6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_b6e47c() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleCompareLevel_b6e47c();
+ 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: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile
+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 textureSampleCompareLevel_b6e47c() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_b6e47c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:10: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile
+ERROR: 0:10: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleCompareLevel_b6e47c() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = textureOffset(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), arg_4), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleCompareLevel_b6e47c();
+}
+
+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: 'sampler' : TextureOffset does not support sampler2DArrayShadow : ES Profile
+ERROR: 0:9: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl
new file mode 100644
index 0000000..4358797
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerComparisonState arg_1 : register(s1, space1);
+
+void textureSampleCompareLevel_b6e47c() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = arg_0.SampleCmpLevelZero(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleCompareLevel_b6e47c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleCompareLevel_b6e47c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleCompareLevel_b6e47c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl
new file mode 100644
index 0000000..a20d5d2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleCompareLevel_b6e47c(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float res = tint_symbol_1.sample_compare(tint_symbol_2, arg_2, arg_3, arg_4, level(0), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleCompareLevel_b6e47c(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)]]) {
+ textureSampleCompareLevel_b6e47c(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)]]) {
+ textureSampleCompareLevel_b6e47c(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm
new file mode 100644
index 0000000..8401e93
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; 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 %textureSampleCompareLevel_b6e47c "textureSampleCompareLevel_b6e47c"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %float_0 = OpConstant %float 0
+ %v2int = OpTypeVector %int 2
+ %46 = OpConstantNull %v2int
+ %48 = OpTypeFunction %v4float
+%textureSampleCompareLevel_b6e47c = 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_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %37 = OpLoad %v2float %arg_2
+ %38 = OpCompositeExtract %float %37 0
+ %39 = OpCompositeExtract %float %37 1
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v3float %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageSampleDrefExplicitLod %float %35 %42 %43 Lod|ConstOffset %float_0 %46
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureSampleCompareLevel_b6e47c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.wgsl.expected.wgsl
new file mode 100644
index 0000000..15f9956
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/b6e47c.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_comparison;
+
+fn textureSampleCompareLevel_b6e47c() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : f32 = textureSampleCompareLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleCompareLevel_b6e47c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleCompareLevel_b6e47c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleCompareLevel_b6e47c();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl
new file mode 100644
index 0000000..bd6e7a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, ddx: vec3<f32>, ddy: vec3<f32>) -> vec4<f32>
+fn textureSampleGrad_21402b() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = vec3<f32>();
+ var arg_4 = vec3<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_21402b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_21402b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_21402b();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl
new file mode 100644
index 0000000..f480d78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleGrad_21402b() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_21402b();
+ 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_arg_1;
+
+void textureSampleGrad_21402b() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+void fragment_main() {
+ textureSampleGrad_21402b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleGrad_21402b() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+void compute_main() {
+ textureSampleGrad_21402b();
+}
+
+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/textureSampleGrad/21402b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.hlsl
new file mode 100644
index 0000000..037d976
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_21402b() {
+ float3 arg_2 = (0.0f).xxx;
+ float3 arg_3 = (0.0f).xxx;
+ float3 arg_4 = (0.0f).xxx;
+ float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_21402b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_21402b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_21402b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl
new file mode 100644
index 0000000..8be83cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_21402b(texture3d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float3 arg_3 = float3(0.0f);
+ float3 arg_4 = float3(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient3d(arg_3, arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_21402b(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleGrad_21402b(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleGrad_21402b(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm
new file mode 100644
index 0000000..19f41b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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 %textureSampleGrad_21402b "textureSampleGrad_21402b"
+ 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 3D 0 0 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
+ %28 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_21402b = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_4 = OpVariable %_ptr_Function_v3float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %20
+ OpStore %arg_4 %20
+ %26 = OpLoad %14 %arg_1
+ %27 = OpLoad %11 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v3float %arg_2
+ %31 = OpLoad %v3float %arg_3
+ %32 = OpLoad %v3float %arg_4
+ %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleGrad_21402b
+ 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 %textureSampleGrad_21402b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleGrad_21402b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl
new file mode 100644
index 0000000..23170fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/21402b.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_21402b() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = vec3<f32>();
+ var arg_4 = vec3<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_21402b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_21402b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_21402b();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl
new file mode 100644
index 0000000..ae3e70f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl
@@ -0,0 +1,51 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32>
+fn textureSampleGrad_2ecd8f() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = vec2<f32>();
+ var arg_5 = vec2<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_2ecd8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_2ecd8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_2ecd8f();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl
new file mode 100644
index 0000000..62edc15
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleGrad_2ecd8f() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec2 arg_4 = vec2(0.0f);
+ vec2 arg_5 = vec2(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_2ecd8f();
+ 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_arg_1;
+
+void textureSampleGrad_2ecd8f() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec2 arg_4 = vec2(0.0f);
+ vec2 arg_5 = vec2(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+void fragment_main() {
+ textureSampleGrad_2ecd8f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleGrad_2ecd8f() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec2 arg_4 = vec2(0.0f);
+ vec2 arg_5 = vec2(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+void compute_main() {
+ textureSampleGrad_2ecd8f();
+}
+
+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/textureSampleGrad/2ecd8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.hlsl
new file mode 100644
index 0000000..51d6b37
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_2ecd8f() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float2 arg_4 = (0.0f).xx;
+ float2 arg_5 = (0.0f).xx;
+ float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_2ecd8f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_2ecd8f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_2ecd8f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl
new file mode 100644
index 0000000..0fc4d01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_2ecd8f(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float2 arg_4 = float2(0.0f);
+ float2 arg_5 = float2(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradient2d(arg_4, arg_5));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_2ecd8f(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)]]) {
+ textureSampleGrad_2ecd8f(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)]]) {
+ textureSampleGrad_2ecd8f(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm
new file mode 100644
index 0000000..adfcab2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.spvasm
@@ -0,0 +1,108 @@
+; 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_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleGrad_2ecd8f "textureSampleGrad_2ecd8f"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %arg_5 "arg_5"
+ 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
+ %33 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_2ecd8f = 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_v2float Function %20
+ %arg_5 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %20
+ OpStore %arg_5 %20
+ %31 = OpLoad %14 %arg_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpSampledImage %33 %32 %31
+ %36 = OpLoad %v2float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %40 = OpLoad %int %arg_3
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v3float %37 %38 %39
+ %42 = OpLoad %v2float %arg_4
+ %43 = OpLoad %v2float %arg_5
+ %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad %42 %43
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleGrad_2ecd8f
+ 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 %textureSampleGrad_2ecd8f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureSampleGrad_2ecd8f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl
new file mode 100644
index 0000000..f9434a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/2ecd8f.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_2ecd8f() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = vec2<f32>();
+ var arg_5 = vec2<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_2ecd8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_2ecd8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_2ecd8f();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl
new file mode 100644
index 0000000..66d6755
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32>
+fn textureSampleGrad_521263() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = vec2<f32>();
+ var arg_4 = vec2<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_521263();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_521263();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_521263();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl
new file mode 100644
index 0000000..eb7aee0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleGrad_521263() {
+ vec2 arg_2 = vec2(0.0f);
+ vec2 arg_3 = vec2(0.0f);
+ vec2 arg_4 = vec2(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_521263();
+ 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_arg_1;
+
+void textureSampleGrad_521263() {
+ vec2 arg_2 = vec2(0.0f);
+ vec2 arg_3 = vec2(0.0f);
+ vec2 arg_4 = vec2(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+void fragment_main() {
+ textureSampleGrad_521263();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleGrad_521263() {
+ vec2 arg_2 = vec2(0.0f);
+ vec2 arg_3 = vec2(0.0f);
+ vec2 arg_4 = vec2(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+void compute_main() {
+ textureSampleGrad_521263();
+}
+
+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/textureSampleGrad/521263.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.hlsl
new file mode 100644
index 0000000..b184cd7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_521263() {
+ float2 arg_2 = (0.0f).xx;
+ float2 arg_3 = (0.0f).xx;
+ float2 arg_4 = (0.0f).xx;
+ float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_521263();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_521263();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_521263();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl
new file mode 100644
index 0000000..89f9e87
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_521263(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float2 arg_3 = float2(0.0f);
+ float2 arg_4 = float2(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient2d(arg_3, arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_521263(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleGrad_521263(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleGrad_521263(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm
new file mode 100644
index 0000000..5b90d6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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 %textureSampleGrad_521263 "textureSampleGrad_521263"
+ 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 0 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
+ %28 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_521263 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_4 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %20
+ OpStore %arg_4 %20
+ %26 = OpLoad %14 %arg_1
+ %27 = OpLoad %11 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v2float %arg_2
+ %31 = OpLoad %v2float %arg_3
+ %32 = OpLoad %v2float %arg_4
+ %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleGrad_521263
+ 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 %textureSampleGrad_521263
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleGrad_521263
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl
new file mode 100644
index 0000000..e229216
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/521263.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_521263() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = vec2<f32>();
+ var arg_4 = vec2<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_521263();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_521263();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_521263();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl
new file mode 100644
index 0000000..7d6f633
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, ddx: vec3<f32>, ddy: vec3<f32>) -> vec4<f32>
+fn textureSampleGrad_5312f4() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = vec3<f32>();
+ var arg_4 = vec3<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_5312f4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_5312f4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_5312f4();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl
new file mode 100644
index 0000000..7278ce3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp samplerCube arg_0_arg_1;
+
+void textureSampleGrad_5312f4() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_5312f4();
+ 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 samplerCube arg_0_arg_1;
+
+void textureSampleGrad_5312f4() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+void fragment_main() {
+ textureSampleGrad_5312f4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_0_arg_1;
+
+void textureSampleGrad_5312f4() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, arg_2, arg_3, arg_4);
+}
+
+void compute_main() {
+ textureSampleGrad_5312f4();
+}
+
+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/textureSampleGrad/5312f4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.hlsl
new file mode 100644
index 0000000..14508e1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_5312f4() {
+ float3 arg_2 = (0.0f).xxx;
+ float3 arg_3 = (0.0f).xxx;
+ float3 arg_4 = (0.0f).xxx;
+ float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_5312f4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_5312f4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_5312f4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl
new file mode 100644
index 0000000..d7f4659
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_5312f4(texturecube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float3 arg_3 = float3(0.0f);
+ float3 arg_4 = float3(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradientcube(arg_3, arg_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_5312f4(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleGrad_5312f4(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleGrad_5312f4(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm
new file mode 100644
index 0000000..149aba6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 49
+; 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 %textureSampleGrad_5312f4 "textureSampleGrad_5312f4"
+ 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 0 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
+ %28 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_5312f4 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_4 = OpVariable %_ptr_Function_v3float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %20
+ OpStore %arg_4 %20
+ %26 = OpLoad %14 %arg_1
+ %27 = OpLoad %11 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v3float %arg_2
+ %31 = OpLoad %v3float %arg_3
+ %32 = OpLoad %v3float %arg_4
+ %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad %31 %32
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleGrad_5312f4
+ 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 %textureSampleGrad_5312f4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureSampleGrad_5312f4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl
new file mode 100644
index 0000000..badb6a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5312f4.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_5312f4() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = vec3<f32>();
+ var arg_4 = vec3<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_5312f4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_5312f4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_5312f4();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl
new file mode 100644
index 0000000..993eb73
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, ddx: vec3<f32>, ddy: vec3<f32>, @const offset: vec3<i32>) -> vec4<f32>
+fn textureSampleGrad_5884dd() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = vec3<f32>();
+ var arg_4 = vec3<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec3<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_5884dd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_5884dd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_5884dd();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl
new file mode 100644
index 0000000..a20b4b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleGrad_5884dd() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0));
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_5884dd();
+ 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_arg_1;
+
+void textureSampleGrad_5884dd() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0));
+}
+
+void fragment_main() {
+ textureSampleGrad_5884dd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleGrad_5884dd() {
+ vec3 arg_2 = vec3(0.0f);
+ vec3 arg_3 = vec3(0.0f);
+ vec3 arg_4 = vec3(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec3(0));
+}
+
+void compute_main() {
+ textureSampleGrad_5884dd();
+}
+
+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/textureSampleGrad/5884dd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.hlsl
new file mode 100644
index 0000000..695dd30
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_5884dd() {
+ float3 arg_2 = (0.0f).xxx;
+ float3 arg_3 = (0.0f).xxx;
+ float3 arg_4 = (0.0f).xxx;
+ float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xxx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_5884dd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_5884dd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_5884dd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl
new file mode 100644
index 0000000..87a518a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_5884dd(texture3d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float3 arg_3 = float3(0.0f);
+ float3 arg_4 = float3(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient3d(arg_3, arg_4), int3(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_5884dd(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleGrad_5884dd(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleGrad_5884dd(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm
new file mode 100644
index 0000000..cfe63eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; 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 %textureSampleGrad_5884dd "textureSampleGrad_5884dd"
+ 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 3D 0 0 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
+ %28 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %35 = OpConstantNull %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_5884dd = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_4 = OpVariable %_ptr_Function_v3float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %20
+ OpStore %arg_4 %20
+ %26 = OpLoad %14 %arg_1
+ %27 = OpLoad %11 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v3float %arg_2
+ %31 = OpLoad %v3float %arg_3
+ %32 = OpLoad %v3float %arg_4
+ %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad|ConstOffset %31 %32 %35
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleGrad_5884dd
+ 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 %textureSampleGrad_5884dd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleGrad_5884dd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl
new file mode 100644
index 0000000..cc06594
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/5884dd.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_5884dd() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = vec3<f32>();
+ var arg_4 = vec3<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec3<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_5884dd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_5884dd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_5884dd();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl
new file mode 100644
index 0000000..6528fbf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSampleGrad_d4e3c5() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = vec2<f32>();
+ var arg_4 = vec2<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_d4e3c5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_d4e3c5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_d4e3c5();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl
new file mode 100644
index 0000000..a772706
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleGrad_d4e3c5() {
+ vec2 arg_2 = vec2(0.0f);
+ vec2 arg_3 = vec2(0.0f);
+ vec2 arg_4 = vec2(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_d4e3c5();
+ 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_arg_1;
+
+void textureSampleGrad_d4e3c5() {
+ vec2 arg_2 = vec2(0.0f);
+ vec2 arg_3 = vec2(0.0f);
+ vec2 arg_4 = vec2(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleGrad_d4e3c5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleGrad_d4e3c5() {
+ vec2 arg_2 = vec2(0.0f);
+ vec2 arg_3 = vec2(0.0f);
+ vec2 arg_4 = vec2(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, arg_2, arg_3, arg_4, ivec2(0));
+}
+
+void compute_main() {
+ textureSampleGrad_d4e3c5();
+}
+
+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/textureSampleGrad/d4e3c5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.hlsl
new file mode 100644
index 0000000..203eca8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_d4e3c5() {
+ float2 arg_2 = (0.0f).xx;
+ float2 arg_3 = (0.0f).xx;
+ float2 arg_4 = (0.0f).xx;
+ float4 res = arg_0.SampleGrad(arg_1, arg_2, arg_3, arg_4, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_d4e3c5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_d4e3c5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_d4e3c5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl
new file mode 100644
index 0000000..166bab5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_d4e3c5(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float2 arg_3 = float2(0.0f);
+ float2 arg_4 = float2(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, gradient2d(arg_3, arg_4), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_d4e3c5(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleGrad_d4e3c5(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleGrad_d4e3c5(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm
new file mode 100644
index 0000000..817905a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; 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 %textureSampleGrad_d4e3c5 "textureSampleGrad_d4e3c5"
+ 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 0 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
+ %28 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %35 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_d4e3c5 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_4 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %20
+ OpStore %arg_4 %20
+ %26 = OpLoad %14 %arg_1
+ %27 = OpLoad %11 %arg_0
+ %29 = OpSampledImage %28 %27 %26
+ %30 = OpLoad %v2float %arg_2
+ %31 = OpLoad %v2float %arg_3
+ %32 = OpLoad %v2float %arg_4
+ %25 = OpImageSampleExplicitLod %v4float %29 %30 Grad|ConstOffset %31 %32 %35
+ OpStore %res %25
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleGrad_d4e3c5
+ 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 %textureSampleGrad_d4e3c5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleGrad_d4e3c5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl
new file mode 100644
index 0000000..65b1b2d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d4e3c5.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_d4e3c5() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = vec2<f32>();
+ var arg_4 = vec2<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_d4e3c5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_d4e3c5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_d4e3c5();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl
new file mode 100644
index 0000000..5e91af7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl
@@ -0,0 +1,51 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, ddx: vec2<f32>, ddy: vec2<f32>, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSampleGrad_d65515() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = vec2<f32>();
+ var arg_5 = vec2<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_d65515();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_d65515();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_d65515();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl
new file mode 100644
index 0000000..31c47a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.glsl
@@ -0,0 +1,67 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleGrad_d65515() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec2 arg_4 = vec2(0.0f);
+ vec2 arg_5 = vec2(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_d65515();
+ 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_arg_1;
+
+void textureSampleGrad_d65515() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec2 arg_4 = vec2(0.0f);
+ vec2 arg_5 = vec2(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleGrad_d65515();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleGrad_d65515() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ vec2 arg_4 = vec2(0.0f);
+ vec2 arg_5 = vec2(0.0f);
+ vec4 res = textureGradOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, arg_5, ivec2(0));
+}
+
+void compute_main() {
+ textureSampleGrad_d65515();
+}
+
+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/textureSampleGrad/d65515.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.hlsl
new file mode 100644
index 0000000..91e62c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_d65515() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float2 arg_4 = (0.0f).xx;
+ float2 arg_5 = (0.0f).xx;
+ float4 res = arg_0.SampleGrad(arg_1, float3(arg_2, float(arg_3)), arg_4, arg_5, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_d65515();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_d65515();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_d65515();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl
new file mode 100644
index 0000000..ad234a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_d65515(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float2 arg_4 = float2(0.0f);
+ float2 arg_5 = float2(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradient2d(arg_4, arg_5), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_d65515(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)]]) {
+ textureSampleGrad_d65515(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)]]) {
+ textureSampleGrad_d65515(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm
new file mode 100644
index 0000000..274c793
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.spvasm
@@ -0,0 +1,110 @@
+; 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_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleGrad_d65515 "textureSampleGrad_d65515"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %arg_5 "arg_5"
+ 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
+ %33 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %45 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %48 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_d65515 = 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_v2float Function %20
+ %arg_5 = OpVariable %_ptr_Function_v2float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %20
+ OpStore %arg_5 %20
+ %31 = OpLoad %14 %arg_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpSampledImage %33 %32 %31
+ %36 = OpLoad %v2float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %40 = OpLoad %int %arg_3
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v3float %37 %38 %39
+ %42 = OpLoad %v2float %arg_4
+ %43 = OpLoad %v2float %arg_5
+ %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad|ConstOffset %42 %43 %45
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleGrad_d65515
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureSampleGrad_d65515
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %textureSampleGrad_d65515
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl
new file mode 100644
index 0000000..b628819
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/d65515.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_d65515() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = vec2<f32>();
+ var arg_5 = vec2<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_d65515();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_d65515();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_d65515();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl
new file mode 100644
index 0000000..a39b522
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl
@@ -0,0 +1,51 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleGrad(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32, ddx: vec3<f32>, ddy: vec3<f32>) -> vec4<f32>
+fn textureSampleGrad_e383db() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = vec3<f32>();
+ var arg_5 = vec3<f32>();
+ var res: vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_e383db();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_e383db();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_e383db();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl
new file mode 100644
index 0000000..7e0c762
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.glsl
@@ -0,0 +1,90 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_arg_1;
+
+void textureSampleGrad_e383db() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec3 arg_4 = vec3(0.0f);
+ vec3 arg_5 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+vec4 vertex_main() {
+ textureSampleGrad_e383db();
+ 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_0_arg_1;
+
+void textureSampleGrad_e383db() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec3 arg_4 = vec3(0.0f);
+ vec3 arg_5 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+void fragment_main() {
+ textureSampleGrad_e383db();
+}
+
+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_0_arg_1;
+
+void textureSampleGrad_e383db() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ vec3 arg_4 = vec3(0.0f);
+ vec3 arg_5 = vec3(0.0f);
+ vec4 res = textureGrad(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+void compute_main() {
+ textureSampleGrad_e383db();
+}
+
+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/textureSampleGrad/e383db.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.hlsl
new file mode 100644
index 0000000..1f111fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleGrad_e383db() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float3 arg_4 = (0.0f).xxx;
+ float3 arg_5 = (0.0f).xxx;
+ float4 res = arg_0.SampleGrad(arg_1, float4(arg_2, float(arg_3)), arg_4, arg_5);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleGrad_e383db();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ textureSampleGrad_e383db();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleGrad_e383db();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl
new file mode 100644
index 0000000..e452422
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.msl
@@ -0,0 +1,37 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleGrad_e383db(texturecube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float3 arg_4 = float3(0.0f);
+ float3 arg_5 = float3(0.0f);
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, arg_3, gradientcube(arg_4, arg_5));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleGrad_e383db(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)]]) {
+ textureSampleGrad_e383db(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)]]) {
+ textureSampleGrad_e383db(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm
new file mode 100644
index 0000000..b63df46
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.spvasm
@@ -0,0 +1,109 @@
+; 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_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleGrad_e383db "textureSampleGrad_e383db"
+ OpName %arg_2 "arg_2"
+ OpName %arg_3 "arg_3"
+ OpName %arg_4 "arg_4"
+ OpName %arg_5 "arg_5"
+ 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
+ %33 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleGrad_e383db = 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_v3float Function %20
+ %arg_5 = OpVariable %_ptr_Function_v3float Function %20
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %20
+ OpStore %arg_5 %20
+ %31 = OpLoad %14 %arg_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpSampledImage %33 %32 %31
+ %35 = OpLoad %v3float %arg_2
+ %36 = OpCompositeExtract %float %35 0
+ %37 = OpCompositeExtract %float %35 1
+ %38 = OpCompositeExtract %float %35 2
+ %40 = OpLoad %int %arg_3
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v4float %36 %37 %38 %39
+ %42 = OpLoad %v3float %arg_4
+ %43 = OpLoad %v3float %arg_5
+ %30 = OpImageSampleExplicitLod %v4float %34 %41 Grad %42 %43
+ OpStore %res %30
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleGrad_e383db
+ 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 %textureSampleGrad_e383db
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureSampleGrad_e383db
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl
new file mode 100644
index 0000000..0085daf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleGrad/e383db.wgsl.expected.wgsl
@@ -0,0 +1,27 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleGrad_e383db() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = vec3<f32>();
+ var arg_5 = vec3<f32>();
+ var res : vec4<f32> = textureSampleGrad(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleGrad_e383db();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleGrad_e383db();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleGrad_e383db();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl
new file mode 100644
index 0000000..04c34b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: i32) -> f32
+fn textureSampleLevel_02be59() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 0;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_02be59();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_02be59();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_02be59();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl
new file mode 100644
index 0000000..eb71fe04
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleLevel_02be59() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 0;
+ float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_02be59();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureSampleLevel_02be59() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 0;
+ float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3));
+}
+
+void fragment_main() {
+ textureSampleLevel_02be59();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleLevel_02be59() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 0;
+ float res = textureLod(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3));
+}
+
+void compute_main() {
+ textureSampleLevel_02be59();
+}
+
+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/textureSampleLevel/02be59.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.hlsl
new file mode 100644
index 0000000..fd23cee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_02be59() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 0;
+ float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_02be59();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_02be59();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_02be59();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl
new file mode 100644
index 0000000..8aa0c85
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_02be59(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 0;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_02be59(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_02be59(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_02be59(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm
new file mode 100644
index 0000000..4d1fcc2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; 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_02be59 "textureSampleLevel_02be59"
+ 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
+ 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 0 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
+ %24 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %31 = OpTypeSampledImage %11
+%_ptr_Function_float = OpTypePointer Function %float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_02be59 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %24
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %24
+ %29 = OpLoad %14 %arg_1
+ %30 = OpLoad %11 %arg_0
+ %32 = OpSampledImage %31 %30 %29
+ %33 = OpLoad %v2float %arg_2
+ %35 = OpLoad %int %arg_3
+ %34 = OpConvertSToF %float %35
+ %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod %34
+ %27 = OpCompositeExtract %float %28 0
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleLevel_02be59
+ 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_02be59
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleLevel_02be59
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl
new file mode 100644
index 0000000..22ba964
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/02be59.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_02be59() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 0;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_02be59();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_02be59();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_02be59();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl
new file mode 100644
index 0000000..f73b6b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSampleLevel_0b0a1b() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_0b0a1b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_0b0a1b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_0b0a1b();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl
new file mode 100644
index 0000000..1562346
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleLevel_0b0a1b() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_0b0a1b();
+ 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_arg_1;
+
+void textureSampleLevel_0b0a1b() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_0b0a1b();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleLevel_0b0a1b() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_0b0a1b();
+}
+
+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/textureSampleLevel/0b0a1b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.hlsl
new file mode 100644
index 0000000..d57bb5e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_0b0a1b() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_0b0a1b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_0b0a1b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_0b0a1b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl
new file mode 100644
index 0000000..5aec41a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_0b0a1b(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_0b0a1b(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_0b0a1b(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_0b0a1b(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm
new file mode 100644
index 0000000..128e2c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; 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_0b0a1b "textureSampleLevel_0b0a1b"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %v2int = OpTypeVector %int 2
+ %35 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %38 = OpTypeFunction %v4float
+%textureSampleLevel_0b0a1b = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod|ConstOffset %32 %35
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleLevel_0b0a1b
+ 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
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleLevel_0b0a1b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureSampleLevel_0b0a1b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl
new file mode 100644
index 0000000..4924f7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0b0a1b.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_0b0a1b() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_0b0a1b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_0b0a1b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_0b0a1b();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl
new file mode 100644
index 0000000..098737a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32, level: f32) -> vec4<f32>
+fn textureSampleLevel_0bdd9a() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_0bdd9a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_0bdd9a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_0bdd9a();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl
new file mode 100644
index 0000000..5cff227
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArray arg_0_arg_1;
+
+void textureSampleLevel_0bdd9a() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_0bdd9a();
+ 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_0_arg_1;
+
+void textureSampleLevel_0bdd9a() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleLevel_0bdd9a();
+}
+
+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_0_arg_1;
+
+void textureSampleLevel_0bdd9a() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), arg_4);
+}
+
+void compute_main() {
+ textureSampleLevel_0bdd9a();
+}
+
+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/textureSampleLevel/0bdd9a.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.hlsl
new file mode 100644
index 0000000..fd1c612
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_0bdd9a() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, float4(arg_2, float(arg_3)), arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_0bdd9a();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_0bdd9a();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_0bdd9a();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl
new file mode 100644
index 0000000..1a157e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_0bdd9a(texturecube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 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(texturecube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_0bdd9a(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)]]) {
+ textureSampleLevel_0bdd9a(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)]]) {
+ textureSampleLevel_0bdd9a(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm
new file mode 100644
index 0000000..31adb35
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.spvasm
@@ -0,0 +1,106 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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_0bdd9a "textureSampleLevel_0bdd9a"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+%textureSampleLevel_0bdd9a = 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_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %36 = OpLoad %v3float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %39 = OpCompositeExtract %float %36 2
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v4float %37 %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod %43
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleLevel_0bdd9a
+ 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
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureSampleLevel_0bdd9a
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureSampleLevel_0bdd9a
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl
new file mode 100644
index 0000000..39434a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/0bdd9a.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_cube_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_0bdd9a() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_0bdd9a();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_0bdd9a();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_0bdd9a();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl
new file mode 100644
index 0000000..db67e3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_cube;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>, level: i32) -> f32
+fn textureSampleLevel_1b0291() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 0;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_1b0291();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_1b0291();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_1b0291();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl
new file mode 100644
index 0000000..19d3183
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSampleLevel_1b0291() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_1b0291();
+ 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:8: 'textureLod' : no matching overloaded function found
+ERROR: 0:8: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSampleLevel_1b0291() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3));
+}
+
+void fragment_main() {
+ textureSampleLevel_1b0291();
+}
+
+void main() {
+ fragment_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.
+
+
+
+#version 310 es
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+
+void textureSampleLevel_1b0291() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, 0.0f), float(arg_3));
+}
+
+void compute_main() {
+ textureSampleLevel_1b0291();
+}
+
+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:8: 'textureLod' : no matching overloaded function found
+ERROR: 0:8: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl
new file mode 100644
index 0000000..db87195
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_1b0291() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 0;
+ float res = arg_0.SampleLevel(arg_1, arg_2, arg_3).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_1b0291();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1b0291();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_1b0291();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl
new file mode 100644
index 0000000..6da05d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_1b0291(depthcube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 0;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_1b0291(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depthcube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_1b0291(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depthcube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_1b0291(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm
new file mode 100644
index 0000000..89a2e52
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; 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_1b0291 "textureSampleLevel_1b0291"
+ 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
+ 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 0 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
+ %24 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %31 = OpTypeSampledImage %11
+%_ptr_Function_float = OpTypePointer Function %float
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_1b0291 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %24
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %24
+ %29 = OpLoad %14 %arg_1
+ %30 = OpLoad %11 %arg_0
+ %32 = OpSampledImage %31 %30 %29
+ %33 = OpLoad %v3float %arg_2
+ %35 = OpLoad %int %arg_3
+ %34 = OpConvertSToF %float %35
+ %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod %34
+ %27 = OpCompositeExtract %float %28 0
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleLevel_1b0291
+ 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_1b0291
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleLevel_1b0291
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl
new file mode 100644
index 0000000..8a2bf5c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1b0291.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_cube;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_1b0291() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 0;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_1b0291();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_1b0291();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_1b0291();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl
new file mode 100644
index 0000000..673604d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> f32
+fn textureSampleLevel_1bf73e() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 0;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_1bf73e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_1bf73e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_1bf73e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl
new file mode 100644
index 0000000..910156b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_1bf73e() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_1bf73e();
+ 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_1bf73e() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+void fragment_main() {
+ textureSampleLevel_1bf73e();
+}
+
+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_1bf73e() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(vec3(arg_2, float(arg_3)), 0.0f), float(arg_4));
+}
+
+void compute_main() {
+ textureSampleLevel_1bf73e();
+}
+
+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/1bf73e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.hlsl
new file mode 100644
index 0000000..7f04b03
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_1bf73e() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_1bf73e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1bf73e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_1bf73e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl
new file mode 100644
index 0000000..672e629
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_1bf73e(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_1bf73e(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_1bf73e(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_1bf73e(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm
new file mode 100644
index 0000000..e19fd5b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.spvasm
@@ -0,0 +1,106 @@
+; 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_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_1bf73e "textureSampleLevel_1bf73e"
+ 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
+ %33 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_float = OpTypePointer Function %float
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_1bf73e = 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_int Function %27
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %27
+ %31 = OpLoad %14 %arg_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpSampledImage %33 %32 %31
+ %36 = OpLoad %v2float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %40 = OpLoad %int %arg_3
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v3float %37 %38 %39
+ %43 = OpLoad %int %arg_4
+ %42 = OpConvertSToF %float %43
+ %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod %42
+ %29 = OpCompositeExtract %float %30 0
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleLevel_1bf73e
+ 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 %textureSampleLevel_1bf73e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureSampleLevel_1bf73e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.wgsl.expected.wgsl
new file mode 100644
index 0000000..26332ba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/1bf73e.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_1bf73e() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 0;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_1bf73e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_1bf73e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_1bf73e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl
new file mode 100644
index 0000000..5797dbc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, level: f32) -> vec4<f32>
+fn textureSampleLevel_302be4() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_302be4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_302be4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_302be4();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl
new file mode 100644
index 0000000..faded30
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleLevel_302be4() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_302be4();
+ 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_arg_1;
+
+void textureSampleLevel_302be4() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+void fragment_main() {
+ textureSampleLevel_302be4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleLevel_302be4() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4);
+}
+
+void compute_main() {
+ textureSampleLevel_302be4();
+}
+
+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/textureSampleLevel/302be4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.hlsl
new file mode 100644
index 0000000..997a9e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_302be4() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_302be4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_302be4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_302be4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl
new file mode 100644
index 0000000..ec28870
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_302be4(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 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(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_302be4(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)]]) {
+ textureSampleLevel_302be4(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)]]) {
+ textureSampleLevel_302be4(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm
new file mode 100644
index 0000000..bebc87f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.spvasm
@@ -0,0 +1,105 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 59
+; 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_302be4 "textureSampleLevel_302be4"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %46 = OpTypeFunction %v4float
+%textureSampleLevel_302be4 = 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_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %37 = OpLoad %v2float %arg_2
+ %38 = OpCompositeExtract %float %37 0
+ %39 = OpCompositeExtract %float %37 1
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v3float %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod %43
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleLevel_302be4
+ 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
+ %54 = OpLabel
+ %55 = OpFunctionCall %void %textureSampleLevel_302be4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureSampleLevel_302be4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl
new file mode 100644
index 0000000..a31a4bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/302be4.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_302be4() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_302be4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_302be4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_302be4();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl
new file mode 100644
index 0000000..5069204
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, @const offset: vec2<i32>) -> f32
+fn textureSampleLevel_36780e() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 0;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_36780e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_36780e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_36780e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl
new file mode 100644
index 0000000..643f052
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_36780e() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_36780e();
+ 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_36780e() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_36780e();
+}
+
+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_36780e() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_36780e();
+}
+
+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/36780e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.hlsl
new file mode 100644
index 0000000..419b8c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_36780e() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_36780e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_36780e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_36780e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl
new file mode 100644
index 0000000..8c15da14
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_36780e(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_36780e(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_36780e(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_36780e(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm
new file mode 100644
index 0000000..cd86de3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.spvasm
@@ -0,0 +1,108 @@
+; 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_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_36780e "textureSampleLevel_36780e"
+ 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
+ %33 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %45 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %48 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_36780e = 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_int Function %27
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %27
+ %31 = OpLoad %14 %arg_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpSampledImage %33 %32 %31
+ %36 = OpLoad %v2float %arg_2
+ %37 = OpCompositeExtract %float %36 0
+ %38 = OpCompositeExtract %float %36 1
+ %40 = OpLoad %int %arg_3
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v3float %37 %38 %39
+ %43 = OpLoad %int %arg_4
+ %42 = OpConvertSToF %float %43
+ %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod|ConstOffset %42 %45
+ %29 = OpCompositeExtract %float %30 0
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleLevel_36780e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %57 = OpLabel
+ %58 = OpFunctionCall %void %textureSampleLevel_36780e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %60 = OpLabel
+ %61 = OpFunctionCall %void %textureSampleLevel_36780e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/36780e.wgsl.expected.wgsl
new file mode 100644
index 0000000..affece6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/36780e.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_36780e() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 0;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_36780e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_36780e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_36780e();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl
new file mode 100644
index 0000000..a64a9e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_depth_2d;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: i32, @const offset: vec2<i32>) -> f32
+fn textureSampleLevel_749baf() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 0;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_749baf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_749baf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_749baf();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl
new file mode 100644
index 0000000..a2d34d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleLevel_749baf() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 0;
+ float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_749baf();
+ 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 sampler2DShadow arg_0_arg_1;
+
+void textureSampleLevel_749baf() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 0;
+ float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_749baf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DShadow arg_0_arg_1;
+
+void textureSampleLevel_749baf() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 0;
+ float res = textureLodOffset(arg_0_arg_1, vec3(arg_2, 0.0f), float(arg_3), ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_749baf();
+}
+
+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/textureSampleLevel/749baf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.hlsl
new file mode 100644
index 0000000..b1b58de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_749baf() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 0;
+ float res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xx).x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_749baf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_749baf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_749baf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl
new file mode 100644
index 0000000..8ea81b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_749baf(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 0;
+ float res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int2(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_749baf(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(depth2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_749baf(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_749baf(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm
new file mode 100644
index 0000000..c48597c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.spvasm
@@ -0,0 +1,98 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureSampleLevel_749baf "textureSampleLevel_749baf"
+ 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
+ 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 0 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
+ %24 = OpConstantNull %int
+%_ptr_Function_int = OpTypePointer Function %int
+ %31 = OpTypeSampledImage %11
+ %v2int = OpTypeVector %int 2
+ %37 = OpConstantNull %v2int
+%_ptr_Function_float = OpTypePointer Function %float
+ %40 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_749baf = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_int Function %24
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %24
+ %29 = OpLoad %14 %arg_1
+ %30 = OpLoad %11 %arg_0
+ %32 = OpSampledImage %31 %30 %29
+ %33 = OpLoad %v2float %arg_2
+ %35 = OpLoad %int %arg_3
+ %34 = OpConvertSToF %float %35
+ %28 = OpImageSampleExplicitLod %v4float %32 %33 Lod|ConstOffset %34 %37
+ %27 = OpCompositeExtract %float %28 0
+ OpStore %res %27
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %40
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureSampleLevel_749baf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %46
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureSampleLevel_749baf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %52 = OpLabel
+ %53 = OpFunctionCall %void %textureSampleLevel_749baf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl
new file mode 100644
index 0000000..f6f7597
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/749baf.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_depth_2d;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_749baf() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 0;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_749baf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_749baf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_749baf();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl
new file mode 100644
index 0000000..fce2b83
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_external;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
+fn textureSampleLevel_979816() {
+ var arg_2 = vec2<f32>();
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_979816();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_979816();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_979816();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl
new file mode 100644
index 0000000..b55ac19
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.glsl
@@ -0,0 +1,228 @@
+SKIP: FAILED
+
+#version 310 es
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 3) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
+ bvec3 cond = lessThan(abs(v), vec3(params.D));
+ vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
+ return mix(f, t, cond);
+}
+
+
+vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
+ vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = textureLod(plane0_smp, coord, 0.0f).rgb;
+ } else {
+ color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return vec4(color, 1.0f);
+}
+
+uniform highp sampler2D arg_0_arg_1;
+uniform highp sampler2D ext_tex_plane_1_arg_1;
+void textureSampleLevel_979816() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params);
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_979816();
+ 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:55: 'textureSampleExternal' : no matching overloaded function found
+ERROR: 0:55: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float'
+ERROR: 0:55: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 3) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
+ bvec3 cond = lessThan(abs(v), vec3(params.D));
+ vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
+ return mix(f, t, cond);
+}
+
+
+vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
+ vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = textureLod(plane0_smp, coord, 0.0f).rgb;
+ } else {
+ color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return vec4(color, 1.0f);
+}
+
+uniform highp sampler2D arg_0_arg_1;
+uniform highp sampler2D ext_tex_plane_1_arg_1;
+void textureSampleLevel_979816() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params);
+}
+
+void fragment_main() {
+ textureSampleLevel_979816();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:56: 'textureSampleExternal' : no matching overloaded function found
+ERROR: 0:56: '=' : cannot convert from ' const float' to ' temp mediump 4-component vector of float'
+ERROR: 0:56: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+
+struct ExternalTextureParams {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+};
+
+layout(binding = 3) uniform ExternalTextureParams_1 {
+ uint numPlanes;
+ mat3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ mat3 gamutConversionMatrix;
+} ext_tex_params;
+
+vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
+ bvec3 cond = lessThan(abs(v), vec3(params.D));
+ vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
+ return mix(f, t, cond);
+}
+
+
+vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
+ vec3 color = vec3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = textureLod(plane0_smp, coord, 0.0f).rgb;
+ } else {
+ color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return vec4(color, 1.0f);
+}
+
+uniform highp sampler2D arg_0_arg_1;
+uniform highp sampler2D ext_tex_plane_1_arg_1;
+void textureSampleLevel_979816() {
+ vec2 arg_2 = vec2(0.0f);
+ vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params);
+}
+
+void compute_main() {
+ textureSampleLevel_979816();
+}
+
+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:55: 'textureSampleExternal' : no matching overloaded function found
+ERROR: 0:55: '=' : cannot convert from ' const float' to ' temp highp 4-component vector of float'
+ERROR: 0:55: '' : compilation terminated
+ERROR: 3 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl
new file mode 100644
index 0000000..5aae94c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.hlsl
@@ -0,0 +1,109 @@
+struct GammaTransferParams {
+ float G;
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ uint padding;
+};
+struct ExternalTextureParams {
+ uint numPlanes;
+ float3x4 yuvToRgbConversionMatrix;
+ GammaTransferParams gammaDecodeParams;
+ GammaTransferParams gammaEncodeParams;
+ float3x3 gamutConversionMatrix;
+};
+
+Texture2D<float4> ext_tex_plane_1 : register(t2, space1);
+cbuffer cbuffer_ext_tex_params : register(b3, space1) {
+ uint4 ext_tex_params[11];
+};
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+float3 gammaCorrection(float3 v, GammaTransferParams params) {
+ const bool3 cond = (abs(v) < float3((params.D).xxx));
+ const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
+ const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
+ return (cond ? t : f);
+}
+
+float4 textureSampleExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, SamplerState smp, float2 coord, ExternalTextureParams params) {
+ float3 color = float3(0.0f, 0.0f, 0.0f);
+ if ((params.numPlanes == 1u)) {
+ color = plane0.SampleLevel(smp, coord, 0.0f).rgb;
+ } else {
+ color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f));
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = mul(color, params.gamutConversionMatrix);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return float4(color, 1.0f);
+}
+
+float3x4 tint_symbol_3(uint4 buffer[11], uint offset) {
+ const uint scalar_offset = ((offset + 0u)) / 4;
+ const uint scalar_offset_1 = ((offset + 16u)) / 4;
+ const uint scalar_offset_2 = ((offset + 32u)) / 4;
+ return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]));
+}
+
+GammaTransferParams tint_symbol_5(uint4 buffer[11], uint offset) {
+ const uint scalar_offset_3 = ((offset + 0u)) / 4;
+ const uint scalar_offset_4 = ((offset + 4u)) / 4;
+ const uint scalar_offset_5 = ((offset + 8u)) / 4;
+ const uint scalar_offset_6 = ((offset + 12u)) / 4;
+ const uint scalar_offset_7 = ((offset + 16u)) / 4;
+ const uint scalar_offset_8 = ((offset + 20u)) / 4;
+ const uint scalar_offset_9 = ((offset + 24u)) / 4;
+ const uint scalar_offset_10 = ((offset + 28u)) / 4;
+ const GammaTransferParams tint_symbol_9 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]};
+ return tint_symbol_9;
+}
+
+float3x3 tint_symbol_7(uint4 buffer[11], uint offset) {
+ const uint scalar_offset_11 = ((offset + 0u)) / 4;
+ const uint scalar_offset_12 = ((offset + 16u)) / 4;
+ const uint scalar_offset_13 = ((offset + 32u)) / 4;
+ return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz));
+}
+
+ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) {
+ const uint scalar_offset_14 = ((offset + 0u)) / 4;
+ const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))};
+ return tint_symbol_10;
+}
+
+void textureSampleLevel_979816() {
+ float2 arg_2 = (0.0f).xx;
+ float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, arg_2, tint_symbol_1(ext_tex_params, 0u));
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_979816();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_979816();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_979816();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl
new file mode 100644
index 0000000..2dabca5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.msl
@@ -0,0 +1,74 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct GammaTransferParams {
+ /* 0x0000 */ float G;
+ /* 0x0004 */ float A;
+ /* 0x0008 */ float B;
+ /* 0x000c */ float C;
+ /* 0x0010 */ float D;
+ /* 0x0014 */ float E;
+ /* 0x0018 */ float F;
+ /* 0x001c */ uint padding;
+};
+
+struct ExternalTextureParams {
+ /* 0x0000 */ uint numPlanes;
+ /* 0x0004 */ int8_t tint_pad[12];
+ /* 0x0010 */ float3x4 yuvToRgbConversionMatrix;
+ /* 0x0040 */ GammaTransferParams gammaDecodeParams;
+ /* 0x0060 */ GammaTransferParams gammaEncodeParams;
+ /* 0x0080 */ float3x3 gamutConversionMatrix;
+};
+
+float3 gammaCorrection(float3 v, GammaTransferParams params) {
+ bool3 const cond = (fabs(v) < float3(params.D));
+ float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F));
+ float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E));
+ return select(f, t, cond);
+}
+
+float4 textureSampleExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, sampler smp, float2 coord, ExternalTextureParams params) {
+ float3 color = 0.0f;
+ if ((params.numPlanes == 1u)) {
+ color = float4(plane0.sample(smp, coord, level(0.0f))).rgb;
+ } else {
+ color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix);
+ }
+ color = gammaCorrection(color, params.gammaDecodeParams);
+ color = (params.gamutConversionMatrix * color);
+ color = gammaCorrection(color, params.gammaEncodeParams);
+ return float4(color, 1.0f);
+}
+
+void textureSampleLevel_979816(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) {
+ float2 arg_2 = float2(0.0f);
+ float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, arg_2, *(tint_symbol_4));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_5, texture2d<float, access::sample> tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) {
+ textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], texture2d<float, access::sample> tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) {
+ float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12);
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main(texture2d<float, access::sample> tint_symbol_13 [[texture(0)]], texture2d<float, access::sample> tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) {
+ textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_17 [[texture(0)]], texture2d<float, access::sample> tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) {
+ textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm
new file mode 100644
index 0000000..69123b5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.spvasm
@@ -0,0 +1,243 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 138
+; Schema: 0
+ OpCapability Shader
+ %30 = OpExtInstImport "GLSL.std.450"
+ 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 %ext_tex_plane_1 "ext_tex_plane_1"
+ OpName %ExternalTextureParams "ExternalTextureParams"
+ OpMemberName %ExternalTextureParams 0 "numPlanes"
+ OpMemberName %ExternalTextureParams 1 "yuvToRgbConversionMatrix"
+ OpMemberName %ExternalTextureParams 2 "gammaDecodeParams"
+ OpName %GammaTransferParams "GammaTransferParams"
+ OpMemberName %GammaTransferParams 0 "G"
+ OpMemberName %GammaTransferParams 1 "A"
+ OpMemberName %GammaTransferParams 2 "B"
+ OpMemberName %GammaTransferParams 3 "C"
+ OpMemberName %GammaTransferParams 4 "D"
+ OpMemberName %GammaTransferParams 5 "E"
+ OpMemberName %GammaTransferParams 6 "F"
+ OpMemberName %GammaTransferParams 7 "padding"
+ OpMemberName %ExternalTextureParams 3 "gammaEncodeParams"
+ OpMemberName %ExternalTextureParams 4 "gamutConversionMatrix"
+ OpName %ext_tex_params "ext_tex_params"
+ OpName %arg_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %gammaCorrection "gammaCorrection"
+ OpName %v "v"
+ OpName %params "params"
+ OpName %textureSampleExternal "textureSampleExternal"
+ OpName %plane0 "plane0"
+ OpName %plane1 "plane1"
+ OpName %smp "smp"
+ OpName %coord "coord"
+ OpName %params_0 "params"
+ OpName %color "color"
+ OpName %textureSampleLevel_979816 "textureSampleLevel_979816"
+ 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 %ext_tex_plane_1 DescriptorSet 1
+ OpDecorate %ext_tex_plane_1 Binding 2
+ OpDecorate %ExternalTextureParams Block
+ OpMemberDecorate %ExternalTextureParams 0 Offset 0
+ OpMemberDecorate %ExternalTextureParams 1 Offset 16
+ OpMemberDecorate %ExternalTextureParams 1 ColMajor
+ OpMemberDecorate %ExternalTextureParams 1 MatrixStride 16
+ OpMemberDecorate %ExternalTextureParams 2 Offset 64
+ OpMemberDecorate %GammaTransferParams 0 Offset 0
+ OpMemberDecorate %GammaTransferParams 1 Offset 4
+ OpMemberDecorate %GammaTransferParams 2 Offset 8
+ OpMemberDecorate %GammaTransferParams 3 Offset 12
+ OpMemberDecorate %GammaTransferParams 4 Offset 16
+ OpMemberDecorate %GammaTransferParams 5 Offset 20
+ OpMemberDecorate %GammaTransferParams 6 Offset 24
+ OpMemberDecorate %GammaTransferParams 7 Offset 28
+ OpMemberDecorate %ExternalTextureParams 3 Offset 96
+ OpMemberDecorate %ExternalTextureParams 4 Offset 128
+ OpMemberDecorate %ExternalTextureParams 4 ColMajor
+ OpMemberDecorate %ExternalTextureParams 4 MatrixStride 16
+ OpDecorate %ext_tex_params NonWritable
+ OpDecorate %ext_tex_params DescriptorSet 1
+ OpDecorate %ext_tex_params Binding 3
+ 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 0 0 1 Unknown
+%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
+%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %uint = OpTypeInt 32 0
+%mat3v4float = OpTypeMatrix %v4float 3
+%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
+ %v3float = OpTypeVector %float 3
+%mat3v3float = OpTypeMatrix %v3float 3
+%ExternalTextureParams = OpTypeStruct %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float
+%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
+%ext_tex_params = OpVariable %_ptr_Uniform_ExternalTextureParams Uniform
+ %arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+ %23 = OpTypeSampler
+%_ptr_UniformConstant_23 = OpTypePointer UniformConstant %23
+ %arg_1 = OpVariable %_ptr_UniformConstant_23 UniformConstant
+ %24 = OpTypeFunction %v3float %v3float %GammaTransferParams
+ %bool = OpTypeBool
+ %v3bool = OpTypeVector %bool 3
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %44 = OpConstantNull %v3float
+ %v2float = OpTypeVector %float 2
+ %64 = OpTypeFunction %v4float %11 %11 %23 %v2float %ExternalTextureParams
+ %uint_1 = OpConstant %uint 1
+ %81 = OpTypeSampledImage %11
+ %float_1 = OpConstant %float 1
+ %void = OpTypeVoid
+ %110 = OpTypeFunction %void
+ %114 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %125 = OpTypeFunction %v4float
+%gammaCorrection = OpFunction %v3float None %24
+ %v = OpFunctionParameter %v3float
+ %params = OpFunctionParameter %GammaTransferParams
+ %28 = OpLabel
+ %42 = OpVariable %_ptr_Function_v3float Function %44
+ %54 = OpVariable %_ptr_Function_v3float Function %44
+ %60 = OpVariable %_ptr_Function_v3float Function %44
+ %29 = OpExtInst %v3float %30 FAbs %v
+ %31 = OpCompositeExtract %float %params 4
+ %32 = OpCompositeConstruct %v3float %31 %31 %31
+ %33 = OpFOrdLessThan %v3bool %29 %32
+ %36 = OpExtInst %v3float %30 FSign %v
+ %37 = OpCompositeExtract %float %params 3
+ %38 = OpExtInst %v3float %30 FAbs %v
+ %39 = OpVectorTimesScalar %v3float %38 %37
+ %40 = OpCompositeExtract %float %params 6
+ %45 = OpCompositeConstruct %v3float %40 %40 %40
+ %41 = OpFAdd %v3float %39 %45
+ %46 = OpFMul %v3float %36 %41
+ %47 = OpExtInst %v3float %30 FSign %v
+ %49 = OpCompositeExtract %float %params 1
+ %50 = OpExtInst %v3float %30 FAbs %v
+ %51 = OpVectorTimesScalar %v3float %50 %49
+ %52 = OpCompositeExtract %float %params 2
+ %55 = OpCompositeConstruct %v3float %52 %52 %52
+ %53 = OpFAdd %v3float %51 %55
+ %56 = OpCompositeExtract %float %params 0
+ %57 = OpCompositeConstruct %v3float %56 %56 %56
+ %48 = OpExtInst %v3float %30 Pow %53 %57
+ %58 = OpCompositeExtract %float %params 5
+ %61 = OpCompositeConstruct %v3float %58 %58 %58
+ %59 = OpFAdd %v3float %48 %61
+ %62 = OpFMul %v3float %47 %59
+ %63 = OpSelect %v3float %33 %46 %62
+ OpReturnValue %63
+ OpFunctionEnd
+%textureSampleExternal = OpFunction %v4float None %64
+ %plane0 = OpFunctionParameter %11
+ %plane1 = OpFunctionParameter %11
+ %smp = OpFunctionParameter %23
+ %coord = OpFunctionParameter %v2float
+ %params_0 = OpFunctionParameter %ExternalTextureParams
+ %72 = OpLabel
+ %color = OpVariable %_ptr_Function_v3float Function %44
+ %74 = OpCompositeExtract %uint %params_0 0
+ %76 = OpIEqual %bool %74 %uint_1
+ OpSelectionMerge %77 None
+ OpBranchConditional %76 %78 %79
+ %78 = OpLabel
+ %82 = OpSampledImage %81 %plane0 %smp
+ %80 = OpImageSampleExplicitLod %v4float %82 %coord Lod %8
+ %83 = OpVectorShuffle %v3float %80 %80 0 1 2
+ OpStore %color %83
+ OpBranch %77
+ %79 = OpLabel
+ %85 = OpSampledImage %81 %plane0 %smp
+ %84 = OpImageSampleExplicitLod %v4float %85 %coord Lod %8
+ %86 = OpCompositeExtract %float %84 0
+ %88 = OpSampledImage %81 %plane1 %smp
+ %87 = OpImageSampleExplicitLod %v4float %88 %coord Lod %8
+ %89 = OpVectorShuffle %v2float %87 %87 0 1
+ %90 = OpCompositeExtract %float %89 0
+ %91 = OpCompositeExtract %float %89 1
+ %93 = OpCompositeConstruct %v4float %86 %90 %91 %float_1
+ %94 = OpCompositeExtract %mat3v4float %params_0 1
+ %95 = OpVectorTimesMatrix %v3float %93 %94
+ OpStore %color %95
+ OpBranch %77
+ %77 = OpLabel
+ %97 = OpLoad %v3float %color
+ %98 = OpCompositeExtract %GammaTransferParams %params_0 2
+ %96 = OpFunctionCall %v3float %gammaCorrection %97 %98
+ OpStore %color %96
+ %99 = OpCompositeExtract %mat3v3float %params_0 4
+ %100 = OpLoad %v3float %color
+ %101 = OpMatrixTimesVector %v3float %99 %100
+ OpStore %color %101
+ %103 = OpLoad %v3float %color
+ %104 = OpCompositeExtract %GammaTransferParams %params_0 3
+ %102 = OpFunctionCall %v3float %gammaCorrection %103 %104
+ OpStore %color %102
+ %105 = OpLoad %v3float %color
+ %106 = OpCompositeExtract %float %105 0
+ %107 = OpCompositeExtract %float %105 1
+ %108 = OpCompositeExtract %float %105 2
+ %109 = OpCompositeConstruct %v4float %106 %107 %108 %float_1
+ OpReturnValue %109
+ OpFunctionEnd
+%textureSampleLevel_979816 = OpFunction %void None %110
+ %113 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %114
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %114
+ %118 = OpLoad %11 %arg_0
+ %119 = OpLoad %11 %ext_tex_plane_1
+ %120 = OpLoad %23 %arg_1
+ %121 = OpLoad %v2float %arg_2
+ %122 = OpLoad %ExternalTextureParams %ext_tex_params
+ %117 = OpFunctionCall %v4float %textureSampleExternal %118 %119 %120 %121 %122
+ OpStore %res %117
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %125
+ %127 = OpLabel
+ %128 = OpFunctionCall %void %textureSampleLevel_979816
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %110
+ %130 = OpLabel
+ %131 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %131
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %110
+ %133 = OpLabel
+ %134 = OpFunctionCall %void %textureSampleLevel_979816
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %110
+ %136 = OpLabel
+ %137 = OpFunctionCall %void %textureSampleLevel_979816
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl
new file mode 100644
index 0000000..c22b080
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/979816.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_external;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_979816() {
+ var arg_2 = vec2<f32>();
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_979816();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_979816();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_979816();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl
new file mode 100644
index 0000000..7df2fc7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32>
+fn textureSampleLevel_abfcc0() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_abfcc0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_abfcc0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_abfcc0();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl
new file mode 100644
index 0000000..f94eaea
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleLevel_abfcc0() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_abfcc0();
+ 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_arg_1;
+
+void textureSampleLevel_abfcc0() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleLevel_abfcc0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleLevel_abfcc0() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ textureSampleLevel_abfcc0();
+}
+
+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/textureSampleLevel/abfcc0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.hlsl
new file mode 100644
index 0000000..cabcb90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_abfcc0() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_abfcc0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_abfcc0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_abfcc0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl
new file mode 100644
index 0000000..399820b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_abfcc0(texture3d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_abfcc0(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_abfcc0(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_abfcc0(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm
new file mode 100644
index 0000000..46b9eb5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureSampleLevel_abfcc0 "textureSampleLevel_abfcc0"
+ 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
+ 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 3D 0 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+%textureSampleLevel_abfcc0 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleLevel_abfcc0
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleLevel_abfcc0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleLevel_abfcc0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl
new file mode 100644
index 0000000..744d29c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/abfcc0.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_abfcc0() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_abfcc0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_abfcc0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_abfcc0();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl
new file mode 100644
index 0000000..1a27086
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32) -> f32
+fn textureSampleLevel_ae5e39() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 0;
+ var res: f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_ae5e39();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_ae5e39();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_ae5e39();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl
new file mode 100644
index 0000000..9c64c66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.glsl
@@ -0,0 +1,87 @@
+SKIP: FAILED
+
+#version 310 es
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+
+void textureSampleLevel_ae5e39() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_ae5e39();
+ 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_ae5e39() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+void fragment_main() {
+ textureSampleLevel_ae5e39();
+}
+
+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_ae5e39() {
+ vec3 arg_2 = vec3(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ float res = textureLod(arg_0_arg_1, vec4(arg_2, float(arg_3)), float(arg_4));
+}
+
+void compute_main() {
+ textureSampleLevel_ae5e39();
+}
+
+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/ae5e39.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.hlsl
new file mode 100644
index 0000000..d003c3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+TextureCubeArray arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_ae5e39() {
+ float3 arg_2 = (0.0f).xxx;
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_ae5e39();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_ae5e39();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_ae5e39();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl
new file mode 100644
index 0000000..f50b671
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_ae5e39(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ int arg_3 = 1;
+ int arg_4 = 0;
+ 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_ae5e39(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_ae5e39(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_ae5e39(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm
new file mode 100644
index 0000000..ee03d7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; 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_0 "arg_0"
+ OpName %arg_1 "arg_1"
+ OpName %textureSampleLevel_ae5e39 "textureSampleLevel_ae5e39"
+ 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
+ %33 = OpTypeSampledImage %11
+%_ptr_Function_float = OpTypePointer Function %float
+ %46 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureSampleLevel_ae5e39 = 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_int Function %27
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %27
+ %31 = OpLoad %14 %arg_1
+ %32 = OpLoad %11 %arg_0
+ %34 = OpSampledImage %33 %32 %31
+ %35 = OpLoad %v3float %arg_2
+ %36 = OpCompositeExtract %float %35 0
+ %37 = OpCompositeExtract %float %35 1
+ %38 = OpCompositeExtract %float %35 2
+ %40 = OpLoad %int %arg_3
+ %39 = OpConvertSToF %float %40
+ %41 = OpCompositeConstruct %v4float %36 %37 %38 %39
+ %43 = OpLoad %int %arg_4
+ %42 = OpConvertSToF %float %43
+ %30 = OpImageSampleExplicitLod %v4float %34 %41 Lod %42
+ %29 = OpCompositeExtract %float %30 0
+ OpStore %res %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %46
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureSampleLevel_ae5e39
+ 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 %textureSampleLevel_ae5e39
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %58 = OpLabel
+ %59 = OpFunctionCall %void %textureSampleLevel_ae5e39
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.wgsl.expected.wgsl
new file mode 100644
index 0000000..b67993a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/ae5e39.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_ae5e39() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1;
+ var arg_4 = 0;
+ var res : f32 = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_ae5e39();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_ae5e39();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_ae5e39();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl
new file mode 100644
index 0000000..6e68866
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl
@@ -0,0 +1,50 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d_array<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, level: f32, @const offset: vec2<i32>) -> vec4<f32>
+fn textureSampleLevel_b7c55c() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_b7c55c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_b7c55c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_b7c55c();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl
new file mode 100644
index 0000000..baad622
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.glsl
@@ -0,0 +1,64 @@
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleLevel_b7c55c() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_b7c55c();
+ 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_arg_1;
+
+void textureSampleLevel_b7c55c() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_b7c55c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2DArray arg_0_arg_1;
+
+void textureSampleLevel_b7c55c() {
+ vec2 arg_2 = vec2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, vec3(arg_2, float(arg_3)), arg_4, ivec2(0));
+}
+
+void compute_main() {
+ textureSampleLevel_b7c55c();
+}
+
+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/textureSampleLevel/b7c55c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.hlsl
new file mode 100644
index 0000000..df52dfd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+Texture2DArray<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_b7c55c() {
+ float2 arg_2 = (0.0f).xx;
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, float3(arg_2, float(arg_3)), arg_4, (0).xx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_b7c55c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_b7c55c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_b7c55c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl
new file mode 100644
index 0000000..a1882e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_b7c55c(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ int arg_3 = 1;
+ float arg_4 = 1.0f;
+ float4 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(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_b7c55c(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)]]) {
+ textureSampleLevel_b7c55c(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)]]) {
+ textureSampleLevel_b7c55c(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm
new file mode 100644
index 0000000..d7121f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.spvasm
@@ -0,0 +1,107 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 61
+; 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_b7c55c "textureSampleLevel_b7c55c"
+ 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %34 = OpTypeSampledImage %11
+ %v3float = OpTypeVector %float 3
+ %v2int = OpTypeVector %int 2
+ %45 = OpConstantNull %v2int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %48 = OpTypeFunction %v4float
+%textureSampleLevel_b7c55c = 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_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %int_1
+ OpStore %arg_4 %float_1
+ %32 = OpLoad %14 %arg_1
+ %33 = OpLoad %11 %arg_0
+ %35 = OpSampledImage %34 %33 %32
+ %37 = OpLoad %v2float %arg_2
+ %38 = OpCompositeExtract %float %37 0
+ %39 = OpCompositeExtract %float %37 1
+ %41 = OpLoad %int %arg_3
+ %40 = OpConvertSToF %float %41
+ %42 = OpCompositeConstruct %v3float %38 %39 %40
+ %43 = OpLoad %float %arg_4
+ %31 = OpImageSampleExplicitLod %v4float %35 %42 Lod|ConstOffset %43 %45
+ OpStore %res %31
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %48
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureSampleLevel_b7c55c
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %15
+ %53 = OpLabel
+ %54 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %54
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %15
+ %56 = OpLabel
+ %57 = OpFunctionCall %void %textureSampleLevel_b7c55c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %59 = OpLabel
+ %60 = OpFunctionCall %void %textureSampleLevel_b7c55c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl
new file mode 100644
index 0000000..06098f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/b7c55c.wgsl.expected.wgsl
@@ -0,0 +1,26 @@
+@group(1) @binding(0) var arg_0 : texture_2d_array<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_b7c55c() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1;
+ var arg_4 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, arg_4, vec2<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_b7c55c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_b7c55c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_b7c55c();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl
new file mode 100644
index 0000000..17882a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_cube<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32>
+fn textureSampleLevel_c32df7() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_c32df7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_c32df7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_c32df7();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl
new file mode 100644
index 0000000..91a2a08
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp samplerCube arg_0_arg_1;
+
+void textureSampleLevel_c32df7() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_c32df7();
+ 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 samplerCube arg_0_arg_1;
+
+void textureSampleLevel_c32df7() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleLevel_c32df7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp samplerCube arg_0_arg_1;
+
+void textureSampleLevel_c32df7() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ textureSampleLevel_c32df7();
+}
+
+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/textureSampleLevel/c32df7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.hlsl
new file mode 100644
index 0000000..e5a4de6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+TextureCube<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_c32df7() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_c32df7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c32df7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_c32df7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl
new file mode 100644
index 0000000..aed7544
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_c32df7(texturecube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_c32df7(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texturecube<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_c32df7(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texturecube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_c32df7(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm
new file mode 100644
index 0000000..a5cb38f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureSampleLevel_c32df7 "textureSampleLevel_c32df7"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+%textureSampleLevel_c32df7 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleLevel_c32df7
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleLevel_c32df7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleLevel_c32df7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl
new file mode 100644
index 0000000..4920ce1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c32df7.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_cube<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_c32df7() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_c32df7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_c32df7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_c32df7();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl
new file mode 100644
index 0000000..5a7d65c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_2d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32) -> vec4<f32>
+fn textureSampleLevel_c6aca6() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_c6aca6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_c6aca6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_c6aca6();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl
new file mode 100644
index 0000000..7784b1e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleLevel_c6aca6() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_c6aca6();
+ 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_arg_1;
+
+void textureSampleLevel_c6aca6() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+void fragment_main() {
+ textureSampleLevel_c6aca6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler2D arg_0_arg_1;
+
+void textureSampleLevel_c6aca6() {
+ vec2 arg_2 = vec2(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLod(arg_0_arg_1, arg_2, arg_3);
+}
+
+void compute_main() {
+ textureSampleLevel_c6aca6();
+}
+
+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/textureSampleLevel/c6aca6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.hlsl
new file mode 100644
index 0000000..812fee1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture2D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_c6aca6() {
+ float2 arg_2 = (0.0f).xx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_c6aca6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c6aca6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_c6aca6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl
new file mode 100644
index 0000000..1f0f432
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_c6aca6(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float2 arg_2 = float2(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_c6aca6(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_c6aca6(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_c6aca6(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm
new file mode 100644
index 0000000..f0f3069
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %arg_1 "arg_1"
+ OpName %textureSampleLevel_c6aca6 "textureSampleLevel_c6aca6"
+ 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
+ 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 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %35 = OpTypeFunction %v4float
+%textureSampleLevel_c6aca6 = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v2float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v2float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod %32
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %35
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %textureSampleLevel_c6aca6
+ 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
+ %43 = OpLabel
+ %44 = OpFunctionCall %void %textureSampleLevel_c6aca6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleLevel_c6aca6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl
new file mode 100644
index 0000000..670b79f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/c6aca6.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_2d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_c6aca6() {
+ var arg_2 = vec2<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_c6aca6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_c6aca6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_c6aca6();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl
new file mode 100644
index 0000000..944db01
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_3d<f32>;
+@group(1) @binding(1) var arg_1: sampler;
+
+// fn textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32, @const offset: vec3<i32>) -> vec4<f32>
+fn textureSampleLevel_dcbecb() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec3<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_dcbecb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_dcbecb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_dcbecb();
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl
new file mode 100644
index 0000000..3875ed6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleLevel_dcbecb() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0));
+}
+
+vec4 vertex_main() {
+ textureSampleLevel_dcbecb();
+ 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_arg_1;
+
+void textureSampleLevel_dcbecb() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0));
+}
+
+void fragment_main() {
+ textureSampleLevel_dcbecb();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+uniform highp sampler3D arg_0_arg_1;
+
+void textureSampleLevel_dcbecb() {
+ vec3 arg_2 = vec3(0.0f);
+ float arg_3 = 1.0f;
+ vec4 res = textureLodOffset(arg_0_arg_1, arg_2, arg_3, ivec3(0));
+}
+
+void compute_main() {
+ textureSampleLevel_dcbecb();
+}
+
+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/textureSampleLevel/dcbecb.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.hlsl
new file mode 100644
index 0000000..1c3bad7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+Texture3D<float4> arg_0 : register(t0, space1);
+SamplerState arg_1 : register(s1, space1);
+
+void textureSampleLevel_dcbecb() {
+ float3 arg_2 = (0.0f).xxx;
+ float arg_3 = 1.0f;
+ float4 res = arg_0.SampleLevel(arg_1, arg_2, arg_3, (0).xxx);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureSampleLevel_dcbecb();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_dcbecb();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureSampleLevel_dcbecb();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl
new file mode 100644
index 0000000..9068307
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureSampleLevel_dcbecb(texture3d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
+ float3 arg_2 = float3(0.0f);
+ float arg_3 = 1.0f;
+ float4 res = tint_symbol_1.sample(tint_symbol_2, arg_2, level(arg_3), int3(0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
+ textureSampleLevel_dcbecb(tint_symbol_3, tint_symbol_4);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
+ textureSampleLevel_dcbecb(tint_symbol_7, tint_symbol_8);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
+ textureSampleLevel_dcbecb(tint_symbol_9, tint_symbol_10);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm
new file mode 100644
index 0000000..59538e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 51
+; 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_dcbecb "textureSampleLevel_dcbecb"
+ 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
+ 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 3D 0 0 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
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %29 = OpTypeSampledImage %11
+ %int = OpTypeInt 32 1
+ %v3int = OpTypeVector %int 3
+ %35 = OpConstantNull %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %38 = OpTypeFunction %v4float
+%textureSampleLevel_dcbecb = OpFunction %void None %15
+ %18 = OpLabel
+ %arg_2 = OpVariable %_ptr_Function_v3float Function %20
+ %arg_3 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_2 %20
+ OpStore %arg_3 %float_1
+ %27 = OpLoad %14 %arg_1
+ %28 = OpLoad %11 %arg_0
+ %30 = OpSampledImage %29 %28 %27
+ %31 = OpLoad %v3float %arg_2
+ %32 = OpLoad %float %arg_3
+ %26 = OpImageSampleExplicitLod %v4float %30 %31 Lod|ConstOffset %32 %35
+ OpStore %res %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureSampleLevel_dcbecb
+ 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
+ %46 = OpLabel
+ %47 = OpFunctionCall %void %textureSampleLevel_dcbecb
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %15
+ %49 = OpLabel
+ %50 = OpFunctionCall %void %textureSampleLevel_dcbecb
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl
new file mode 100644
index 0000000..d527e5e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureSampleLevel/dcbecb.wgsl.expected.wgsl
@@ -0,0 +1,25 @@
+@group(1) @binding(0) var arg_0 : texture_3d<f32>;
+
+@group(1) @binding(1) var arg_1 : sampler;
+
+fn textureSampleLevel_dcbecb() {
+ var arg_2 = vec3<f32>();
+ var arg_3 = 1.0;
+ var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2, arg_3, vec3<i32>());
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureSampleLevel_dcbecb();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureSampleLevel_dcbecb();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureSampleLevel_dcbecb();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl
new file mode 100644
index 0000000..9b41c0c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba32float, write>, coords: vec2<i32>, value: vec4<f32>)
+fn textureStore_05ce15() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_05ce15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_05ce15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_05ce15();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl
new file mode 100644
index 0000000..5437eda
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2D arg_0;
+void textureStore_05ce15() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_05ce15();
+ 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 image2D arg_0;
+void textureStore_05ce15() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_05ce15();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2D arg_0;
+void textureStore_05ce15() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_05ce15();
+}
+
+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/05ce15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.hlsl
new file mode 100644
index 0000000..c83a95c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureStore_05ce15() {
+ int2 arg_1 = (0).xx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_05ce15();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_05ce15();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_05ce15();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl
new file mode 100644
index 0000000..9eb8590
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_05ce15(texture2d<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureStore_05ce15(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_05ce15(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_05ce15(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm
new file mode 100644
index 0000000..8120c43
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_05ce15 "textureStore_05ce15"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_05ce15 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_05ce15
+ 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 %textureStore_05ce15
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_05ce15
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl
new file mode 100644
index 0000000..70fbb97
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/05ce15.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba32float, write>;
+
+fn textureStore_05ce15() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_05ce15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_05ce15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_05ce15();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl
new file mode 100644
index 0000000..3ec416e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_2d<rg32float, write>, coords: vec2<i32>, value: vec4<f32>)
+fn textureStore_064c7f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_064c7f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_064c7f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_064c7f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl
new file mode 100644
index 0000000..b7cf6cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2D arg_0;
+void textureStore_064c7f() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_064c7f();
+ 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 image2D arg_0;
+void textureStore_064c7f() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_064c7f();
+}
+
+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 image2D arg_0;
+void textureStore_064c7f() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_064c7f();
+}
+
+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/064c7f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.hlsl
new file mode 100644
index 0000000..8adf145
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureStore_064c7f() {
+ int2 arg_1 = (0).xx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_064c7f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_064c7f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_064c7f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl
new file mode 100644
index 0000000..00a4cf7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_064c7f(texture2d<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureStore_064c7f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_064c7f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_064c7f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm
new file mode 100644
index 0000000..d6d60c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; 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_064c7f "textureStore_064c7f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_064c7f = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_064c7f
+ 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 %textureStore_064c7f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_064c7f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl
new file mode 100644
index 0000000..c560892
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/064c7f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rg32float, write>;
+
+fn textureStore_064c7f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_064c7f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_064c7f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_064c7f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl
new file mode 100644
index 0000000..70d0025
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba16uint, write>, coords: vec3<i32>, value: vec4<u32>)
+fn textureStore_068641() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_068641();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_068641();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_068641();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl
new file mode 100644
index 0000000..f84a5f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_068641() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_068641();
+ 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 uimage3D arg_0;
+void textureStore_068641() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_068641();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_068641() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_068641();
+}
+
+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/068641.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.hlsl
new file mode 100644
index 0000000..092e801
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_068641() {
+ int3 arg_1 = (0).xxx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_068641();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_068641();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_068641();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl
new file mode 100644
index 0000000..a35ed83
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_068641(texture3d<uint, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureStore_068641(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_068641(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_068641(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm
new file mode 100644
index 0000000..b77d315
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_068641 "textureStore_068641"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_068641 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_068641
+ 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 %textureStore_068641
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_068641
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl
new file mode 100644
index 0000000..606252b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/068641.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba16uint, write>;
+
+fn textureStore_068641() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_068641();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_068641();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_068641();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl
new file mode 100644
index 0000000..0ba9d0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<r32float, write>;
+
+// fn textureStore(texture: texture_storage_2d<r32float, write>, coords: vec2<i32>, value: vec4<f32>)
+fn textureStore_0af6b5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0af6b5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_0af6b5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_0af6b5();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl
new file mode 100644
index 0000000..1ae6b6b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2D arg_0;
+void textureStore_0af6b5() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_0af6b5();
+ 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 image2D arg_0;
+void textureStore_0af6b5() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_0af6b5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2D arg_0;
+void textureStore_0af6b5() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_0af6b5();
+}
+
+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/0af6b5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.hlsl
new file mode 100644
index 0000000..a0e877b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureStore_0af6b5() {
+ int2 arg_1 = (0).xx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0af6b5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_0af6b5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0af6b5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl
new file mode 100644
index 0000000..cbf3101
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0af6b5(texture2d<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureStore_0af6b5(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0af6b5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0af6b5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm
new file mode 100644
index 0000000..2c11b9d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_0af6b5 "textureStore_0af6b5"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0af6b5 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_0af6b5
+ 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 %textureStore_0af6b5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_0af6b5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl
new file mode 100644
index 0000000..51ba164
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0af6b5.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<r32float, write>;
+
+fn textureStore_0af6b5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0af6b5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_0af6b5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_0af6b5();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl
new file mode 100644
index 0000000..65800b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba16uint, write>, coords: vec2<i32>, value: vec4<u32>)
+fn textureStore_0c3dff() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0c3dff();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_0c3dff();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_0c3dff();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl
new file mode 100644
index 0000000..216ba1a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_0c3dff() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_0c3dff();
+ 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 uimage2D arg_0;
+void textureStore_0c3dff() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_0c3dff();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_0c3dff() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_0c3dff();
+}
+
+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/0c3dff.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.hlsl
new file mode 100644
index 0000000..2c960ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_0c3dff() {
+ int2 arg_1 = (0).xx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_0c3dff();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_0c3dff();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_0c3dff();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl
new file mode 100644
index 0000000..7778f10
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_0c3dff(texture2d<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureStore_0c3dff(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_0c3dff(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_0c3dff(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm
new file mode 100644
index 0000000..a5e6876
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_0c3dff "textureStore_0c3dff"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_0c3dff = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_0c3dff
+ 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 %textureStore_0c3dff
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_0c3dff
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl
new file mode 100644
index 0000000..3ec0971
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/0c3dff.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba16uint, write>;
+
+fn textureStore_0c3dff() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_0c3dff();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_0c3dff();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_0c3dff();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl
new file mode 100644
index 0000000..7399cd7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_1d<r32uint, write>, coords: i32, value: vec4<u32>)
+fn textureStore_102722() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_102722();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_102722();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_102722();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl
new file mode 100644
index 0000000..79c3f3a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_102722() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_102722();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(r32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_102722() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_102722();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_102722() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_102722();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl
new file mode 100644
index 0000000..e256ac8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_102722() {
+ int arg_1 = 1;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_102722();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_102722();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_102722();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl
new file mode 100644
index 0000000..f197dcc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_102722(texture1d<uint, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureStore_102722(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_102722(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_102722(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm
new file mode 100644
index 0000000..0311196
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_102722 "textureStore_102722"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_102722 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_102722
+ 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 %textureStore_102722
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_102722
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl
new file mode 100644
index 0000000..6f998c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/102722.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<r32uint, write>;
+
+fn textureStore_102722() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_102722();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_102722();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_102722();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl
new file mode 100644
index 0000000..4be5f7f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba8unorm, write>, coords: vec3<i32>, value: vec4<f32>)
+fn textureStore_1bbd08() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1bbd08();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_1bbd08();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_1bbd08();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl
new file mode 100644
index 0000000..8bbedc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image3D arg_0;
+void textureStore_1bbd08() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_1bbd08();
+ 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 image3D arg_0;
+void textureStore_1bbd08() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_1bbd08();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image3D arg_0;
+void textureStore_1bbd08() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_1bbd08();
+}
+
+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/1bbd08.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.hlsl
new file mode 100644
index 0000000..9bbd9cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureStore_1bbd08() {
+ int3 arg_1 = (0).xxx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_1bbd08();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1bbd08();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_1bbd08();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl
new file mode 100644
index 0000000..a09fc63
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_1bbd08(texture3d<float, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureStore_1bbd08(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_1bbd08(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_1bbd08(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm
new file mode 100644
index 0000000..e5356af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_1bbd08 "textureStore_1bbd08"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_1bbd08 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_1bbd08
+ 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 %textureStore_1bbd08
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_1bbd08
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl
new file mode 100644
index 0000000..dc34b23
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1bbd08.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8unorm, write>;
+
+fn textureStore_1bbd08() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1bbd08();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_1bbd08();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_1bbd08();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl
new file mode 100644
index 0000000..7773d7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<i32>)
+fn textureStore_1c02e7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1c02e7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_1c02e7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_1c02e7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl
new file mode 100644
index 0000000..43e87d1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1c02e7() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_1c02e7();
+ 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_1c02e7() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_1c02e7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_1c02e7() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_1c02e7();
+}
+
+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/1c02e7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.hlsl
new file mode 100644
index 0000000..4fe7a79
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_1c02e7() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_1c02e7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_1c02e7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_1c02e7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl
new file mode 100644
index 0000000..a2ef827
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_1c02e7(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_1c02e7(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_1c02e7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_1c02e7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.spvasm
new file mode 100644
index 0000000..8497c20
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1c02e7.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_1c02e7 "textureStore_1c02e7"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_1c02e7 = 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_v4int Function %26
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %26
+ %30 = OpLoad %11 %arg_0
+ %32 = OpLoad %v2int %arg_1
+ %33 = OpCompositeExtract %int %32 0
+ %34 = OpCompositeExtract %int %32 1
+ %35 = OpLoad %int %arg_2
+ %36 = OpCompositeConstruct %v3int %33 %34 %35
+ %37 = OpLoad %v4int %arg_3
+ OpImageWrite %30 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_1c02e7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_1c02e7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_1c02e7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl
new file mode 100644
index 0000000..2c24651
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/1c02e7.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32sint, write>;
+
+fn textureStore_1c02e7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_1c02e7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_1c02e7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_1c02e7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl
new file mode 100644
index 0000000..09cc100
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<u32>)
+fn textureStore_22d955() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_22d955();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_22d955();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_22d955();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl
new file mode 100644
index 0000000..d8279c2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_22d955() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_22d955();
+ 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_22d955() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_22d955();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_22d955() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_22d955();
+}
+
+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/22d955.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.hlsl
new file mode 100644
index 0000000..ac28249
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_22d955() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_22d955();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_22d955();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_22d955();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl
new file mode 100644
index 0000000..be88306
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_22d955(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_22d955(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_22d955(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_22d955(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm
new file mode 100644
index 0000000..dff6bf1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; 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 %textureStore_22d955 "textureStore_22d955"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_22d955 = 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_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_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
+ %36 = OpLoad %int %arg_2
+ %37 = OpCompositeConstruct %v3int %34 %35 %36
+ %38 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %37 %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_22d955
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_22d955
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureStore_22d955
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl
new file mode 100644
index 0000000..ca3080a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/22d955.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8uint, write>;
+
+fn textureStore_22d955() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_22d955();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_22d955();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_22d955();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl
new file mode 100644
index 0000000..cc953f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba32uint, write>, coords: vec2<i32>, value: vec4<u32>)
+fn textureStore_26bf70() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_26bf70();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_26bf70();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_26bf70();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl
new file mode 100644
index 0000000..048b5b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_26bf70() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_26bf70();
+ 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 uimage2D arg_0;
+void textureStore_26bf70() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_26bf70();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_26bf70() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_26bf70();
+}
+
+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/26bf70.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.hlsl
new file mode 100644
index 0000000..57341d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_26bf70() {
+ int2 arg_1 = (0).xx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_26bf70();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_26bf70();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_26bf70();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl
new file mode 100644
index 0000000..73242ad
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_26bf70(texture2d<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureStore_26bf70(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_26bf70(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_26bf70(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm
new file mode 100644
index 0000000..188aded
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_26bf70 "textureStore_26bf70"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_26bf70 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_26bf70
+ 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 %textureStore_26bf70
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_26bf70
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl
new file mode 100644
index 0000000..f2ef696
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/26bf70.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba32uint, write>;
+
+fn textureStore_26bf70() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_26bf70();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_26bf70();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_26bf70();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl
new file mode 100644
index 0000000..43d4c05
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rg32sint, write>, coords: vec3<i32>, value: vec4<i32>)
+fn textureStore_2796b4() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2796b4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2796b4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2796b4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl
new file mode 100644
index 0000000..8b3dd99
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage3D arg_0;
+void textureStore_2796b4() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_2796b4();
+ 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 iimage3D arg_0;
+void textureStore_2796b4() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_2796b4();
+}
+
+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 iimage3D arg_0;
+void textureStore_2796b4() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_2796b4();
+}
+
+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/2796b4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.hlsl
new file mode 100644
index 0000000..63eefce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureStore_2796b4() {
+ int3 arg_1 = (0).xxx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2796b4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_2796b4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2796b4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl
new file mode 100644
index 0000000..c2ebcd9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_2796b4(texture3d<int, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureStore_2796b4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_2796b4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_2796b4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm
new file mode 100644
index 0000000..d79adda
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; 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_2796b4 "textureStore_2796b4"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_2796b4 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v3int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_2796b4
+ 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 %textureStore_2796b4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_2796b4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl
new file mode 100644
index 0000000..73dfab1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2796b4.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rg32sint, write>;
+
+fn textureStore_2796b4() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2796b4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2796b4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2796b4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl
new file mode 100644
index 0000000..bd92a3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<r32float, write>;
+
+// fn textureStore(texture: texture_storage_1d<r32float, write>, coords: i32, value: vec4<f32>)
+fn textureStore_2ac6c7() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2ac6c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2ac6c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2ac6c7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl
new file mode 100644
index 0000000..199d3fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(r32f) uniform highp writeonly image1D arg_0;
+void textureStore_2ac6c7() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_2ac6c7();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(r32f) uniform highp writeonly image1D arg_0;
+void textureStore_2ac6c7() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_2ac6c7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(r32f) uniform highp writeonly image1D arg_0;
+void textureStore_2ac6c7() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_2ac6c7();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl
new file mode 100644
index 0000000..299e980
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureStore_2ac6c7() {
+ int arg_1 = 1;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2ac6c7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_2ac6c7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2ac6c7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl
new file mode 100644
index 0000000..da12ebc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_2ac6c7(texture1d<float, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureStore_2ac6c7(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_2ac6c7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_2ac6c7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm
new file mode 100644
index 0000000..f15467a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_2ac6c7 "textureStore_2ac6c7"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_2ac6c7 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_2ac6c7
+ 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 %textureStore_2ac6c7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_2ac6c7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl
new file mode 100644
index 0000000..07686dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ac6c7.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<r32float, write>;
+
+fn textureStore_2ac6c7() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2ac6c7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2ac6c7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2ac6c7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl
new file mode 100644
index 0000000..6896dde
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba16uint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba16uint, write>, coords: i32, value: vec4<u32>)
+fn textureStore_2eb2a4() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2eb2a4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2eb2a4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2eb2a4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl
new file mode 100644
index 0000000..3d85eaf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_2eb2a4() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_2eb2a4();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba16ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_2eb2a4() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_2eb2a4();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_2eb2a4() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_2eb2a4();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl
new file mode 100644
index 0000000..36b1326
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_2eb2a4() {
+ int arg_1 = 1;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2eb2a4();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_2eb2a4();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2eb2a4();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl
new file mode 100644
index 0000000..07e1c2a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_2eb2a4(texture1d<uint, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureStore_2eb2a4(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_2eb2a4(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_2eb2a4(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm
new file mode 100644
index 0000000..c00ec81
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_2eb2a4 "textureStore_2eb2a4"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_2eb2a4 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_2eb2a4
+ 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 %textureStore_2eb2a4
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_2eb2a4
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl
new file mode 100644
index 0000000..fd73725
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2eb2a4.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba16uint, write>;
+
+fn textureStore_2eb2a4() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2eb2a4();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2eb2a4();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2eb2a4();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl
new file mode 100644
index 0000000..f1e001e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba8snorm, write>, coords: i32, value: vec4<f32>)
+fn textureStore_2ed2a3() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2ed2a3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2ed2a3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2ed2a3();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl
new file mode 100644
index 0000000..90689a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image1D arg_0;
+void textureStore_2ed2a3() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_2ed2a3();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8_snorm) uniform highp writeonly image1D arg_0;
+void textureStore_2ed2a3() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_2ed2a3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image1D arg_0;
+void textureStore_2ed2a3() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_2ed2a3();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl
new file mode 100644
index 0000000..5d63a7b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureStore_2ed2a3() {
+ int arg_1 = 1;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_2ed2a3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_2ed2a3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_2ed2a3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl
new file mode 100644
index 0000000..e3b850b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_2ed2a3(texture1d<float, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureStore_2ed2a3(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_2ed2a3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_2ed2a3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm
new file mode 100644
index 0000000..c692c2f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_2ed2a3 "textureStore_2ed2a3"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_2ed2a3 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_2ed2a3
+ 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 %textureStore_2ed2a3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_2ed2a3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl
new file mode 100644
index 0000000..db9ce1b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/2ed2a3.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8snorm, write>;
+
+fn textureStore_2ed2a3() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_2ed2a3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_2ed2a3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_2ed2a3();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl
new file mode 100644
index 0000000..7a0e83a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rg32sint, write>, coords: vec2<i32>, value: vec4<i32>)
+fn textureStore_31745b() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_31745b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_31745b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_31745b();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl
new file mode 100644
index 0000000..e5e4f60
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2D arg_0;
+void textureStore_31745b() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_31745b();
+ 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 iimage2D arg_0;
+void textureStore_31745b() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_31745b();
+}
+
+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 iimage2D arg_0;
+void textureStore_31745b() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_31745b();
+}
+
+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/31745b.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.hlsl
new file mode 100644
index 0000000..3386530
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureStore_31745b() {
+ int2 arg_1 = (0).xx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_31745b();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_31745b();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_31745b();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl
new file mode 100644
index 0000000..bde273a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_31745b(texture2d<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureStore_31745b(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_31745b(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_31745b(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm
new file mode 100644
index 0000000..016eb27
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; 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_31745b "textureStore_31745b"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_31745b = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_31745b
+ 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 %textureStore_31745b
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_31745b
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl
new file mode 100644
index 0000000..2cbbb06
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/31745b.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rg32sint, write>;
+
+fn textureStore_31745b() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_31745b();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_31745b();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_31745b();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl
new file mode 100644
index 0000000..769031f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<f32>)
+fn textureStore_32f368() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_32f368();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_32f368();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_32f368();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl
new file mode 100644
index 0000000..b86d5eb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_32f368() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_32f368();
+ 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_32f368() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_32f368();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2DArray arg_0;
+void textureStore_32f368() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_32f368();
+}
+
+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/32f368.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.hlsl
new file mode 100644
index 0000000..1c217b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_32f368() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_32f368();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_32f368();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_32f368();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl
new file mode 100644
index 0000000..3daf6cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_32f368(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_32f368(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_32f368(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_32f368(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm
new file mode 100644
index 0000000..a154105
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %textureStore_32f368 "textureStore_32f368"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_32f368 = 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_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %v4float %arg_3
+ OpImageWrite %28 %34 %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureStore_32f368
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureStore_32f368
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_32f368
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl
new file mode 100644
index 0000000..7cf40ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/32f368.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16float, write>;
+
+fn textureStore_32f368() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_32f368();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_32f368();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_32f368();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl
new file mode 100644
index 0000000..f317f4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba32float, write>, coords: vec3<i32>, value: vec4<f32>)
+fn textureStore_331aee() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_331aee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_331aee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_331aee();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl
new file mode 100644
index 0000000..6d0ade0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image3D arg_0;
+void textureStore_331aee() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_331aee();
+ 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 image3D arg_0;
+void textureStore_331aee() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_331aee();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image3D arg_0;
+void textureStore_331aee() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_331aee();
+}
+
+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/331aee.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.hlsl
new file mode 100644
index 0000000..1070c26
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureStore_331aee() {
+ int3 arg_1 = (0).xxx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_331aee();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_331aee();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_331aee();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl
new file mode 100644
index 0000000..94c0dee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_331aee(texture3d<float, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureStore_331aee(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_331aee(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_331aee(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm
new file mode 100644
index 0000000..df8cccf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_331aee "textureStore_331aee"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_331aee = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_331aee
+ 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 %textureStore_331aee
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_331aee
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl
new file mode 100644
index 0000000..af9f52b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/331aee.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba32float, write>;
+
+fn textureStore_331aee() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_331aee();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_331aee();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_331aee();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl
new file mode 100644
index 0000000..7309e18
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<u32>)
+fn textureStore_38e8d7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_38e8d7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_38e8d7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_38e8d7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl
new file mode 100644
index 0000000..7a6850e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_38e8d7() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_38e8d7();
+ 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_38e8d7() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_38e8d7();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_38e8d7() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_38e8d7();
+}
+
+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/38e8d7.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.hlsl
new file mode 100644
index 0000000..6e867ec
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_38e8d7() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_38e8d7();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_38e8d7();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_38e8d7();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl
new file mode 100644
index 0000000..c22bedb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_38e8d7(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_38e8d7(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_38e8d7(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_38e8d7(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm
new file mode 100644
index 0000000..623d520
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; 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 %textureStore_38e8d7 "textureStore_38e8d7"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_38e8d7 = 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_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_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
+ %36 = OpLoad %int %arg_2
+ %37 = OpCompositeConstruct %v3int %34 %35 %36
+ %38 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %37 %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_38e8d7
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_38e8d7
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureStore_38e8d7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl
new file mode 100644
index 0000000..650afb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/38e8d7.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32uint, write>;
+
+fn textureStore_38e8d7() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_38e8d7();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_38e8d7();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_38e8d7();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl
new file mode 100644
index 0000000..022d92b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<i32>)
+fn textureStore_3a52ac() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_3a52ac();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_3a52ac();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_3a52ac();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl
new file mode 100644
index 0000000..4ae9505
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_3a52ac() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_3a52ac();
+ 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_3a52ac() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_3a52ac();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_3a52ac() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_3a52ac();
+}
+
+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/3a52ac.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.hlsl
new file mode 100644
index 0000000..f682606
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_3a52ac() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_3a52ac();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_3a52ac();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_3a52ac();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl
new file mode 100644
index 0000000..e243637
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_3a52ac(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_3a52ac(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_3a52ac(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_3a52ac(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.spvasm
new file mode 100644
index 0000000..ef89e77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3a52ac.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_3a52ac "textureStore_3a52ac"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_3a52ac = 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_v4int Function %26
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %26
+ %30 = OpLoad %11 %arg_0
+ %32 = OpLoad %v2int %arg_1
+ %33 = OpCompositeExtract %int %32 0
+ %34 = OpCompositeExtract %int %32 1
+ %35 = OpLoad %int %arg_2
+ %36 = OpCompositeConstruct %v3int %33 %34 %35
+ %37 = OpLoad %v4int %arg_3
+ OpImageWrite %30 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_3a52ac
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_3a52ac
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_3a52ac
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl
new file mode 100644
index 0000000..ec27918
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3a52ac.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16sint, write>;
+
+fn textureStore_3a52ac() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_3a52ac();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_3a52ac();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_3a52ac();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl
new file mode 100644
index 0000000..959aa09
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<f32>)
+fn textureStore_3bb7a1() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_3bb7a1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_3bb7a1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_3bb7a1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl
new file mode 100644
index 0000000..a46b20b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_3bb7a1() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_3bb7a1();
+ 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_3bb7a1() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_3bb7a1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_3bb7a1() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_3bb7a1();
+}
+
+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/3bb7a1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.hlsl
new file mode 100644
index 0000000..e18ed4d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_3bb7a1() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_3bb7a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_3bb7a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_3bb7a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl
new file mode 100644
index 0000000..70c180e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_3bb7a1(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_3bb7a1(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_3bb7a1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_3bb7a1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..f7e7b38
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %textureStore_3bb7a1 "textureStore_3bb7a1"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_3bb7a1 = 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_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %v4float %arg_3
+ OpImageWrite %28 %34 %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureStore_3bb7a1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureStore_3bb7a1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_3bb7a1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..d79be5d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bb7a1.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<r32float, write>;
+
+fn textureStore_3bb7a1() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_3bb7a1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_3bb7a1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_3bb7a1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl
new file mode 100644
index 0000000..b271e2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba8uint, write>, coords: i32, value: vec4<u32>)
+fn textureStore_3bec15() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_3bec15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_3bec15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_3bec15();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl
new file mode 100644
index 0000000..99b7eef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_3bec15() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_3bec15();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_3bec15() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_3bec15();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_3bec15() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_3bec15();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl
new file mode 100644
index 0000000..7092f58
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_3bec15() {
+ int arg_1 = 1;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_3bec15();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_3bec15();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_3bec15();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl
new file mode 100644
index 0000000..75e47f1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_3bec15(texture1d<uint, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureStore_3bec15(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_3bec15(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_3bec15(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm
new file mode 100644
index 0000000..4688a0f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_3bec15 "textureStore_3bec15"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_3bec15 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_3bec15
+ 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 %textureStore_3bec15
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_3bec15
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl
new file mode 100644
index 0000000..63f1025
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/3bec15.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8uint, write>;
+
+fn textureStore_3bec15() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_3bec15();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_3bec15();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_3bec15();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl
new file mode 100644
index 0000000..73f8b3b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba32uint, write>, coords: vec3<i32>, value: vec4<u32>)
+fn textureStore_441ba8() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_441ba8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_441ba8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_441ba8();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl
new file mode 100644
index 0000000..ef4af51
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_441ba8() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_441ba8();
+ 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 uimage3D arg_0;
+void textureStore_441ba8() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_441ba8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_441ba8() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_441ba8();
+}
+
+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/441ba8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.hlsl
new file mode 100644
index 0000000..3af481a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_441ba8() {
+ int3 arg_1 = (0).xxx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_441ba8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_441ba8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_441ba8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl
new file mode 100644
index 0000000..1464ab7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_441ba8(texture3d<uint, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureStore_441ba8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_441ba8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_441ba8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm
new file mode 100644
index 0000000..b674880
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_441ba8 "textureStore_441ba8"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_441ba8 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_441ba8
+ 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 %textureStore_441ba8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_441ba8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl
new file mode 100644
index 0000000..77c1fef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/441ba8.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba32uint, write>;
+
+fn textureStore_441ba8() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_441ba8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_441ba8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_441ba8();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl
new file mode 100644
index 0000000..b1433f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<f32>)
+fn textureStore_4fc057() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_4fc057();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_4fc057();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_4fc057();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl
new file mode 100644
index 0000000..039e0bb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_4fc057() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_4fc057();
+ 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_4fc057() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_4fc057();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2DArray arg_0;
+void textureStore_4fc057() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_4fc057();
+}
+
+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/4fc057.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.hlsl
new file mode 100644
index 0000000..ee4b614
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_4fc057() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_4fc057();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_4fc057();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_4fc057();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl
new file mode 100644
index 0000000..c7d5dbb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_4fc057(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_4fc057(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_4fc057(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_4fc057(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm
new file mode 100644
index 0000000..710a585
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %textureStore_4fc057 "textureStore_4fc057"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_4fc057 = 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_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %v4float %arg_3
+ OpImageWrite %28 %34 %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureStore_4fc057
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureStore_4fc057
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_4fc057
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl
new file mode 100644
index 0000000..5721e03
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/4fc057.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8snorm, write>;
+
+fn textureStore_4fc057() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_4fc057();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_4fc057();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_4fc057();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl
new file mode 100644
index 0000000..90117ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba16sint, write>, coords: i32, value: vec4<i32>)
+fn textureStore_5a2f8f() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_5a2f8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_5a2f8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_5a2f8f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl
new file mode 100644
index 0000000..00c2178
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage1D arg_0;
+void textureStore_5a2f8f() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_5a2f8f();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba16i) uniform highp writeonly iimage1D arg_0;
+void textureStore_5a2f8f() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_5a2f8f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage1D arg_0;
+void textureStore_5a2f8f() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_5a2f8f();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl
new file mode 100644
index 0000000..f600277
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureStore_5a2f8f() {
+ int arg_1 = 1;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_5a2f8f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_5a2f8f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_5a2f8f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl
new file mode 100644
index 0000000..7ffe1a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_5a2f8f(texture1d<int, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureStore_5a2f8f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_5a2f8f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_5a2f8f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm
new file mode 100644
index 0000000..8fd6437
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_5a2f8f "textureStore_5a2f8f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 0 2 Rgba16i
+%_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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_5a2f8f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_5a2f8f
+ 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 %textureStore_5a2f8f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_5a2f8f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl
new file mode 100644
index 0000000..b2470f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/5a2f8f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba16sint, write>;
+
+fn textureStore_5a2f8f() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_5a2f8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_5a2f8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_5a2f8f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl
new file mode 100644
index 0000000..c4a94b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<f32>)
+fn textureStore_60975f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_60975f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_60975f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_60975f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl
new file mode 100644
index 0000000..0a167a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_60975f() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_60975f();
+ 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_60975f() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_60975f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2DArray arg_0;
+void textureStore_60975f() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_60975f();
+}
+
+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/60975f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.hlsl
new file mode 100644
index 0000000..15c91c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_60975f() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_60975f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_60975f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_60975f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl
new file mode 100644
index 0000000..e70fe51
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_60975f(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_60975f(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_60975f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_60975f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm
new file mode 100644
index 0000000..7807d15
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %textureStore_60975f "textureStore_60975f"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_60975f = 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_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %v4float %arg_3
+ OpImageWrite %28 %34 %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureStore_60975f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureStore_60975f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_60975f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl
new file mode 100644
index 0000000..78911cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/60975f.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8unorm, write>;
+
+fn textureStore_60975f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_60975f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_60975f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_60975f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl
new file mode 100644
index 0000000..5be4263
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rg32uint, write>, coords: vec2<i32>, value: vec4<u32>)
+fn textureStore_682fd6() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_682fd6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_682fd6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_682fd6();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl
new file mode 100644
index 0000000..02980de
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_682fd6() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_682fd6();
+ 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 uimage2D arg_0;
+void textureStore_682fd6() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_682fd6();
+}
+
+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 uimage2D arg_0;
+void textureStore_682fd6() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_682fd6();
+}
+
+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/682fd6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.hlsl
new file mode 100644
index 0000000..613ddb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_682fd6() {
+ int2 arg_1 = (0).xx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_682fd6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_682fd6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_682fd6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl
new file mode 100644
index 0000000..8ef52b0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_682fd6(texture2d<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureStore_682fd6(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_682fd6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_682fd6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm
new file mode 100644
index 0000000..e7ffff9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; 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_682fd6 "textureStore_682fd6"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_682fd6 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_682fd6
+ 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 %textureStore_682fd6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_682fd6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl
new file mode 100644
index 0000000..8539d14
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/682fd6.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rg32uint, write>;
+
+fn textureStore_682fd6() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_682fd6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_682fd6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_682fd6();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl
new file mode 100644
index 0000000..aac4b66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba32float, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba32float, write>, coords: i32, value: vec4<f32>)
+fn textureStore_6b75c3() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6b75c3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6b75c3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6b75c3();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl
new file mode 100644
index 0000000..851f0cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image1D arg_0;
+void textureStore_6b75c3() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_6b75c3();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba32f) uniform highp writeonly image1D arg_0;
+void textureStore_6b75c3() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_6b75c3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image1D arg_0;
+void textureStore_6b75c3() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_6b75c3();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl
new file mode 100644
index 0000000..d1842f9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureStore_6b75c3() {
+ int arg_1 = 1;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6b75c3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_6b75c3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6b75c3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl
new file mode 100644
index 0000000..525cdb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_6b75c3(texture1d<float, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureStore_6b75c3(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_6b75c3(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_6b75c3(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm
new file mode 100644
index 0000000..436599f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_6b75c3 "textureStore_6b75c3"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_6b75c3 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_6b75c3
+ 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 %textureStore_6b75c3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_6b75c3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl
new file mode 100644
index 0000000..8cc3cbd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b75c3.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba32float, write>;
+
+fn textureStore_6b75c3() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6b75c3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6b75c3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6b75c3();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl
new file mode 100644
index 0000000..6579162
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_1d<r32sint, write>, coords: i32, value: vec4<i32>)
+fn textureStore_6b80d2() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6b80d2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6b80d2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6b80d2();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl
new file mode 100644
index 0000000..2fd85dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_6b80d2() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_6b80d2();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(r32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_6b80d2() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_6b80d2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_6b80d2() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_6b80d2();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl
new file mode 100644
index 0000000..dc45c99
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureStore_6b80d2() {
+ int arg_1 = 1;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6b80d2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_6b80d2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6b80d2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl
new file mode 100644
index 0000000..4ec6f6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_6b80d2(texture1d<int, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureStore_6b80d2(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_6b80d2(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_6b80d2(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm
new file mode 100644
index 0000000..cc127a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_6b80d2 "textureStore_6b80d2"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 0 2 R32i
+%_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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_6b80d2 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_6b80d2
+ 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 %textureStore_6b80d2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_6b80d2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl
new file mode 100644
index 0000000..857f142
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6b80d2.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<r32sint, write>;
+
+fn textureStore_6b80d2() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6b80d2();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6b80d2();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6b80d2();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl
new file mode 100644
index 0000000..b675a27
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_2d<r32uint, write>, coords: vec2<i32>, value: vec4<u32>)
+fn textureStore_6cff2e() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6cff2e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6cff2e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6cff2e();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl
new file mode 100644
index 0000000..31dca28
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_6cff2e() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_6cff2e();
+ 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 uimage2D arg_0;
+void textureStore_6cff2e() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_6cff2e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_6cff2e() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_6cff2e();
+}
+
+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/6cff2e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.hlsl
new file mode 100644
index 0000000..030b9a1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_6cff2e() {
+ int2 arg_1 = (0).xx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6cff2e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_6cff2e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6cff2e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl
new file mode 100644
index 0000000..47ac09a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_6cff2e(texture2d<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureStore_6cff2e(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_6cff2e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_6cff2e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm
new file mode 100644
index 0000000..7907a00
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_6cff2e "textureStore_6cff2e"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_6cff2e = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_6cff2e
+ 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 %textureStore_6cff2e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_6cff2e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl
new file mode 100644
index 0000000..2278e2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6cff2e.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<r32uint, write>;
+
+fn textureStore_6cff2e() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6cff2e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6cff2e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6cff2e();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl
new file mode 100644
index 0000000..a2738e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<u32>)
+fn textureStore_6da692() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6da692();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6da692();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6da692();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl
new file mode 100644
index 0000000..c7bc567
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6da692() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_6da692();
+ 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_6da692() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_6da692();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_6da692() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_6da692();
+}
+
+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/6da692.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.hlsl
new file mode 100644
index 0000000..2188ce1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_6da692() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_6da692();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_6da692();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_6da692();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl
new file mode 100644
index 0000000..305d2bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_6da692(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_6da692(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_6da692(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_6da692(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm
new file mode 100644
index 0000000..4296871
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; 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 %textureStore_6da692 "textureStore_6da692"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_6da692 = 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_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_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
+ %36 = OpLoad %int %arg_2
+ %37 = OpCompositeConstruct %v3int %34 %35 %36
+ %38 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %37 %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_6da692
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_6da692
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureStore_6da692
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl
new file mode 100644
index 0000000..9c99fa7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/6da692.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba16uint, write>;
+
+fn textureStore_6da692() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_6da692();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_6da692();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_6da692();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl
new file mode 100644
index 0000000..513104f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba8unorm, write>, coords: vec2<i32>, value: vec4<f32>)
+fn textureStore_731349() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_731349();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_731349();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_731349();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl
new file mode 100644
index 0000000..2fc13d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2D arg_0;
+void textureStore_731349() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_731349();
+ 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 image2D arg_0;
+void textureStore_731349() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_731349();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image2D arg_0;
+void textureStore_731349() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_731349();
+}
+
+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/731349.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.hlsl
new file mode 100644
index 0000000..9647546
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureStore_731349() {
+ int2 arg_1 = (0).xx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_731349();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_731349();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_731349();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl
new file mode 100644
index 0000000..f7898d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_731349(texture2d<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureStore_731349(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_731349(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_731349(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm
new file mode 100644
index 0000000..0d4982f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_731349 "textureStore_731349"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_731349 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_731349
+ 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 %textureStore_731349
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_731349
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl
new file mode 100644
index 0000000..6e8011a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/731349.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8unorm, write>;
+
+fn textureStore_731349() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_731349();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_731349();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_731349();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl
new file mode 100644
index 0000000..7d568be
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba32sint, write>, coords: vec2<i32>, value: vec4<i32>)
+fn textureStore_752da6() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_752da6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_752da6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_752da6();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl
new file mode 100644
index 0000000..4c49f79
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2D arg_0;
+void textureStore_752da6() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_752da6();
+ 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 iimage2D arg_0;
+void textureStore_752da6() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_752da6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2D arg_0;
+void textureStore_752da6() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_752da6();
+}
+
+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/752da6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.hlsl
new file mode 100644
index 0000000..74afe66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureStore_752da6() {
+ int2 arg_1 = (0).xx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_752da6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_752da6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_752da6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl
new file mode 100644
index 0000000..14805dc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_752da6(texture2d<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureStore_752da6(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_752da6(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_752da6(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm
new file mode 100644
index 0000000..4b831a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_752da6 "textureStore_752da6"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_752da6 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_752da6
+ 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 %textureStore_752da6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_752da6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl
new file mode 100644
index 0000000..7a2a16b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/752da6.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba32sint, write>;
+
+fn textureStore_752da6() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_752da6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_752da6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_752da6();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl
new file mode 100644
index 0000000..b68362e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba8uint, write>, coords: vec2<i32>, value: vec4<u32>)
+fn textureStore_77c0ae() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_77c0ae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_77c0ae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_77c0ae();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl
new file mode 100644
index 0000000..ebdb907
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_77c0ae() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_77c0ae();
+ 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 uimage2D arg_0;
+void textureStore_77c0ae() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_77c0ae();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage2D arg_0;
+void textureStore_77c0ae() {
+ ivec2 arg_1 = ivec2(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_77c0ae();
+}
+
+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/77c0ae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.hlsl
new file mode 100644
index 0000000..04dafb0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_77c0ae() {
+ int2 arg_1 = (0).xx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_77c0ae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_77c0ae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_77c0ae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl
new file mode 100644
index 0000000..d7d8457
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_77c0ae(texture2d<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<uint, access::write> tint_symbol_2) {
+ textureStore_77c0ae(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_77c0ae(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_77c0ae(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm
new file mode 100644
index 0000000..6bacd0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_77c0ae "textureStore_77c0ae"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_77c0ae = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v2int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_77c0ae
+ 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 %textureStore_77c0ae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_77c0ae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl
new file mode 100644
index 0000000..6be0361
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/77c0ae.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8uint, write>;
+
+fn textureStore_77c0ae() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_77c0ae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_77c0ae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_77c0ae();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl
new file mode 100644
index 0000000..8dd0b94
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<i32>)
+fn textureStore_7cec8d() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7cec8d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_7cec8d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_7cec8d();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl
new file mode 100644
index 0000000..05b54d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7cec8d() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_7cec8d();
+ 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_7cec8d() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_7cec8d();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_7cec8d() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_7cec8d();
+}
+
+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/7cec8d.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.hlsl
new file mode 100644
index 0000000..d31432b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_7cec8d() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_7cec8d();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_7cec8d();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_7cec8d();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl
new file mode 100644
index 0000000..bc68202
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_7cec8d(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_7cec8d(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_7cec8d(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_7cec8d(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.spvasm
new file mode 100644
index 0000000..b36ee5f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7cec8d.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_7cec8d "textureStore_7cec8d"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_7cec8d = 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_v4int Function %26
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %26
+ %30 = OpLoad %11 %arg_0
+ %32 = OpLoad %v2int %arg_1
+ %33 = OpCompositeExtract %int %32 0
+ %34 = OpCompositeExtract %int %32 1
+ %35 = OpLoad %int %arg_2
+ %36 = OpCompositeConstruct %v3int %33 %34 %35
+ %37 = OpLoad %v4int %arg_3
+ OpImageWrite %30 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_7cec8d
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_7cec8d
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_7cec8d
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl
new file mode 100644
index 0000000..56e1988
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7cec8d.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32sint, write>;
+
+fn textureStore_7cec8d() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7cec8d();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_7cec8d();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_7cec8d();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl
new file mode 100644
index 0000000..e1ac747
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8unorm, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba8unorm, write>, coords: i32, value: vec4<f32>)
+fn textureStore_7f7fae() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7f7fae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_7f7fae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_7f7fae();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl
new file mode 100644
index 0000000..1658f25
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image1D arg_0;
+void textureStore_7f7fae() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_7f7fae();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8) uniform highp writeonly image1D arg_0;
+void textureStore_7f7fae() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_7f7fae();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8) uniform highp writeonly image1D arg_0;
+void textureStore_7f7fae() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_7f7fae();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl
new file mode 100644
index 0000000..6d80e54
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureStore_7f7fae() {
+ int arg_1 = 1;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_7f7fae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_7f7fae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_7f7fae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl
new file mode 100644
index 0000000..a991af1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_7f7fae(texture1d<float, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureStore_7f7fae(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_7f7fae(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_7f7fae(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm
new file mode 100644
index 0000000..aace840
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_7f7fae "textureStore_7f7fae"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_7f7fae = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_7f7fae
+ 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 %textureStore_7f7fae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_7f7fae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl
new file mode 100644
index 0000000..0c41e78
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/7f7fae.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8unorm, write>;
+
+fn textureStore_7f7fae() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_7f7fae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_7f7fae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_7f7fae();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl
new file mode 100644
index 0000000..47d4ac7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_2d<r32sint, write>, coords: vec2<i32>, value: vec4<i32>)
+fn textureStore_804942() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_804942();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_804942();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_804942();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl
new file mode 100644
index 0000000..e99ccc5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2D arg_0;
+void textureStore_804942() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_804942();
+ 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 iimage2D arg_0;
+void textureStore_804942() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_804942();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage2D arg_0;
+void textureStore_804942() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_804942();
+}
+
+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/804942.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.hlsl
new file mode 100644
index 0000000..f2f0dd3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureStore_804942() {
+ int2 arg_1 = (0).xx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_804942();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_804942();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_804942();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl
new file mode 100644
index 0000000..d2e755d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_804942(texture2d<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureStore_804942(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_804942(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_804942(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm
new file mode 100644
index 0000000..b6cc2c9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_804942 "textureStore_804942"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_804942 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_804942
+ 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 %textureStore_804942
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_804942
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl
new file mode 100644
index 0000000..12e178d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/804942.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<r32sint, write>;
+
+fn textureStore_804942() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_804942();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_804942();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_804942();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl
new file mode 100644
index 0000000..edab8e5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba8snorm, write>, coords: vec2<i32>, value: vec4<f32>)
+fn textureStore_805dae() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_805dae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_805dae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_805dae();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl
new file mode 100644
index 0000000..77e3041
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2D arg_0;
+void textureStore_805dae() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_805dae();
+ 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 image2D arg_0;
+void textureStore_805dae() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_805dae();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image2D arg_0;
+void textureStore_805dae() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_805dae();
+}
+
+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/805dae.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.hlsl
new file mode 100644
index 0000000..b251d9f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureStore_805dae() {
+ int2 arg_1 = (0).xx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_805dae();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_805dae();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_805dae();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl
new file mode 100644
index 0000000..8ba8e48
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_805dae(texture2d<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureStore_805dae(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_805dae(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_805dae(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm
new file mode 100644
index 0000000..0bcb46d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_805dae "textureStore_805dae"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_805dae = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_805dae
+ 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 %textureStore_805dae
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_805dae
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl
new file mode 100644
index 0000000..d2ce87cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/805dae.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8snorm, write>;
+
+fn textureStore_805dae() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_805dae();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_805dae();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_805dae();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl
new file mode 100644
index 0000000..d44459a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rg32uint, write>, coords: i32, value: vec4<u32>)
+fn textureStore_83bcc1() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_83bcc1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_83bcc1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_83bcc1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl
new file mode 100644
index 0000000..d44613f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_83bcc1() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_83bcc1();
+ 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 uimage1D arg_0;
+void textureStore_83bcc1() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_83bcc1();
+}
+
+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 uimage1D arg_0;
+void textureStore_83bcc1() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_83bcc1();
+}
+
+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/83bcc1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.hlsl
new file mode 100644
index 0000000..b606a3a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_83bcc1() {
+ int arg_1 = 1;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_83bcc1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_83bcc1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_83bcc1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl
new file mode 100644
index 0000000..bf59f21
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_83bcc1(texture1d<uint, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureStore_83bcc1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_83bcc1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_83bcc1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm
new file mode 100644
index 0000000..da8b6bf
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.spvasm
@@ -0,0 +1,86 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_83bcc1 "textureStore_83bcc1"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_83bcc1 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_83bcc1
+ 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 %textureStore_83bcc1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_83bcc1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl
new file mode 100644
index 0000000..ba0a1d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/83bcc1.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rg32uint, write>;
+
+fn textureStore_83bcc1() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_83bcc1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_83bcc1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_83bcc1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl
new file mode 100644
index 0000000..67d6535
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_1d<rg32float, write>, coords: i32, value: vec4<f32>)
+fn textureStore_872747() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_872747();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_872747();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_872747();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl
new file mode 100644
index 0000000..c07a4da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image1D arg_0;
+void textureStore_872747() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_872747();
+ 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 image1D arg_0;
+void textureStore_872747() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_872747();
+}
+
+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 image1D arg_0;
+void textureStore_872747() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_872747();
+}
+
+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/872747.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.hlsl
new file mode 100644
index 0000000..9c937a5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureStore_872747() {
+ int arg_1 = 1;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_872747();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_872747();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_872747();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl
new file mode 100644
index 0000000..fcb5caa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_872747(texture1d<float, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureStore_872747(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_872747(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_872747(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm
new file mode 100644
index 0000000..a197ec4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_872747 "textureStore_872747"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_872747 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_872747
+ 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 %textureStore_872747
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_872747
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl
new file mode 100644
index 0000000..a3090874
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/872747.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rg32float, write>;
+
+fn textureStore_872747() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_872747();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_872747();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_872747();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl
new file mode 100644
index 0000000..857a688
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<u32>)
+fn textureStore_8e0479() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8e0479();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_8e0479();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_8e0479();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl
new file mode 100644
index 0000000..0a78791
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8e0479() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_8e0479();
+ 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_8e0479() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_8e0479();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_8e0479() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_8e0479();
+}
+
+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/8e0479.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.hlsl
new file mode 100644
index 0000000..24d93ef
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_8e0479() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_8e0479();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_8e0479();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_8e0479();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl
new file mode 100644
index 0000000..6ad4aba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_8e0479(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_8e0479(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_8e0479(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_8e0479(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm
new file mode 100644
index 0000000..baca5da
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.spvasm
@@ -0,0 +1,95 @@
+; 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 %textureStore_8e0479 "textureStore_8e0479"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_8e0479 = 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_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_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
+ %36 = OpLoad %int %arg_2
+ %37 = OpCompositeConstruct %v3int %34 %35 %36
+ %38 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %37 %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_8e0479
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_8e0479
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureStore_8e0479
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl
new file mode 100644
index 0000000..7a726a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8e0479.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32uint, write>;
+
+fn textureStore_8e0479() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8e0479();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_8e0479();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_8e0479();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl
new file mode 100644
index 0000000..8d2c6b9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba16sint, write>, coords: vec3<i32>, value: vec4<i32>)
+fn textureStore_8f71a1() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8f71a1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_8f71a1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_8f71a1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl
new file mode 100644
index 0000000..ebb51a8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage3D arg_0;
+void textureStore_8f71a1() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_8f71a1();
+ 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 iimage3D arg_0;
+void textureStore_8f71a1() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_8f71a1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage3D arg_0;
+void textureStore_8f71a1() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_8f71a1();
+}
+
+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/8f71a1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.hlsl
new file mode 100644
index 0000000..513e377
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureStore_8f71a1() {
+ int3 arg_1 = (0).xxx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_8f71a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_8f71a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_8f71a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl
new file mode 100644
index 0000000..bf5a54e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_8f71a1(texture3d<int, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureStore_8f71a1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_8f71a1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_8f71a1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..1492698
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_8f71a1 "textureStore_8f71a1"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_8f71a1 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v3int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_8f71a1
+ 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 %textureStore_8f71a1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_8f71a1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..c031e90
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/8f71a1.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba16sint, write>;
+
+fn textureStore_8f71a1() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_8f71a1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_8f71a1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_8f71a1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl
new file mode 100644
index 0000000..a37d5b8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba32sint, write>, coords: i32, value: vec4<i32>)
+fn textureStore_969534() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_969534();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_969534();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_969534();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl
new file mode 100644
index 0000000..488d24e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_969534() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_969534();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_969534() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_969534();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_969534() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_969534();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl
new file mode 100644
index 0000000..abe1eac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureStore_969534() {
+ int arg_1 = 1;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_969534();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_969534();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_969534();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl
new file mode 100644
index 0000000..aed04dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_969534(texture1d<int, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureStore_969534(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_969534(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_969534(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm
new file mode 100644
index 0000000..74def9c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_969534 "textureStore_969534"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 0 2 Rgba32i
+%_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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_969534 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_969534
+ 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 %textureStore_969534
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_969534
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl
new file mode 100644
index 0000000..0b2dbba
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/969534.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba32sint, write>;
+
+fn textureStore_969534() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_969534();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_969534();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_969534();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl
new file mode 100644
index 0000000..57062ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba32sint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba32sint, write>, coords: vec3<i32>, value: vec4<i32>)
+fn textureStore_9a3ecc() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9a3ecc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_9a3ecc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_9a3ecc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl
new file mode 100644
index 0000000..9beb825
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage3D arg_0;
+void textureStore_9a3ecc() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_9a3ecc();
+ 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 iimage3D arg_0;
+void textureStore_9a3ecc() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_9a3ecc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32i) uniform highp writeonly iimage3D arg_0;
+void textureStore_9a3ecc() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_9a3ecc();
+}
+
+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/9a3ecc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.hlsl
new file mode 100644
index 0000000..f6dae1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureStore_9a3ecc() {
+ int3 arg_1 = (0).xxx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9a3ecc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_9a3ecc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9a3ecc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl
new file mode 100644
index 0000000..44b8e33
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9a3ecc(texture3d<int, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureStore_9a3ecc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9a3ecc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9a3ecc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm
new file mode 100644
index 0000000..7b6db7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_9a3ecc "textureStore_9a3ecc"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9a3ecc = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v3int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_9a3ecc
+ 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 %textureStore_9a3ecc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_9a3ecc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl
new file mode 100644
index 0000000..2c723c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9a3ecc.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba32sint, write>;
+
+fn textureStore_9a3ecc() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9a3ecc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_9a3ecc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_9a3ecc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl
new file mode 100644
index 0000000..6e7832e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<f32>)
+fn textureStore_9d9cd5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9d9cd5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_9d9cd5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_9d9cd5();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl
new file mode 100644
index 0000000..05a0d53
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d9cd5() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_9d9cd5();
+ 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_9d9cd5() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_9d9cd5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_9d9cd5() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_9d9cd5();
+}
+
+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/9d9cd5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.hlsl
new file mode 100644
index 0000000..63531a6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_9d9cd5() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9d9cd5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_9d9cd5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9d9cd5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl
new file mode 100644
index 0000000..48036cd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9d9cd5(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_9d9cd5(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_9d9cd5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9d9cd5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm
new file mode 100644
index 0000000..9e32370
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.spvasm
@@ -0,0 +1,92 @@
+; 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 %textureStore_9d9cd5 "textureStore_9d9cd5"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9d9cd5 = 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_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %v4float %arg_3
+ OpImageWrite %28 %34 %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureStore_9d9cd5
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureStore_9d9cd5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_9d9cd5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl
new file mode 100644
index 0000000..b2a600b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9d9cd5.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba32float, write>;
+
+fn textureStore_9d9cd5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9d9cd5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_9d9cd5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_9d9cd5();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl
new file mode 100644
index 0000000..7e1d29a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba16sint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba16sint, write>, coords: vec2<i32>, value: vec4<i32>)
+fn textureStore_9e3ec5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9e3ec5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_9e3ec5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_9e3ec5();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl
new file mode 100644
index 0000000..19ace0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2D arg_0;
+void textureStore_9e3ec5() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_9e3ec5();
+ 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 iimage2D arg_0;
+void textureStore_9e3ec5() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_9e3ec5();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16i) uniform highp writeonly iimage2D arg_0;
+void textureStore_9e3ec5() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_9e3ec5();
+}
+
+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/9e3ec5.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.hlsl
new file mode 100644
index 0000000..0c02acb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureStore_9e3ec5() {
+ int2 arg_1 = (0).xx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_9e3ec5();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_9e3ec5();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_9e3ec5();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl
new file mode 100644
index 0000000..942418d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_9e3ec5(texture2d<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureStore_9e3ec5(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_9e3ec5(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_9e3ec5(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm
new file mode 100644
index 0000000..4ce3d9e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_9e3ec5 "textureStore_9e3ec5"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_9e3ec5 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_9e3ec5
+ 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 %textureStore_9e3ec5
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_9e3ec5
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl
new file mode 100644
index 0000000..d024cb7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/9e3ec5.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba16sint, write>;
+
+fn textureStore_9e3ec5() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_9e3ec5();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_9e3ec5();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_9e3ec5();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl
new file mode 100644
index 0000000..0ecf958
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rg32uint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rg32uint, write>, coords: vec3<i32>, value: vec4<u32>)
+fn textureStore_ac67aa() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_ac67aa();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_ac67aa();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_ac67aa();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl
new file mode 100644
index 0000000..95a8c41
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_ac67aa() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_ac67aa();
+ 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 uimage3D arg_0;
+void textureStore_ac67aa() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_ac67aa();
+}
+
+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 uimage3D arg_0;
+void textureStore_ac67aa() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_ac67aa();
+}
+
+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/ac67aa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.hlsl
new file mode 100644
index 0000000..b36799d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_ac67aa() {
+ int3 arg_1 = (0).xxx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_ac67aa();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_ac67aa();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_ac67aa();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl
new file mode 100644
index 0000000..bff5a97
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_ac67aa(texture3d<uint, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureStore_ac67aa(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_ac67aa(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_ac67aa(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm
new file mode 100644
index 0000000..df550ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; 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_ac67aa "textureStore_ac67aa"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_ac67aa = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_ac67aa
+ 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 %textureStore_ac67aa
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_ac67aa
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl
new file mode 100644
index 0000000..9dd770c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ac67aa.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rg32uint, write>;
+
+fn textureStore_ac67aa() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_ac67aa();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_ac67aa();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_ac67aa();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl
new file mode 100644
index 0000000..200a831
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba8sint, write>, coords: vec3<i32>, value: vec4<i32>)
+fn textureStore_b706b1() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_b706b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_b706b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_b706b1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl
new file mode 100644
index 0000000..72e03e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage3D arg_0;
+void textureStore_b706b1() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_b706b1();
+ 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 iimage3D arg_0;
+void textureStore_b706b1() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_b706b1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage3D arg_0;
+void textureStore_b706b1() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_b706b1();
+}
+
+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/b706b1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.hlsl
new file mode 100644
index 0000000..4e96114
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureStore_b706b1() {
+ int3 arg_1 = (0).xxx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_b706b1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_b706b1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_b706b1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl
new file mode 100644
index 0000000..635cb6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_b706b1(texture3d<int, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureStore_b706b1(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_b706b1(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_b706b1(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm
new file mode 100644
index 0000000..32c2bcb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_b706b1 "textureStore_b706b1"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_b706b1 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v3int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_b706b1
+ 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 %textureStore_b706b1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_b706b1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl
new file mode 100644
index 0000000..4e5ab39
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/b706b1.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8sint, write>;
+
+fn textureStore_b706b1() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_b706b1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_b706b1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_b706b1();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl
new file mode 100644
index 0000000..58d83e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba8sint, write>, coords: vec2<i32>, value: vec4<i32>)
+fn textureStore_bbcb7f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_bbcb7f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_bbcb7f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_bbcb7f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl
new file mode 100644
index 0000000..2b486d8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2D arg_0;
+void textureStore_bbcb7f() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_bbcb7f();
+ 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 iimage2D arg_0;
+void textureStore_bbcb7f() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_bbcb7f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2D arg_0;
+void textureStore_bbcb7f() {
+ ivec2 arg_1 = ivec2(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_bbcb7f();
+}
+
+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/bbcb7f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.hlsl
new file mode 100644
index 0000000..366a2e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<int4> arg_0 : register(u0, space1);
+
+void textureStore_bbcb7f() {
+ int2 arg_1 = (0).xx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_bbcb7f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_bbcb7f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_bbcb7f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl
new file mode 100644
index 0000000..0a94285
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_bbcb7f(texture2d<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<int, access::write> tint_symbol_2) {
+ textureStore_bbcb7f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_bbcb7f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_bbcb7f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm
new file mode 100644
index 0000000..59e7b74
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_bbcb7f "textureStore_bbcb7f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_bbcb7f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v2int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_bbcb7f
+ 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 %textureStore_bbcb7f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_bbcb7f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl
new file mode 100644
index 0000000..87d0a02
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bbcb7f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba8sint, write>;
+
+fn textureStore_bbcb7f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_bbcb7f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_bbcb7f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_bbcb7f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl
new file mode 100644
index 0000000..e0293cc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_2d<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_2d<rgba16float, write>, coords: vec2<i32>, value: vec4<f32>)
+fn textureStore_be6e30() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_be6e30();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_be6e30();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_be6e30();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl
new file mode 100644
index 0000000..95fa82c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2D arg_0;
+void textureStore_be6e30() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_be6e30();
+ 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 image2D arg_0;
+void textureStore_be6e30() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_be6e30();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image2D arg_0;
+void textureStore_be6e30() {
+ ivec2 arg_1 = ivec2(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_be6e30();
+}
+
+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/be6e30.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.hlsl
new file mode 100644
index 0000000..67ff8b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture2D<float4> arg_0 : register(u0, space1);
+
+void textureStore_be6e30() {
+ int2 arg_1 = (0).xx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_be6e30();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_be6e30();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_be6e30();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl
new file mode 100644
index 0000000..ad189e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_be6e30(texture2d<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint2(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
+ textureStore_be6e30(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture2d<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<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_be6e30(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_be6e30(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm
new file mode 100644
index 0000000..57d0a8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_be6e30 "textureStore_be6e30"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 0 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
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_be6e30 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v2int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v2int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_be6e30
+ 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 %textureStore_be6e30
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_be6e30
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl
new file mode 100644
index 0000000..259fa2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/be6e30.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d<rgba16float, write>;
+
+fn textureStore_be6e30() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_be6e30();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_be6e30();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_be6e30();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl
new file mode 100644
index 0000000..f6147df
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba8sint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba8sint, write>, coords: i32, value: vec4<i32>)
+fn textureStore_bf775c() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_bf775c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_bf775c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_bf775c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl
new file mode 100644
index 0000000..276322e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage1D arg_0;
+void textureStore_bf775c() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_bf775c();
+ 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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba8i) uniform highp writeonly iimage1D arg_0;
+void textureStore_bf775c() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_bf775c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'iimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage1D arg_0;
+void textureStore_bf775c() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_bf775c();
+}
+
+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: 'iimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl
new file mode 100644
index 0000000..c75cb0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureStore_bf775c() {
+ int arg_1 = 1;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_bf775c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_bf775c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_bf775c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl
new file mode 100644
index 0000000..24079fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_bf775c(texture1d<int, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureStore_bf775c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_bf775c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_bf775c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm
new file mode 100644
index 0000000..c699fc0
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_bf775c "textureStore_bf775c"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 0 2 Rgba8i
+%_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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_bf775c = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_bf775c
+ 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 %textureStore_bf775c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_bf775c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl
new file mode 100644
index 0000000..cdf9966
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/bf775c.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba8sint, write>;
+
+fn textureStore_bf775c() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_bf775c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_bf775c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_bf775c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl
new file mode 100644
index 0000000..db992bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba16float, write>, coords: vec3<i32>, value: vec4<f32>)
+fn textureStore_c5af1e() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c5af1e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_c5af1e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_c5af1e();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl
new file mode 100644
index 0000000..d75b39b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image3D arg_0;
+void textureStore_c5af1e() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_c5af1e();
+ 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 image3D arg_0;
+void textureStore_c5af1e() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_c5af1e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image3D arg_0;
+void textureStore_c5af1e() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_c5af1e();
+}
+
+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/c5af1e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.hlsl
new file mode 100644
index 0000000..c52db8f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureStore_c5af1e() {
+ int3 arg_1 = (0).xxx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_c5af1e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c5af1e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_c5af1e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl
new file mode 100644
index 0000000..6e9206f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_c5af1e(texture3d<float, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureStore_c5af1e(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_c5af1e(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_c5af1e(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm
new file mode 100644
index 0000000..0a7e655
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_c5af1e "textureStore_c5af1e"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_c5af1e = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_c5af1e
+ 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 %textureStore_c5af1e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_c5af1e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl
new file mode 100644
index 0000000..1054a77
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c5af1e.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba16float, write>;
+
+fn textureStore_c5af1e() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c5af1e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_c5af1e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_c5af1e();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl
new file mode 100644
index 0000000..dead2ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<f32>)
+fn textureStore_c863be() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c863be();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_c863be();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_c863be();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl
new file mode 100644
index 0000000..964605e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image2DArray arg_0;
+void textureStore_c863be() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_c863be();
+ 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_c863be() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_c863be();
+}
+
+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_c863be() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ vec4 arg_3 = vec4(0.0f);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_c863be();
+}
+
+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/c863be.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.hlsl
new file mode 100644
index 0000000..bf1dd2c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<float4> arg_0 : register(u0, space1);
+
+void textureStore_c863be() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ float4 arg_3 = (0.0f).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_c863be();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_c863be();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_c863be();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl
new file mode 100644
index 0000000..3b4ee66
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_c863be(texture2d_array<float, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_c863be(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_c863be(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_c863be(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm
new file mode 100644
index 0000000..49ae3b6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.spvasm
@@ -0,0 +1,93 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 50
+; 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_c863be "textureStore_c863be"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %v3int = OpTypeVector %int 3
+ %36 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_c863be = 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_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %5
+ %28 = OpLoad %11 %arg_0
+ %30 = OpLoad %v2int %arg_1
+ %31 = OpCompositeExtract %int %30 0
+ %32 = OpCompositeExtract %int %30 1
+ %33 = OpLoad %int %arg_2
+ %34 = OpCompositeConstruct %v3int %31 %32 %33
+ %35 = OpLoad %v4float %arg_3
+ OpImageWrite %28 %34 %35
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %36
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %textureStore_c863be
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %41 = OpLabel
+ %42 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %42
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %12
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureStore_c863be
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_c863be
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl
new file mode 100644
index 0000000..a6ba2427
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/c863be.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32float, write>;
+
+fn textureStore_c863be() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_c863be();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_c863be();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_c863be();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl
new file mode 100644
index 0000000..1b25bc4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rg32sint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rg32sint, write>, coords: i32, value: vec4<i32>)
+fn textureStore_d73b5c() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_d73b5c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_d73b5c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_d73b5c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl
new file mode 100644
index 0000000..ca21e8d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage1D arg_0;
+void textureStore_d73b5c() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_d73b5c();
+ 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 iimage1D arg_0;
+void textureStore_d73b5c() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_d73b5c();
+}
+
+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 iimage1D arg_0;
+void textureStore_d73b5c() {
+ int arg_1 = 1;
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_d73b5c();
+}
+
+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/d73b5c.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.hlsl
new file mode 100644
index 0000000..e4f893a
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<int4> arg_0 : register(u0, space1);
+
+void textureStore_d73b5c() {
+ int arg_1 = 1;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_d73b5c();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_d73b5c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_d73b5c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl
new file mode 100644
index 0000000..0fe1471
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_d73b5c(texture1d<int, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<int, access::write> tint_symbol_2) {
+ textureStore_d73b5c(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_d73b5c(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_d73b5c(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm
new file mode 100644
index 0000000..b558399
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 43
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_d73b5c "textureStore_d73b5c"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 0 2 Rg32i
+%_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
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_d73b5c = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_d73b5c
+ 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 %textureStore_d73b5c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_d73b5c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl
new file mode 100644
index 0000000..6c5f4cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/d73b5c.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rg32sint, write>;
+
+fn textureStore_d73b5c() {
+ var arg_1 = 1;
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_d73b5c();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_d73b5c();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_d73b5c();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl
new file mode 100644
index 0000000..3c44ab4
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8snorm, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba8snorm, write>, coords: vec3<i32>, value: vec4<f32>)
+fn textureStore_dd7d81() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dd7d81();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_dd7d81();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_dd7d81();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl
new file mode 100644
index 0000000..2a86984
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image3D arg_0;
+void textureStore_dd7d81() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_dd7d81();
+ 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 image3D arg_0;
+void textureStore_dd7d81() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_dd7d81();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8_snorm) uniform highp writeonly image3D arg_0;
+void textureStore_dd7d81() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_dd7d81();
+}
+
+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/dd7d81.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.hlsl
new file mode 100644
index 0000000..303f614
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureStore_dd7d81() {
+ int3 arg_1 = (0).xxx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dd7d81();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_dd7d81();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dd7d81();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl
new file mode 100644
index 0000000..e87f2ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_dd7d81(texture3d<float, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureStore_dd7d81(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_dd7d81(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_dd7d81(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm
new file mode 100644
index 0000000..8e21c4c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_dd7d81 "textureStore_dd7d81"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_dd7d81 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_dd7d81
+ 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 %textureStore_dd7d81
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_dd7d81
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl
new file mode 100644
index 0000000..5aa55d7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dd7d81.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8snorm, write>;
+
+fn textureStore_dd7d81() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dd7d81();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_dd7d81();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_dd7d81();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl
new file mode 100644
index 0000000..13f1d59
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<u32>)
+fn textureStore_dde364() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dde364();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_dde364();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_dde364();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl
new file mode 100644
index 0000000..30fc138
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32ui) uniform highp writeonly uimage2DArray arg_0;
+void textureStore_dde364() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_dde364();
+ 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_dde364() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_dde364();
+}
+
+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_dde364() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ uvec4 arg_3 = uvec4(0u);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_dde364();
+}
+
+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/dde364.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.hlsl
new file mode 100644
index 0000000..8bda58b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<uint4> arg_0 : register(u0, space1);
+
+void textureStore_dde364() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ uint4 arg_3 = (0u).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_dde364();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_dde364();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_dde364();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl
new file mode 100644
index 0000000..8ac8d03
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_dde364(texture2d_array<uint, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_dde364(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_dde364(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_dde364(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm
new file mode 100644
index 0000000..39505fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.spvasm
@@ -0,0 +1,96 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 53
+; 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_dde364 "textureStore_dde364"
+ 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
+ %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
+ %v3int = OpTypeVector %int 3
+ %39 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_dde364 = 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_v4uint Function %27
+ OpStore %arg_1 %19
+ OpStore %arg_2 %int_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
+ %36 = OpLoad %int %arg_2
+ %37 = OpCompositeConstruct %v3int %34 %35 %36
+ %38 = OpLoad %v4uint %arg_3
+ OpImageWrite %31 %37 %38
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %39
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_dde364
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %44 = OpLabel
+ %45 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %45
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %48 = OpLabel
+ %49 = OpFunctionCall %void %textureStore_dde364
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %51 = OpLabel
+ %52 = OpFunctionCall %void %textureStore_dde364
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl
new file mode 100644
index 0000000..61c4140
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/dde364.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32uint, write>;
+
+fn textureStore_dde364() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_dde364();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_dde364();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_dde364();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl
new file mode 100644
index 0000000..dc7a9af
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba16float, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba16float, write>, coords: i32, value: vec4<f32>)
+fn textureStore_e885e8() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_e885e8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_e885e8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_e885e8();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl
new file mode 100644
index 0000000..ceee356
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image1D arg_0;
+void textureStore_e885e8() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_e885e8();
+ 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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba16f) uniform highp writeonly image1D arg_0;
+void textureStore_e885e8() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_e885e8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'image1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba16f) uniform highp writeonly image1D arg_0;
+void textureStore_e885e8() {
+ int arg_1 = 1;
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_e885e8();
+}
+
+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: 'image1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl
new file mode 100644
index 0000000..3a6acf9
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<float4> arg_0 : register(u0, space1);
+
+void textureStore_e885e8() {
+ int arg_1 = 1;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_e885e8();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_e885e8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_e885e8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl
new file mode 100644
index 0000000..67de77c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_e885e8(texture1d<float, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
+ textureStore_e885e8(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_e885e8(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_e885e8(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm
new file mode 100644
index 0000000..de6672d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 41
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_e885e8 "textureStore_e885e8"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %20 = OpConstantNull %int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_e885e8 = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %20
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_e885e8
+ 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 %textureStore_e885e8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_e885e8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl
new file mode 100644
index 0000000..27bd62e
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/e885e8.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba16float, write>;
+
+fn textureStore_e885e8() {
+ var arg_1 = 1;
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_e885e8();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_e885e8();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_e885e8();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl
new file mode 100644
index 0000000..bee1283
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<r32float, write>;
+
+// fn textureStore(texture: texture_storage_3d<r32float, write>, coords: vec3<i32>, value: vec4<f32>)
+fn textureStore_eb702f() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_eb702f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_eb702f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_eb702f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl
new file mode 100644
index 0000000..5dfa23d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(r32f) uniform highp writeonly image3D arg_0;
+void textureStore_eb702f() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_eb702f();
+ 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 image3D arg_0;
+void textureStore_eb702f() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_eb702f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32f) uniform highp writeonly image3D arg_0;
+void textureStore_eb702f() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_eb702f();
+}
+
+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/eb702f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.hlsl
new file mode 100644
index 0000000..55d4e79
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureStore_eb702f() {
+ int3 arg_1 = (0).xxx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_eb702f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_eb702f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_eb702f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl
new file mode 100644
index 0000000..9926e89
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_eb702f(texture3d<float, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureStore_eb702f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_eb702f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_eb702f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm
new file mode 100644
index 0000000..8d9bddb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.spvasm
@@ -0,0 +1,81 @@
+; 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_eb702f "textureStore_eb702f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_eb702f = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_eb702f
+ 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 %textureStore_eb702f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_eb702f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl
new file mode 100644
index 0000000..dcb0776
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb702f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<r32float, write>;
+
+fn textureStore_eb702f() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_eb702f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_eb702f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_eb702f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl
new file mode 100644
index 0000000..564a7b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<r32sint, write>;
+
+// fn textureStore(texture: texture_storage_3d<r32sint, write>, coords: vec3<i32>, value: vec4<i32>)
+fn textureStore_eb78b9() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_eb78b9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_eb78b9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_eb78b9();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl
new file mode 100644
index 0000000..7a6aa12
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage3D arg_0;
+void textureStore_eb78b9() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_eb78b9();
+ 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 iimage3D arg_0;
+void textureStore_eb78b9() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_eb78b9();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32i) uniform highp writeonly iimage3D arg_0;
+void textureStore_eb78b9() {
+ ivec3 arg_1 = ivec3(0);
+ ivec4 arg_2 = ivec4(0);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_eb78b9();
+}
+
+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/eb78b9.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.hlsl
new file mode 100644
index 0000000..c798708
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<int4> arg_0 : register(u0, space1);
+
+void textureStore_eb78b9() {
+ int3 arg_1 = (0).xxx;
+ int4 arg_2 = (0).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_eb78b9();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_eb78b9();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_eb78b9();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl
new file mode 100644
index 0000000..e5b872f
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_eb78b9(texture3d<int, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ int4 arg_2 = int4(0);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<int, access::write> tint_symbol_2) {
+ textureStore_eb78b9(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<int, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_eb78b9(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_eb78b9(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm
new file mode 100644
index 0000000..ca55182
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.spvasm
@@ -0,0 +1,83 @@
+; 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 %textureStore_eb78b9 "textureStore_eb78b9"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4int = OpTypeVector %int 4
+ %22 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %29 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_eb78b9 = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4int Function %22
+ OpStore %arg_1 %18
+ OpStore %arg_2 %22
+ %26 = OpLoad %11 %arg_0
+ %27 = OpLoad %v3int %arg_1
+ %28 = OpLoad %v4int %arg_2
+ OpImageWrite %26 %27 %28
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %29
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %textureStore_eb78b9
+ 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 %textureStore_eb78b9
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureStore_eb78b9
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl
new file mode 100644
index 0000000..a19c531
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/eb78b9.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<r32sint, write>;
+
+fn textureStore_eb78b9() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_eb78b9();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_eb78b9();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_eb78b9();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl
new file mode 100644
index 0000000..5dd4ca3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rg32float, write>;
+
+// fn textureStore(texture: texture_storage_3d<rg32float, write>, coords: vec3<i32>, value: vec4<f32>)
+fn textureStore_ee6acc() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_ee6acc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_ee6acc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_ee6acc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl
new file mode 100644
index 0000000..bce0c58
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.glsl
@@ -0,0 +1,81 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32f) uniform highp writeonly image3D arg_0;
+void textureStore_ee6acc() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_ee6acc();
+ 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 image3D arg_0;
+void textureStore_ee6acc() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_ee6acc();
+}
+
+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 image3D arg_0;
+void textureStore_ee6acc() {
+ ivec3 arg_1 = ivec3(0);
+ vec4 arg_2 = vec4(0.0f);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_ee6acc();
+}
+
+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/ee6acc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.hlsl
new file mode 100644
index 0000000..a6ce8c7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<float4> arg_0 : register(u0, space1);
+
+void textureStore_ee6acc() {
+ int3 arg_1 = (0).xxx;
+ float4 arg_2 = (0.0f).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_ee6acc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_ee6acc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_ee6acc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl
new file mode 100644
index 0000000..9b5c922
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_ee6acc(texture3d<float, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ float4 arg_2 = float4(0.0f);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
+ textureStore_ee6acc(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_ee6acc(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_ee6acc(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm
new file mode 100644
index 0000000..bc3df6d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.spvasm
@@ -0,0 +1,82 @@
+; 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_ee6acc "textureStore_ee6acc"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %18 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %27 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_ee6acc = OpFunction %void None %12
+ %15 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %18
+ %arg_2 = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_1 %18
+ OpStore %arg_2 %5
+ %24 = OpLoad %11 %arg_0
+ %25 = OpLoad %v3int %arg_1
+ %26 = OpLoad %v4float %arg_2
+ OpImageWrite %24 %25 %26
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %27
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %textureStore_ee6acc
+ 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 %textureStore_ee6acc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %12
+ %39 = OpLabel
+ %40 = OpFunctionCall %void %textureStore_ee6acc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl
new file mode 100644
index 0000000..aec0e26
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ee6acc.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rg32float, write>;
+
+fn textureStore_ee6acc() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<f32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_ee6acc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_ee6acc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_ee6acc();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl
new file mode 100644
index 0000000..988c3a7
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<r32uint, write>;
+
+// fn textureStore(texture: texture_storage_3d<r32uint, write>, coords: vec3<i32>, value: vec4<u32>)
+fn textureStore_ef9f2f() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_ef9f2f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_ef9f2f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_ef9f2f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl
new file mode 100644
index 0000000..040973d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_ef9f2f() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_ef9f2f();
+ 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 uimage3D arg_0;
+void textureStore_ef9f2f() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_ef9f2f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(r32ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_ef9f2f() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_ef9f2f();
+}
+
+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/ef9f2f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.hlsl
new file mode 100644
index 0000000..ded9f95
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_ef9f2f() {
+ int3 arg_1 = (0).xxx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_ef9f2f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_ef9f2f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_ef9f2f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl
new file mode 100644
index 0000000..9c6a6bd
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_ef9f2f(texture3d<uint, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureStore_ef9f2f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_ef9f2f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_ef9f2f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm
new file mode 100644
index 0000000..4148955
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_ef9f2f "textureStore_ef9f2f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_ef9f2f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_ef9f2f
+ 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 %textureStore_ef9f2f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_ef9f2f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl
new file mode 100644
index 0000000..596115c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/ef9f2f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<r32uint, write>;
+
+fn textureStore_ef9f2f() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_ef9f2f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_ef9f2f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_ef9f2f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl
new file mode 100644
index 0000000..afc1800
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_3d<rgba8uint, write>;
+
+// fn textureStore(texture: texture_storage_3d<rgba8uint, write>, coords: vec3<i32>, value: vec4<u32>)
+fn textureStore_f8dead() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_f8dead();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_f8dead();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_f8dead();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl
new file mode 100644
index 0000000..3583671
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.glsl
@@ -0,0 +1,58 @@
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_f8dead() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_f8dead();
+ 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 uimage3D arg_0;
+void textureStore_f8dead() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_f8dead();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8ui) uniform highp writeonly uimage3D arg_0;
+void textureStore_f8dead() {
+ ivec3 arg_1 = ivec3(0);
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_f8dead();
+}
+
+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/f8dead.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.hlsl
new file mode 100644
index 0000000..94111fb
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture3D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_f8dead() {
+ int3 arg_1 = (0).xxx;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_f8dead();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_f8dead();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_f8dead();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl
new file mode 100644
index 0000000..4e6da98
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_f8dead(texture3d<uint, access::write> tint_symbol_1) {
+ int3 arg_1 = int3(0);
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint3(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture3d<uint, access::write> tint_symbol_2) {
+ textureStore_f8dead(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture3d<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(texture3d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_f8dead(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture3d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_f8dead(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm
new file mode 100644
index 0000000..2a9e3e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.spvasm
@@ -0,0 +1,84 @@
+; 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 %textureStore_f8dead "textureStore_f8dead"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 3D 0 0 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
+ %19 = OpConstantNull %v3int
+%_ptr_Function_v3int = OpTypePointer Function %v3int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_f8dead = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_v3int Function %19
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %19
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %v3int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_f8dead
+ 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 %textureStore_f8dead
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_f8dead
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl
new file mode 100644
index 0000000..4ba27c6
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f8dead.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_3d<rgba8uint, write>;
+
+fn textureStore_f8dead() {
+ var arg_1 = vec3<i32>();
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_f8dead();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_f8dead();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_f8dead();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl
new file mode 100644
index 0000000..fe6e874
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<i32>)
+fn textureStore_f9be83() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_f9be83();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_f9be83();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_f9be83();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl
new file mode 100644
index 0000000..60b3e0b
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rg32i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_f9be83() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_f9be83();
+ 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_f9be83() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_f9be83();
+}
+
+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_f9be83() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_f9be83();
+}
+
+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/f9be83.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.hlsl
new file mode 100644
index 0000000..129bfb8
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_f9be83() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_f9be83();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_f9be83();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_f9be83();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl
new file mode 100644
index 0000000..0217d28
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_f9be83(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_f9be83(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_f9be83(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_f9be83(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.spvasm
new file mode 100644
index 0000000..c7ee036
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f9be83.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_f9be83 "textureStore_f9be83"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_f9be83 = 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_v4int Function %26
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %26
+ %30 = OpLoad %11 %arg_0
+ %32 = OpLoad %v2int %arg_1
+ %33 = OpCompositeExtract %int %32 0
+ %34 = OpCompositeExtract %int %32 1
+ %35 = OpLoad %int %arg_2
+ %36 = OpCompositeConstruct %v3int %33 %34 %35
+ %37 = OpLoad %v4int %arg_3
+ OpImageWrite %30 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_f9be83
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_f9be83
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_f9be83
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl
new file mode 100644
index 0000000..b5ade7c
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/f9be83.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rg32sint, write>;
+
+fn textureStore_f9be83() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_f9be83();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_f9be83();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_f9be83();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl
new file mode 100644
index 0000000..08f7947
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl
@@ -0,0 +1,48 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+@group(1) @binding(0) var arg_0: texture_storage_1d<rgba32uint, write>;
+
+// fn textureStore(texture: texture_storage_1d<rgba32uint, write>, coords: i32, value: vec4<u32>)
+fn textureStore_fb9a8f() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fb9a8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_fb9a8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_fb9a8f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl
new file mode 100644
index 0000000..9976dc1
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.glsl
@@ -0,0 +1,84 @@
+SKIP: FAILED
+
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_fb9a8f() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+vec4 vertex_main() {
+ textureStore_fb9a8f();
+ 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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+precision mediump float;
+
+layout(rgba32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_fb9a8f() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void fragment_main() {
+ textureStore_fb9a8f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+Error parsing GLSL shader:
+ERROR: 0:4: 'uimage1D' : Reserved word.
+WARNING: 0:4: 'layout' : useless application of layout qualifier
+ERROR: 0:4: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
+#version 310 es
+
+layout(rgba32ui) uniform highp writeonly uimage1D arg_0;
+void textureStore_fb9a8f() {
+ int arg_1 = 1;
+ uvec4 arg_2 = uvec4(0u);
+ imageStore(arg_0, arg_1, arg_2);
+}
+
+void compute_main() {
+ textureStore_fb9a8f();
+}
+
+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: 'uimage1D' : Reserved word.
+WARNING: 0:3: 'layout' : useless application of layout qualifier
+ERROR: 0:3: '' : compilation terminated
+ERROR: 2 compilation errors. No code generated.
+
+
+
diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl
new file mode 100644
index 0000000..7e5b23d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.hlsl
@@ -0,0 +1,34 @@
+RWTexture1D<uint4> arg_0 : register(u0, space1);
+
+void textureStore_fb9a8f() {
+ int arg_1 = 1;
+ uint4 arg_2 = (0u).xxxx;
+ arg_0[arg_1] = arg_2;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_fb9a8f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_fb9a8f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_fb9a8f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl
new file mode 100644
index 0000000..a808ba3
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.msl
@@ -0,0 +1,35 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_fb9a8f(texture1d<uint, access::write> tint_symbol_1) {
+ int arg_1 = 1;
+ uint4 arg_2 = uint4(0u);
+ tint_symbol_1.write(arg_2, uint(arg_1));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner(texture1d<uint, access::write> tint_symbol_2) {
+ textureStore_fb9a8f(tint_symbol_2);
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main(texture1d<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(texture1d<uint, access::write> tint_symbol_4 [[texture(0)]]) {
+ textureStore_fb9a8f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture1d<uint, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_fb9a8f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm
new file mode 100644
index 0000000..708e239
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.spvasm
@@ -0,0 +1,85 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 44
+; Schema: 0
+ OpCapability Shader
+ OpCapability Image1D
+ 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_fb9a8f "textureStore_fb9a8f"
+ OpName %arg_1 "arg_1"
+ OpName %arg_2 "arg_2"
+ 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 1D 0 0 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %21 = OpConstantNull %int
+ %v4uint = OpTypeVector %uint 4
+ %23 = OpConstantNull %v4uint
+%_ptr_Function_v4uint = OpTypePointer Function %v4uint
+ %30 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_fb9a8f = OpFunction %void None %13
+ %16 = OpLabel
+ %arg_1 = OpVariable %_ptr_Function_int Function %21
+ %arg_2 = OpVariable %_ptr_Function_v4uint Function %23
+ OpStore %arg_1 %int_1
+ OpStore %arg_2 %23
+ %27 = OpLoad %11 %arg_0
+ %28 = OpLoad %int %arg_1
+ %29 = OpLoad %v4uint %arg_2
+ OpImageWrite %27 %28 %29
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %30
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %textureStore_fb9a8f
+ 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 %textureStore_fb9a8f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureStore_fb9a8f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl
new file mode 100644
index 0000000..63241f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fb9a8f.wgsl.expected.wgsl
@@ -0,0 +1,23 @@
+@group(1) @binding(0) var arg_0 : texture_storage_1d<rgba32uint, write>;
+
+fn textureStore_fb9a8f() {
+ var arg_1 = 1;
+ var arg_2 = vec4<u32>();
+ textureStore(arg_0, arg_1, arg_2);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fb9a8f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_fb9a8f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_fb9a8f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl
new file mode 100644
index 0000000..388220d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl
@@ -0,0 +1,49 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// 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: i32, value: vec4<i32>)
+fn textureStore_fbf53f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fbf53f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_fbf53f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_fbf53f();
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl
new file mode 100644
index 0000000..c36d495
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.glsl
@@ -0,0 +1,61 @@
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_fbf53f() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+vec4 vertex_main() {
+ textureStore_fbf53f();
+ 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_fbf53f() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void fragment_main() {
+ textureStore_fbf53f();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+layout(rgba8i) uniform highp writeonly iimage2DArray arg_0;
+void textureStore_fbf53f() {
+ ivec2 arg_1 = ivec2(0);
+ int arg_2 = 1;
+ ivec4 arg_3 = ivec4(0);
+ imageStore(arg_0, ivec3(arg_1, arg_2), arg_3);
+}
+
+void compute_main() {
+ textureStore_fbf53f();
+}
+
+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/fbf53f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.hlsl
new file mode 100644
index 0000000..46a154d
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.hlsl
@@ -0,0 +1,35 @@
+RWTexture2DArray<int4> arg_0 : register(u0, space1);
+
+void textureStore_fbf53f() {
+ int2 arg_1 = (0).xx;
+ int arg_2 = 1;
+ int4 arg_3 = (0).xxxx;
+ arg_0[int3(arg_1, arg_2)] = arg_3;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ textureStore_fbf53f();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const 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_fbf53f();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureStore_fbf53f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl
new file mode 100644
index 0000000..7d00e81
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.msl
@@ -0,0 +1,36 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void textureStore_fbf53f(texture2d_array<int, access::write> tint_symbol_1) {
+ int2 arg_1 = int2(0);
+ 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_fbf53f(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_fbf53f(tint_symbol_4);
+ return;
+}
+
+kernel void compute_main(texture2d_array<int, access::write> tint_symbol_5 [[texture(0)]]) {
+ textureStore_fbf53f(tint_symbol_5);
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.spvasm
new file mode 100644
index 0000000..037b3ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fbf53f.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_fbf53f "textureStore_fbf53f"
+ 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
+ %int_1 = OpConstant %int 1
+%_ptr_Function_int = OpTypePointer Function %int
+ %24 = OpConstantNull %int
+ %v4int = OpTypeVector %int 4
+ %26 = OpConstantNull %v4int
+%_ptr_Function_v4int = OpTypePointer Function %v4int
+ %v3int = OpTypeVector %int 3
+ %38 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%textureStore_fbf53f = 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_v4int Function %26
+ OpStore %arg_1 %18
+ OpStore %arg_2 %int_1
+ OpStore %arg_3 %26
+ %30 = OpLoad %11 %arg_0
+ %32 = OpLoad %v2int %arg_1
+ %33 = OpCompositeExtract %int %32 0
+ %34 = OpCompositeExtract %int %32 1
+ %35 = OpLoad %int %arg_2
+ %36 = OpCompositeConstruct %v3int %33 %34 %35
+ %37 = OpLoad %v4int %arg_3
+ OpImageWrite %30 %36 %37
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %38
+ %40 = OpLabel
+ %41 = OpFunctionCall %void %textureStore_fbf53f
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %44
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %13
+ %47 = OpLabel
+ %48 = OpFunctionCall %void %textureStore_fbf53f
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %13
+ %50 = OpLabel
+ %51 = OpFunctionCall %void %textureStore_fbf53f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl
new file mode 100644
index 0000000..e1d54f5
--- /dev/null
+++ b/test/tint/builtins/gen/var/textureStore/fbf53f.wgsl.expected.wgsl
@@ -0,0 +1,24 @@
+@group(1) @binding(0) var arg_0 : texture_storage_2d_array<rgba8sint, write>;
+
+fn textureStore_fbf53f() {
+ var arg_1 = vec2<i32>();
+ var arg_2 = 1;
+ var arg_3 = vec4<i32>();
+ textureStore(arg_0, arg_1, arg_2, arg_3);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ textureStore_fbf53f();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ textureStore_fbf53f();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ textureStore_fbf53f();
+}
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl
new file mode 100644
index 0000000..4c3b60a
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<4, 3, f32>) -> mat<3, 4, f32>
+fn transpose_2585cd() {
+ var arg_0 = mat4x3<f32>();
+ var res: mat3x4<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_2585cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_2585cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_2585cd();
+}
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl
new file mode 100644
index 0000000..121bc40
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_2585cd() {
+ mat4x3 arg_0 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ mat3x4 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_2585cd();
+ 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;
+
+void transpose_2585cd() {
+ mat4x3 arg_0 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ mat3x4 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_2585cd();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_2585cd() {
+ mat4x3 arg_0 = mat4x3(vec3(0.0f), vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ mat3x4 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_2585cd();
+}
+
+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/transpose/2585cd.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.hlsl
new file mode 100644
index 0000000..1dad91c
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_2585cd() {
+ float4x3 arg_0 = float4x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+ float3x4 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_2585cd();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_2585cd();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_2585cd();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl
new file mode 100644
index 0000000..7e6823b
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_2585cd() {
+ float4x3 arg_0 = float4x3(float3(0.0f), float3(0.0f), float3(0.0f), float3(0.0f));
+ float3x4 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_2585cd();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_2585cd();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_2585cd();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm
new file mode 100644
index 0000000..b818932
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; 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 %transpose_2585cd "transpose_2585cd"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+%mat4v3float = OpTypeMatrix %v3float 4
+ %15 = OpConstantNull %mat4v3float
+%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float
+%mat3v4float = OpTypeMatrix %v4float 3
+%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float
+ %23 = OpConstantNull %mat3v4float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_2585cd = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat4v3float Function %15
+ %res = OpVariable %_ptr_Function_mat3v4float Function %23
+ OpStore %arg_0 %15
+ %20 = OpLoad %mat4v3float %arg_0
+ %18 = OpTranspose %mat3v4float %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %transpose_2585cd
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %transpose_2585cd
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %transpose_2585cd
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl
new file mode 100644
index 0000000..52f8c69
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/2585cd.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_2585cd() {
+ var arg_0 = mat4x3<f32>();
+ var res : mat3x4<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_2585cd();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_2585cd();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_2585cd();
+}
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl
new file mode 100644
index 0000000..c94a0ac
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<2, 2, f32>) -> mat<2, 2, f32>
+fn transpose_31d679() {
+ var arg_0 = mat2x2<f32>();
+ var res: mat2x2<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_31d679();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_31d679();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_31d679();
+}
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl
new file mode 100644
index 0000000..2a5e13cb
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_31d679() {
+ mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f));
+ mat2 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_31d679();
+ 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;
+
+void transpose_31d679() {
+ mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f));
+ mat2 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_31d679();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_31d679() {
+ mat2 arg_0 = mat2(vec2(0.0f), vec2(0.0f));
+ mat2 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_31d679();
+}
+
+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/transpose/31d679.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.hlsl
new file mode 100644
index 0000000..c777bd0
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_31d679() {
+ float2x2 arg_0 = float2x2((0.0f).xx, (0.0f).xx);
+ float2x2 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_31d679();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_31d679();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_31d679();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl
new file mode 100644
index 0000000..0602092
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_31d679() {
+ float2x2 arg_0 = float2x2(float2(0.0f), float2(0.0f));
+ float2x2 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_31d679();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_31d679();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_31d679();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm
new file mode 100644
index 0000000..10ee30e
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %transpose_31d679 "transpose_31d679"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+%mat2v2float = OpTypeMatrix %v2float 2
+ %15 = OpConstantNull %mat2v2float
+%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_31d679 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat2v2float Function %15
+ %res = OpVariable %_ptr_Function_mat2v2float Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %mat2v2float %arg_0
+ %18 = OpTranspose %mat2v2float %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %transpose_31d679
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %transpose_31d679
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %transpose_31d679
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl
new file mode 100644
index 0000000..f40121a
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31d679.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_31d679() {
+ var arg_0 = mat2x2<f32>();
+ var res : mat2x2<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_31d679();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_31d679();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_31d679();
+}
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl
new file mode 100644
index 0000000..a7b48bf
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<4, 2, f32>) -> mat<2, 4, f32>
+fn transpose_31e37e() {
+ var arg_0 = mat4x2<f32>();
+ var res: mat2x4<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_31e37e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_31e37e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_31e37e();
+}
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl
new file mode 100644
index 0000000..46f50d5
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_31e37e() {
+ mat4x2 arg_0 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
+ mat2x4 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_31e37e();
+ 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;
+
+void transpose_31e37e() {
+ mat4x2 arg_0 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
+ mat2x4 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_31e37e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_31e37e() {
+ mat4x2 arg_0 = mat4x2(vec2(0.0f), vec2(0.0f), vec2(0.0f), vec2(0.0f));
+ mat2x4 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_31e37e();
+}
+
+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/transpose/31e37e.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.hlsl
new file mode 100644
index 0000000..c3edf30
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_31e37e() {
+ float4x2 arg_0 = float4x2((0.0f).xx, (0.0f).xx, (0.0f).xx, (0.0f).xx);
+ float2x4 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_31e37e();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_31e37e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_31e37e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl
new file mode 100644
index 0000000..16ec8c1
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_31e37e() {
+ float4x2 arg_0 = float4x2(float2(0.0f), float2(0.0f), float2(0.0f), float2(0.0f));
+ float2x4 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_31e37e();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_31e37e();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_31e37e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm
new file mode 100644
index 0000000..d7a07e4
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; 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 %transpose_31e37e "transpose_31e37e"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+%mat4v2float = OpTypeMatrix %v2float 4
+ %15 = OpConstantNull %mat4v2float
+%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
+%mat2v4float = OpTypeMatrix %v4float 2
+%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
+ %23 = OpConstantNull %mat2v4float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_31e37e = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat4v2float Function %15
+ %res = OpVariable %_ptr_Function_mat2v4float Function %23
+ OpStore %arg_0 %15
+ %20 = OpLoad %mat4v2float %arg_0
+ %18 = OpTranspose %mat2v4float %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %transpose_31e37e
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %transpose_31e37e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %transpose_31e37e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl
new file mode 100644
index 0000000..4215819
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/31e37e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_31e37e() {
+ var arg_0 = mat4x2<f32>();
+ var res : mat2x4<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_31e37e();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_31e37e();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_31e37e();
+}
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl
new file mode 100644
index 0000000..a4d84b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<2, 4, f32>) -> mat<4, 2, f32>
+fn transpose_4ce359() {
+ var arg_0 = mat2x4<f32>();
+ var res: mat4x2<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_4ce359();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_4ce359();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_4ce359();
+}
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl
new file mode 100644
index 0000000..e8afc4a
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_4ce359() {
+ mat2x4 arg_0 = mat2x4(vec4(0.0f), vec4(0.0f));
+ mat4x2 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_4ce359();
+ 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;
+
+void transpose_4ce359() {
+ mat2x4 arg_0 = mat2x4(vec4(0.0f), vec4(0.0f));
+ mat4x2 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_4ce359();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_4ce359() {
+ mat2x4 arg_0 = mat2x4(vec4(0.0f), vec4(0.0f));
+ mat4x2 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_4ce359();
+}
+
+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/transpose/4ce359.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.hlsl
new file mode 100644
index 0000000..6c67d92
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_4ce359() {
+ float2x4 arg_0 = float2x4((0.0f).xxxx, (0.0f).xxxx);
+ float4x2 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_4ce359();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_4ce359();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_4ce359();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl
new file mode 100644
index 0000000..9ee08d4
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_4ce359() {
+ float2x4 arg_0 = float2x4(float4(0.0f), float4(0.0f));
+ float4x2 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_4ce359();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_4ce359();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_4ce359();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm
new file mode 100644
index 0000000..17e7eb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; 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 %transpose_4ce359 "transpose_4ce359"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%mat2v4float = OpTypeMatrix %v4float 2
+ %14 = OpConstantNull %mat2v4float
+%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
+ %v2float = OpTypeVector %float 2
+%mat4v2float = OpTypeMatrix %v2float 4
+%_ptr_Function_mat4v2float = OpTypePointer Function %mat4v2float
+ %23 = OpConstantNull %mat4v2float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_4ce359 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat2v4float Function %14
+ %res = OpVariable %_ptr_Function_mat4v2float Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %mat2v4float %arg_0
+ %17 = OpTranspose %mat4v2float %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %transpose_4ce359
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %transpose_4ce359
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %transpose_4ce359
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl
new file mode 100644
index 0000000..bf52185
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4ce359.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_4ce359() {
+ var arg_0 = mat2x4<f32>();
+ var res : mat4x2<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_4ce359();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_4ce359();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_4ce359();
+}
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl
new file mode 100644
index 0000000..bd7be8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<2, 3, f32>) -> mat<3, 2, f32>
+fn transpose_4dc9a1() {
+ var arg_0 = mat2x3<f32>();
+ var res: mat3x2<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_4dc9a1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_4dc9a1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_4dc9a1();
+}
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl
new file mode 100644
index 0000000..1e05e4c
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_4dc9a1() {
+ mat2x3 arg_0 = mat2x3(vec3(0.0f), vec3(0.0f));
+ mat3x2 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_4dc9a1();
+ 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;
+
+void transpose_4dc9a1() {
+ mat2x3 arg_0 = mat2x3(vec3(0.0f), vec3(0.0f));
+ mat3x2 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_4dc9a1();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_4dc9a1() {
+ mat2x3 arg_0 = mat2x3(vec3(0.0f), vec3(0.0f));
+ mat3x2 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_4dc9a1();
+}
+
+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/transpose/4dc9a1.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.hlsl
new file mode 100644
index 0000000..129d6ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_4dc9a1() {
+ float2x3 arg_0 = float2x3((0.0f).xxx, (0.0f).xxx);
+ float3x2 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_4dc9a1();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_4dc9a1();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_4dc9a1();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl
new file mode 100644
index 0000000..b2e422f
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_4dc9a1() {
+ float2x3 arg_0 = float2x3(float3(0.0f), float3(0.0f));
+ float3x2 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_4dc9a1();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_4dc9a1();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_4dc9a1();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.spvasm
new file mode 100644
index 0000000..6ec4169
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.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 %transpose_4dc9a1 "transpose_4dc9a1"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+%mat2v3float = OpTypeMatrix %v3float 2
+ %15 = OpConstantNull %mat2v3float
+%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %24 = OpConstantNull %mat3v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_4dc9a1 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat2v3float Function %15
+ %res = OpVariable %_ptr_Function_mat3v2float Function %24
+ OpStore %arg_0 %15
+ %21 = OpLoad %mat2v3float %arg_0
+ %18 = OpTranspose %mat3v2float %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %transpose_4dc9a1
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %transpose_4dc9a1
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %transpose_4dc9a1
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl
new file mode 100644
index 0000000..817b4f2
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/4dc9a1.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_4dc9a1() {
+ var arg_0 = mat2x3<f32>();
+ var res : mat3x2<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_4dc9a1();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_4dc9a1();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_4dc9a1();
+}
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl b/test/tint/builtins/gen/var/transpose/854336.wgsl
new file mode 100644
index 0000000..3158b4f
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<3, 3, f32>) -> mat<3, 3, f32>
+fn transpose_854336() {
+ var arg_0 = mat3x3<f32>();
+ var res: mat3x3<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_854336();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_854336();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_854336();
+}
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl
new file mode 100644
index 0000000..c4d23d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_854336() {
+ mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ mat3 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_854336();
+ 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;
+
+void transpose_854336() {
+ mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ mat3 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_854336();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_854336() {
+ mat3 arg_0 = mat3(vec3(0.0f), vec3(0.0f), vec3(0.0f));
+ mat3 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_854336();
+}
+
+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/transpose/854336.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.hlsl
new file mode 100644
index 0000000..a4fa125
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_854336() {
+ float3x3 arg_0 = float3x3((0.0f).xxx, (0.0f).xxx, (0.0f).xxx);
+ float3x3 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_854336();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_854336();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_854336();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl
new file mode 100644
index 0000000..0548fab
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_854336() {
+ float3x3 arg_0 = float3x3(float3(0.0f), float3(0.0f), float3(0.0f));
+ float3x3 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_854336();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_854336();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_854336();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm
new file mode 100644
index 0000000..9c37bf3
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; 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 %transpose_854336 "transpose_854336"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+%mat3v3float = OpTypeMatrix %v3float 3
+ %15 = OpConstantNull %mat3v3float
+%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_854336 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat3v3float Function %15
+ %res = OpVariable %_ptr_Function_mat3v3float Function %15
+ OpStore %arg_0 %15
+ %19 = OpLoad %mat3v3float %arg_0
+ %18 = OpTranspose %mat3v3float %19
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %transpose_854336
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %transpose_854336
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %transpose_854336
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl
new file mode 100644
index 0000000..4321df3
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/854336.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_854336() {
+ var arg_0 = mat3x3<f32>();
+ var res : mat3x3<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_854336();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_854336();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_854336();
+}
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl
new file mode 100644
index 0000000..64a03ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<4, 4, f32>) -> mat<4, 4, f32>
+fn transpose_c1b600() {
+ var arg_0 = mat4x4<f32>();
+ var res: mat4x4<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_c1b600();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_c1b600();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_c1b600();
+}
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl
new file mode 100644
index 0000000..d828cab
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_c1b600() {
+ mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ mat4 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_c1b600();
+ 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;
+
+void transpose_c1b600() {
+ mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ mat4 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_c1b600();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_c1b600() {
+ mat4 arg_0 = mat4(vec4(0.0f), vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ mat4 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_c1b600();
+}
+
+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/transpose/c1b600.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.hlsl
new file mode 100644
index 0000000..eb1524a
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_c1b600() {
+ float4x4 arg_0 = float4x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+ float4x4 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_c1b600();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_c1b600();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_c1b600();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl
new file mode 100644
index 0000000..6125d3f
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_c1b600() {
+ float4x4 arg_0 = float4x4(float4(0.0f), float4(0.0f), float4(0.0f), float4(0.0f));
+ float4x4 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_c1b600();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_c1b600();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_c1b600();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm
new file mode 100644
index 0000000..375945a
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.spvasm
@@ -0,0 +1,70 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 34
+; 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 %transpose_c1b600 "transpose_c1b600"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%mat4v4float = OpTypeMatrix %v4float 4
+ %14 = OpConstantNull %mat4v4float
+%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
+ %20 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_c1b600 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat4v4float Function %14
+ %res = OpVariable %_ptr_Function_mat4v4float Function %14
+ OpStore %arg_0 %14
+ %18 = OpLoad %mat4v4float %arg_0
+ %17 = OpTranspose %mat4v4float %18
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %transpose_c1b600
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %transpose_c1b600
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %transpose_c1b600
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl
new file mode 100644
index 0000000..bca9621
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/c1b600.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_c1b600() {
+ var arg_0 = mat4x4<f32>();
+ var res : mat4x4<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_c1b600();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_c1b600();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_c1b600();
+}
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl
new file mode 100644
index 0000000..6abd82f
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<3, 4, f32>) -> mat<4, 3, f32>
+fn transpose_d8f8ba() {
+ var arg_0 = mat3x4<f32>();
+ var res: mat4x3<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_d8f8ba();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_d8f8ba();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_d8f8ba();
+}
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl
new file mode 100644
index 0000000..61d6d2b
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_d8f8ba() {
+ mat3x4 arg_0 = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ mat4x3 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_d8f8ba();
+ 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;
+
+void transpose_d8f8ba() {
+ mat3x4 arg_0 = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ mat4x3 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_d8f8ba();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_d8f8ba() {
+ mat3x4 arg_0 = mat3x4(vec4(0.0f), vec4(0.0f), vec4(0.0f));
+ mat4x3 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_d8f8ba();
+}
+
+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/transpose/d8f8ba.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.hlsl
new file mode 100644
index 0000000..2a984c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_d8f8ba() {
+ float3x4 arg_0 = float3x4((0.0f).xxxx, (0.0f).xxxx, (0.0f).xxxx);
+ float4x3 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_d8f8ba();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_d8f8ba();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_d8f8ba();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl
new file mode 100644
index 0000000..5e674fd
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_d8f8ba() {
+ float3x4 arg_0 = float3x4(float4(0.0f), float4(0.0f), float4(0.0f));
+ float4x3 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_d8f8ba();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_d8f8ba();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_d8f8ba();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm
new file mode 100644
index 0000000..946dd8c
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.spvasm
@@ -0,0 +1,74 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 38
+; 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 %transpose_d8f8ba "transpose_d8f8ba"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%mat3v4float = OpTypeMatrix %v4float 3
+ %14 = OpConstantNull %mat3v4float
+%_ptr_Function_mat3v4float = OpTypePointer Function %mat3v4float
+ %v3float = OpTypeVector %float 3
+%mat4v3float = OpTypeMatrix %v3float 4
+%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float
+ %23 = OpConstantNull %mat4v3float
+ %24 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_d8f8ba = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat3v4float Function %14
+ %res = OpVariable %_ptr_Function_mat4v3float Function %23
+ OpStore %arg_0 %14
+ %20 = OpLoad %mat3v4float %arg_0
+ %17 = OpTranspose %mat4v3float %20
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %transpose_d8f8ba
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %transpose_d8f8ba
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %transpose_d8f8ba
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl
new file mode 100644
index 0000000..14f91f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/d8f8ba.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_d8f8ba() {
+ var arg_0 = mat3x4<f32>();
+ var res : mat4x3<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_d8f8ba();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_d8f8ba();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_d8f8ba();
+}
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl
new file mode 100644
index 0000000..ed30d84
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn transpose(mat<3, 2, f32>) -> mat<2, 3, f32>
+fn transpose_ed4bdc() {
+ var arg_0 = mat3x2<f32>();
+ var res: mat2x3<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_ed4bdc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_ed4bdc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_ed4bdc();
+}
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl
new file mode 100644
index 0000000..37e1788
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void transpose_ed4bdc() {
+ mat3x2 arg_0 = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
+ mat2x3 res = transpose(arg_0);
+}
+
+vec4 vertex_main() {
+ transpose_ed4bdc();
+ 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;
+
+void transpose_ed4bdc() {
+ mat3x2 arg_0 = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
+ mat2x3 res = transpose(arg_0);
+}
+
+void fragment_main() {
+ transpose_ed4bdc();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void transpose_ed4bdc() {
+ mat3x2 arg_0 = mat3x2(vec2(0.0f), vec2(0.0f), vec2(0.0f));
+ mat2x3 res = transpose(arg_0);
+}
+
+void compute_main() {
+ transpose_ed4bdc();
+}
+
+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/transpose/ed4bdc.wgsl.expected.hlsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.hlsl
new file mode 100644
index 0000000..d3b6576
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void transpose_ed4bdc() {
+ float3x2 arg_0 = float3x2((0.0f).xx, (0.0f).xx, (0.0f).xx);
+ float2x3 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ transpose_ed4bdc();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ transpose_ed4bdc();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ transpose_ed4bdc();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl
new file mode 100644
index 0000000..1aac4ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void transpose_ed4bdc() {
+ float3x2 arg_0 = float3x2(float2(0.0f), float2(0.0f), float2(0.0f));
+ float2x3 res = transpose(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ transpose_ed4bdc();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ transpose_ed4bdc();
+ return;
+}
+
+kernel void compute_main() {
+ transpose_ed4bdc();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.spvasm
new file mode 100644
index 0000000..2b1a390
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.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 %transpose_ed4bdc "transpose_ed4bdc"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+%mat3v2float = OpTypeMatrix %v2float 3
+ %15 = OpConstantNull %mat3v2float
+%_ptr_Function_mat3v2float = OpTypePointer Function %mat3v2float
+ %v3float = OpTypeVector %float 3
+%mat2v3float = OpTypeMatrix %v3float 2
+%_ptr_Function_mat2v3float = OpTypePointer Function %mat2v3float
+ %24 = OpConstantNull %mat2v3float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%transpose_ed4bdc = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_mat3v2float Function %15
+ %res = OpVariable %_ptr_Function_mat2v3float Function %24
+ OpStore %arg_0 %15
+ %21 = OpLoad %mat3v2float %arg_0
+ %18 = OpTranspose %mat2v3float %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %transpose_ed4bdc
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %transpose_ed4bdc
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %transpose_ed4bdc
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl
new file mode 100644
index 0000000..bdc221e
--- /dev/null
+++ b/test/tint/builtins/gen/var/transpose/ed4bdc.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn transpose_ed4bdc() {
+ var arg_0 = mat3x2<f32>();
+ var res : mat2x3<f32> = transpose(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ transpose_ed4bdc();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ transpose_ed4bdc();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ transpose_ed4bdc();
+}
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl
new file mode 100644
index 0000000..d805032
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn trunc(vec<3, f32>) -> vec<3, f32>
+fn trunc_562d05() {
+ var arg_0 = vec3<f32>();
+ var res: vec3<f32> = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_562d05();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_562d05();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_562d05();
+}
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl
new file mode 100644
index 0000000..a0cc091
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void trunc_562d05() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = trunc(arg_0);
+}
+
+vec4 vertex_main() {
+ trunc_562d05();
+ 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;
+
+void trunc_562d05() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = trunc(arg_0);
+}
+
+void fragment_main() {
+ trunc_562d05();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void trunc_562d05() {
+ vec3 arg_0 = vec3(0.0f);
+ vec3 res = trunc(arg_0);
+}
+
+void compute_main() {
+ trunc_562d05();
+}
+
+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/trunc/562d05.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.hlsl
new file mode 100644
index 0000000..e7ac694
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void trunc_562d05() {
+ float3 arg_0 = (0.0f).xxx;
+ float3 res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ trunc_562d05();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ trunc_562d05();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ trunc_562d05();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl
new file mode 100644
index 0000000..a07446c
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_562d05() {
+ float3 arg_0 = float3(0.0f);
+ float3 res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ trunc_562d05();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ trunc_562d05();
+ return;
+}
+
+kernel void compute_main() {
+ trunc_562d05();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm
new file mode 100644
index 0000000..a689aae
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %trunc_562d05 "trunc_562d05"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %14 = OpConstantNull %v3float
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%trunc_562d05 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v3float Function %14
+ %res = OpVariable %_ptr_Function_v3float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v3float %arg_0
+ %17 = OpExtInst %v3float %18 Trunc %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %trunc_562d05
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %trunc_562d05
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %trunc_562d05
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl
new file mode 100644
index 0000000..44ace13
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/562d05.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_562d05() {
+ var arg_0 = vec3<f32>();
+ var res : vec3<f32> = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_562d05();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_562d05();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_562d05();
+}
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl
new file mode 100644
index 0000000..d6f67ed
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn trunc(vec<4, f32>) -> vec<4, f32>
+fn trunc_e183aa() {
+ var arg_0 = vec4<f32>();
+ var res: vec4<f32> = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_e183aa();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_e183aa();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_e183aa();
+}
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl
new file mode 100644
index 0000000..52576b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void trunc_e183aa() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = trunc(arg_0);
+}
+
+vec4 vertex_main() {
+ trunc_e183aa();
+ 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;
+
+void trunc_e183aa() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = trunc(arg_0);
+}
+
+void fragment_main() {
+ trunc_e183aa();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void trunc_e183aa() {
+ vec4 arg_0 = vec4(0.0f);
+ vec4 res = trunc(arg_0);
+}
+
+void compute_main() {
+ trunc_e183aa();
+}
+
+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/trunc/e183aa.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.hlsl
new file mode 100644
index 0000000..b69f964
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void trunc_e183aa() {
+ float4 arg_0 = (0.0f).xxxx;
+ float4 res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ trunc_e183aa();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ trunc_e183aa();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ trunc_e183aa();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl
new file mode 100644
index 0000000..e57c538
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_e183aa() {
+ float4 arg_0 = float4(0.0f);
+ float4 res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ trunc_e183aa();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ trunc_e183aa();
+ return;
+}
+
+kernel void compute_main() {
+ trunc_e183aa();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm
new file mode 100644
index 0000000..e6efcfd
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %16 = OpExtInstImport "GLSL.std.450"
+ 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 %trunc_e183aa "trunc_e183aa"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%trunc_e183aa = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v4float Function %5
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %5
+ %17 = OpLoad %v4float %arg_0
+ %15 = OpExtInst %v4float %16 Trunc %17
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %trunc_e183aa
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %trunc_e183aa
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %trunc_e183aa
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl
new file mode 100644
index 0000000..6e1a9a4
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/e183aa.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_e183aa() {
+ var arg_0 = vec4<f32>();
+ var res : vec4<f32> = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_e183aa();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_e183aa();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_e183aa();
+}
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl
new file mode 100644
index 0000000..6b375b7
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn trunc(f32) -> f32
+fn trunc_eb83df() {
+ var arg_0 = 1.0;
+ var res: f32 = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_eb83df();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_eb83df();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_eb83df();
+}
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl
new file mode 100644
index 0000000..57e9bd8
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void trunc_eb83df() {
+ float arg_0 = 1.0f;
+ float res = trunc(arg_0);
+}
+
+vec4 vertex_main() {
+ trunc_eb83df();
+ 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;
+
+void trunc_eb83df() {
+ float arg_0 = 1.0f;
+ float res = trunc(arg_0);
+}
+
+void fragment_main() {
+ trunc_eb83df();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void trunc_eb83df() {
+ float arg_0 = 1.0f;
+ float res = trunc(arg_0);
+}
+
+void compute_main() {
+ trunc_eb83df();
+}
+
+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/trunc/eb83df.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.hlsl
new file mode 100644
index 0000000..7f13d9a
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void trunc_eb83df() {
+ float arg_0 = 1.0f;
+ float res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ trunc_eb83df();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ trunc_eb83df();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ trunc_eb83df();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl
new file mode 100644
index 0000000..2408d6c
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_eb83df() {
+ float arg_0 = 1.0f;
+ float res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ trunc_eb83df();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ trunc_eb83df();
+ return;
+}
+
+kernel void compute_main() {
+ trunc_eb83df();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm
new file mode 100644
index 0000000..f5fa2a2
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.spvasm
@@ -0,0 +1,69 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 33
+; Schema: 0
+ OpCapability Shader
+ %17 = OpExtInstImport "GLSL.std.450"
+ 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 %trunc_eb83df "trunc_eb83df"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %20 = OpTypeFunction %v4float
+%trunc_eb83df = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_float Function %8
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %arg_0 %float_1
+ %18 = OpLoad %float %arg_0
+ %16 = OpExtInst %float %17 Trunc %18
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %trunc_eb83df
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %trunc_eb83df
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %trunc_eb83df
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl
new file mode 100644
index 0000000..183abed
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/eb83df.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_eb83df() {
+ var arg_0 = 1.0;
+ var res : f32 = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_eb83df();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_eb83df();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_eb83df();
+}
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl
new file mode 100644
index 0000000..a5e40b4
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn trunc(vec<2, f32>) -> vec<2, f32>
+fn trunc_f370d3() {
+ var arg_0 = vec2<f32>();
+ var res: vec2<f32> = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_f370d3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_f370d3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_f370d3();
+}
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl
new file mode 100644
index 0000000..218ac0a
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void trunc_f370d3() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = trunc(arg_0);
+}
+
+vec4 vertex_main() {
+ trunc_f370d3();
+ 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;
+
+void trunc_f370d3() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = trunc(arg_0);
+}
+
+void fragment_main() {
+ trunc_f370d3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void trunc_f370d3() {
+ vec2 arg_0 = vec2(0.0f);
+ vec2 res = trunc(arg_0);
+}
+
+void compute_main() {
+ trunc_f370d3();
+}
+
+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/trunc/f370d3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.hlsl
new file mode 100644
index 0000000..79c0c0e
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.hlsl
@@ -0,0 +1,31 @@
+void trunc_f370d3() {
+ float2 arg_0 = (0.0f).xx;
+ float2 res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ trunc_f370d3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ trunc_f370d3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ trunc_f370d3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl
new file mode 100644
index 0000000..9a020ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void trunc_f370d3() {
+ float2 arg_0 = float2(0.0f);
+ float2 res = trunc(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ trunc_f370d3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ trunc_f370d3();
+ return;
+}
+
+kernel void compute_main() {
+ trunc_f370d3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm
new file mode 100644
index 0000000..947d496
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.spvasm
@@ -0,0 +1,71 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 35
+; Schema: 0
+ OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
+ 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 %trunc_f370d3 "trunc_f370d3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %14 = OpConstantNull %v2float
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%trunc_f370d3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_v2float Function %14
+ %res = OpVariable %_ptr_Function_v2float Function %14
+ OpStore %arg_0 %14
+ %19 = OpLoad %v2float %arg_0
+ %17 = OpExtInst %v2float %18 Trunc %19
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %21
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %trunc_f370d3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %26 = OpLabel
+ %27 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %27
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %trunc_f370d3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %trunc_f370d3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl
new file mode 100644
index 0000000..8f0468b
--- /dev/null
+++ b/test/tint/builtins/gen/var/trunc/f370d3.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn trunc_f370d3() {
+ var arg_0 = vec2<f32>();
+ var res : vec2<f32> = trunc(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ trunc_f370d3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ trunc_f370d3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ trunc_f370d3();
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl
new file mode 100644
index 0000000..c4a57a0
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn unpack2x16float(u32) -> vec2<f32>
+fn unpack2x16float_32a5cf() {
+ var arg_0 = 1u;
+ var res: vec2<f32> = unpack2x16float(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack2x16float_32a5cf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack2x16float_32a5cf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack2x16float_32a5cf();
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl
new file mode 100644
index 0000000..e88f3bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void unpack2x16float_32a5cf() {
+ uint arg_0 = 1u;
+ vec2 res = unpackHalf2x16(arg_0);
+}
+
+vec4 vertex_main() {
+ unpack2x16float_32a5cf();
+ 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;
+
+void unpack2x16float_32a5cf() {
+ uint arg_0 = 1u;
+ vec2 res = unpackHalf2x16(arg_0);
+}
+
+void fragment_main() {
+ unpack2x16float_32a5cf();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void unpack2x16float_32a5cf() {
+ uint arg_0 = 1u;
+ vec2 res = unpackHalf2x16(arg_0);
+}
+
+void compute_main() {
+ unpack2x16float_32a5cf();
+}
+
+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/unpack2x16float/32a5cf.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.hlsl
new file mode 100644
index 0000000..1497db8
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.hlsl
@@ -0,0 +1,36 @@
+float2 tint_unpack2x16float(uint param_0) {
+ uint i = param_0;
+ return f16tof32(uint2(i & 0xffff, i >> 16));
+}
+
+void unpack2x16float_32a5cf() {
+ uint arg_0 = 1u;
+ float2 res = tint_unpack2x16float(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ unpack2x16float_32a5cf();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ unpack2x16float_32a5cf();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ unpack2x16float_32a5cf();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl
new file mode 100644
index 0000000..9bd1c57
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void unpack2x16float_32a5cf() {
+ uint arg_0 = 1u;
+ float2 res = float2(as_type<half2>(arg_0));
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ unpack2x16float_32a5cf();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ unpack2x16float_32a5cf();
+ return;
+}
+
+kernel void compute_main() {
+ unpack2x16float_32a5cf();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm
new file mode 100644
index 0000000..1abc4ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %unpack2x16float_32a5cf "unpack2x16float_32a5cf"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %v2float = OpTypeVector %float 2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %24 = OpConstantNull %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%unpack2x16float_32a5cf = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_v2float Function %24
+ OpStore %arg_0 %uint_1
+ %21 = OpLoad %uint %arg_0
+ %18 = OpExtInst %v2float %20 UnpackHalf2x16 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %unpack2x16float_32a5cf
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %unpack2x16float_32a5cf
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %unpack2x16float_32a5cf
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl
new file mode 100644
index 0000000..1e475e3
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16float/32a5cf.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn unpack2x16float_32a5cf() {
+ var arg_0 = 1u;
+ var res : vec2<f32> = unpack2x16float(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack2x16float_32a5cf();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack2x16float_32a5cf();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack2x16float_32a5cf();
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl
new file mode 100644
index 0000000..ca0db32
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn unpack2x16snorm(u32) -> vec2<f32>
+fn unpack2x16snorm_b4aea6() {
+ var arg_0 = 1u;
+ var res: vec2<f32> = unpack2x16snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack2x16snorm_b4aea6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack2x16snorm_b4aea6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack2x16snorm_b4aea6();
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl
new file mode 100644
index 0000000..bb3b180
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void unpack2x16snorm_b4aea6() {
+ uint arg_0 = 1u;
+ vec2 res = unpackSnorm2x16(arg_0);
+}
+
+vec4 vertex_main() {
+ unpack2x16snorm_b4aea6();
+ 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;
+
+void unpack2x16snorm_b4aea6() {
+ uint arg_0 = 1u;
+ vec2 res = unpackSnorm2x16(arg_0);
+}
+
+void fragment_main() {
+ unpack2x16snorm_b4aea6();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void unpack2x16snorm_b4aea6() {
+ uint arg_0 = 1u;
+ vec2 res = unpackSnorm2x16(arg_0);
+}
+
+void compute_main() {
+ unpack2x16snorm_b4aea6();
+}
+
+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/unpack2x16snorm/b4aea6.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.hlsl
new file mode 100644
index 0000000..ab650e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+float2 tint_unpack2x16snorm(uint param_0) {
+ int j = int(param_0);
+ int2 i = int2(j << 16, j) >> 16;
+ return clamp(float2(i) / 32767.0, -1.0, 1.0);
+}
+
+void unpack2x16snorm_b4aea6() {
+ uint arg_0 = 1u;
+ float2 res = tint_unpack2x16snorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ unpack2x16snorm_b4aea6();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ unpack2x16snorm_b4aea6();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ unpack2x16snorm_b4aea6();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl
new file mode 100644
index 0000000..f3290ba
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void unpack2x16snorm_b4aea6() {
+ uint arg_0 = 1u;
+ float2 res = unpack_snorm2x16_to_float(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ unpack2x16snorm_b4aea6();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ unpack2x16snorm_b4aea6();
+ return;
+}
+
+kernel void compute_main() {
+ unpack2x16snorm_b4aea6();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm
new file mode 100644
index 0000000..9f93655
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %unpack2x16snorm_b4aea6 "unpack2x16snorm_b4aea6"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %v2float = OpTypeVector %float 2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %24 = OpConstantNull %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%unpack2x16snorm_b4aea6 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_v2float Function %24
+ OpStore %arg_0 %uint_1
+ %21 = OpLoad %uint %arg_0
+ %18 = OpExtInst %v2float %20 UnpackSnorm2x16 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %unpack2x16snorm_b4aea6
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %unpack2x16snorm_b4aea6
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %unpack2x16snorm_b4aea6
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl
new file mode 100644
index 0000000..f27c905
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16snorm/b4aea6.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn unpack2x16snorm_b4aea6() {
+ var arg_0 = 1u;
+ var res : vec2<f32> = unpack2x16snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack2x16snorm_b4aea6();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack2x16snorm_b4aea6();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack2x16snorm_b4aea6();
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl
new file mode 100644
index 0000000..382b2d6
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn unpack2x16unorm(u32) -> vec2<f32>
+fn unpack2x16unorm_7699c0() {
+ var arg_0 = 1u;
+ var res: vec2<f32> = unpack2x16unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack2x16unorm_7699c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack2x16unorm_7699c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack2x16unorm_7699c0();
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl
new file mode 100644
index 0000000..500c304
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void unpack2x16unorm_7699c0() {
+ uint arg_0 = 1u;
+ vec2 res = unpackUnorm2x16(arg_0);
+}
+
+vec4 vertex_main() {
+ unpack2x16unorm_7699c0();
+ 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;
+
+void unpack2x16unorm_7699c0() {
+ uint arg_0 = 1u;
+ vec2 res = unpackUnorm2x16(arg_0);
+}
+
+void fragment_main() {
+ unpack2x16unorm_7699c0();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void unpack2x16unorm_7699c0() {
+ uint arg_0 = 1u;
+ vec2 res = unpackUnorm2x16(arg_0);
+}
+
+void compute_main() {
+ unpack2x16unorm_7699c0();
+}
+
+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/unpack2x16unorm/7699c0.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.hlsl
new file mode 100644
index 0000000..acf38ca
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+float2 tint_unpack2x16unorm(uint param_0) {
+ uint j = param_0;
+ uint2 i = uint2(j & 0xffff, j >> 16);
+ return float2(i) / 65535.0;
+}
+
+void unpack2x16unorm_7699c0() {
+ uint arg_0 = 1u;
+ float2 res = tint_unpack2x16unorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ unpack2x16unorm_7699c0();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ unpack2x16unorm_7699c0();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ unpack2x16unorm_7699c0();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl
new file mode 100644
index 0000000..9c935ce
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void unpack2x16unorm_7699c0() {
+ uint arg_0 = 1u;
+ float2 res = unpack_unorm2x16_to_float(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ unpack2x16unorm_7699c0();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ unpack2x16unorm_7699c0();
+ return;
+}
+
+kernel void compute_main() {
+ unpack2x16unorm_7699c0();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm
new file mode 100644
index 0000000..d73b447
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.spvasm
@@ -0,0 +1,75 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 39
+; Schema: 0
+ OpCapability Shader
+ %20 = OpExtInstImport "GLSL.std.450"
+ 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 %unpack2x16unorm_7699c0 "unpack2x16unorm_7699c0"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+ %v2float = OpTypeVector %float 2
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %24 = OpConstantNull %v2float
+ %25 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%unpack2x16unorm_7699c0 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_v2float Function %24
+ OpStore %arg_0 %uint_1
+ %21 = OpLoad %uint %arg_0
+ %18 = OpExtInst %v2float %20 UnpackUnorm2x16 %21
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %25
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %unpack2x16unorm_7699c0
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %31
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %unpack2x16unorm_7699c0
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %37 = OpLabel
+ %38 = OpFunctionCall %void %unpack2x16unorm_7699c0
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl
new file mode 100644
index 0000000..15f7505
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack2x16unorm/7699c0.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn unpack2x16unorm_7699c0() {
+ var arg_0 = 1u;
+ var res : vec2<f32> = unpack2x16unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack2x16unorm_7699c0();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack2x16unorm_7699c0();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack2x16unorm_7699c0();
+}
diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl
new file mode 100644
index 0000000..eda71e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn unpack4x8snorm(u32) -> vec4<f32>
+fn unpack4x8snorm_523fb3() {
+ var arg_0 = 1u;
+ var res: vec4<f32> = unpack4x8snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack4x8snorm_523fb3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack4x8snorm_523fb3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack4x8snorm_523fb3();
+}
diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl
new file mode 100644
index 0000000..2f7c01b
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void unpack4x8snorm_523fb3() {
+ uint arg_0 = 1u;
+ vec4 res = unpackSnorm4x8(arg_0);
+}
+
+vec4 vertex_main() {
+ unpack4x8snorm_523fb3();
+ 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;
+
+void unpack4x8snorm_523fb3() {
+ uint arg_0 = 1u;
+ vec4 res = unpackSnorm4x8(arg_0);
+}
+
+void fragment_main() {
+ unpack4x8snorm_523fb3();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void unpack4x8snorm_523fb3() {
+ uint arg_0 = 1u;
+ vec4 res = unpackSnorm4x8(arg_0);
+}
+
+void compute_main() {
+ unpack4x8snorm_523fb3();
+}
+
+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/unpack4x8snorm/523fb3.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.hlsl
new file mode 100644
index 0000000..b7cc730
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+float4 tint_unpack4x8snorm(uint param_0) {
+ int j = int(param_0);
+ int4 i = int4(j << 24, j << 16, j << 8, j) >> 24;
+ return clamp(float4(i) / 127.0, -1.0, 1.0);
+}
+
+void unpack4x8snorm_523fb3() {
+ uint arg_0 = 1u;
+ float4 res = tint_unpack4x8snorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ unpack4x8snorm_523fb3();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ unpack4x8snorm_523fb3();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ unpack4x8snorm_523fb3();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl
new file mode 100644
index 0000000..364d8ea
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void unpack4x8snorm_523fb3() {
+ uint arg_0 = 1u;
+ float4 res = unpack_snorm4x8_to_float(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ unpack4x8snorm_523fb3();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ unpack4x8snorm_523fb3();
+ return;
+}
+
+kernel void compute_main() {
+ unpack4x8snorm_523fb3();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm
new file mode 100644
index 0000000..3ce5456
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %unpack4x8snorm_523fb3 "unpack4x8snorm_523fb3"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%unpack4x8snorm_523fb3 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %uint_1
+ %20 = OpLoad %uint %arg_0
+ %18 = OpExtInst %v4float %19 UnpackSnorm4x8 %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %unpack4x8snorm_523fb3
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %unpack4x8snorm_523fb3
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %unpack4x8snorm_523fb3
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl
new file mode 100644
index 0000000..5cb2171
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8snorm/523fb3.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn unpack4x8snorm_523fb3() {
+ var arg_0 = 1u;
+ var res : vec4<f32> = unpack4x8snorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack4x8snorm_523fb3();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack4x8snorm_523fb3();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack4x8snorm_523fb3();
+}
diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl
new file mode 100644
index 0000000..be79632
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn unpack4x8unorm(u32) -> vec4<f32>
+fn unpack4x8unorm_750c74() {
+ var arg_0 = 1u;
+ var res: vec4<f32> = unpack4x8unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack4x8unorm_750c74();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack4x8unorm_750c74();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack4x8unorm_750c74();
+}
diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl
new file mode 100644
index 0000000..b7d4334
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.glsl
@@ -0,0 +1,52 @@
+#version 310 es
+
+void unpack4x8unorm_750c74() {
+ uint arg_0 = 1u;
+ vec4 res = unpackUnorm4x8(arg_0);
+}
+
+vec4 vertex_main() {
+ unpack4x8unorm_750c74();
+ 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;
+
+void unpack4x8unorm_750c74() {
+ uint arg_0 = 1u;
+ vec4 res = unpackUnorm4x8(arg_0);
+}
+
+void fragment_main() {
+ unpack4x8unorm_750c74();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void unpack4x8unorm_750c74() {
+ uint arg_0 = 1u;
+ vec4 res = unpackUnorm4x8(arg_0);
+}
+
+void compute_main() {
+ unpack4x8unorm_750c74();
+}
+
+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/unpack4x8unorm/750c74.wgsl.expected.hlsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.hlsl
new file mode 100644
index 0000000..8cbb853
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.hlsl
@@ -0,0 +1,37 @@
+float4 tint_unpack4x8unorm(uint param_0) {
+ uint j = param_0;
+ uint4 i = uint4(j & 0xff, (j >> 8) & 0xff, (j >> 16) & 0xff, j >> 24);
+ return float4(i) / 255.0;
+}
+
+void unpack4x8unorm_750c74() {
+ uint arg_0 = 1u;
+ float4 res = tint_unpack4x8unorm(arg_0);
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ unpack4x8unorm_750c74();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ unpack4x8unorm_750c74();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ unpack4x8unorm_750c74();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl
new file mode 100644
index 0000000..a1bf4ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.msl
@@ -0,0 +1,34 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void unpack4x8unorm_750c74() {
+ uint arg_0 = 1u;
+ float4 res = unpack_unorm4x8_to_float(arg_0);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ unpack4x8unorm_750c74();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ unpack4x8unorm_750c74();
+ return;
+}
+
+kernel void compute_main() {
+ unpack4x8unorm_750c74();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm
new file mode 100644
index 0000000..962a06f
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.spvasm
@@ -0,0 +1,73 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 37
+; Schema: 0
+ OpCapability Shader
+ %19 = OpExtInstImport "GLSL.std.450"
+ 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 %unpack4x8unorm_750c74 "unpack4x8unorm_750c74"
+ OpName %arg_0 "arg_0"
+ 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
+ %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
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_1 = OpConstant %uint 1
+%_ptr_Function_uint = OpTypePointer Function %uint
+ %17 = OpConstantNull %uint
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%unpack4x8unorm_750c74 = OpFunction %void None %9
+ %12 = OpLabel
+ %arg_0 = OpVariable %_ptr_Function_uint Function %17
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %arg_0 %uint_1
+ %20 = OpLoad %uint %arg_0
+ %18 = OpExtInst %v4float %19 UnpackUnorm4x8 %20
+ OpStore %res %18
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %23
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %unpack4x8unorm_750c74
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %29
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %unpack4x8unorm_750c74
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %unpack4x8unorm_750c74
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl
new file mode 100644
index 0000000..ad2faae
--- /dev/null
+++ b/test/tint/builtins/gen/var/unpack4x8unorm/750c74.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn unpack4x8unorm_750c74() {
+ var arg_0 = 1u;
+ var res : vec4<f32> = unpack4x8unorm(arg_0);
+}
+
+@stage(vertex)
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ unpack4x8unorm_750c74();
+ return vec4<f32>();
+}
+
+@stage(fragment)
+fn fragment_main() {
+ unpack4x8unorm_750c74();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ unpack4x8unorm_750c74();
+}
diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl
new file mode 100644
index 0000000..3b3f327
--- /dev/null
+++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl
@@ -0,0 +1,34 @@
+// Copyright 2021 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/intrinsic-gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/tint/intrinsics.def
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn workgroupBarrier()
+fn workgroupBarrier_a17f7f() {
+ workgroupBarrier();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ workgroupBarrier_a17f7f();
+}
diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl
new file mode 100644
index 0000000..677f05b
--- /dev/null
+++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.glsl
@@ -0,0 +1,15 @@
+#version 310 es
+
+void workgroupBarrier_a17f7f() {
+ barrier();
+}
+
+void compute_main() {
+ workgroupBarrier_a17f7f();
+}
+
+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/workgroupBarrier/a17f7f.wgsl.expected.hlsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.hlsl
new file mode 100644
index 0000000..8879f79
--- /dev/null
+++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.hlsl
@@ -0,0 +1,9 @@
+void workgroupBarrier_a17f7f() {
+ GroupMemoryBarrierWithGroupSync();
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ workgroupBarrier_a17f7f();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl
new file mode 100644
index 0000000..ed5ed22
--- /dev/null
+++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.msl
@@ -0,0 +1,12 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void workgroupBarrier_a17f7f() {
+ threadgroup_barrier(mem_flags::mem_threadgroup);
+}
+
+kernel void compute_main() {
+ workgroupBarrier_a17f7f();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm
new file mode 100644
index 0000000..dfea5e8
--- /dev/null
+++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 12
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %workgroupBarrier_a17f7f "workgroupBarrier_a17f7f"
+ OpName %compute_main "compute_main"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %uint = OpTypeInt 32 0
+ %uint_2 = OpConstant %uint 2
+ %uint_264 = OpConstant %uint 264
+%workgroupBarrier_a17f7f = OpFunction %void None %1
+ %4 = OpLabel
+ OpControlBarrier %uint_2 %uint_2 %uint_264
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %1
+ %10 = OpLabel
+ %11 = OpFunctionCall %void %workgroupBarrier_a17f7f
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl
new file mode 100644
index 0000000..34db6c8
--- /dev/null
+++ b/test/tint/builtins/gen/var/workgroupBarrier/a17f7f.wgsl.expected.wgsl
@@ -0,0 +1,8 @@
+fn workgroupBarrier_a17f7f() {
+ workgroupBarrier();
+}
+
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ workgroupBarrier_a17f7f();
+}