[intrinsics]: Add texture_1d level overloads
Spec changes:
https://github.com/gpuweb/gpuweb/pull/1938
https://github.com/gpuweb/gpuweb/pull/1923
Change-Id: Ib738e15a146d73a75213a17a53e89f98c16b80a4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58040
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/test/intrinsics/gen/textureDimensions/52045c.wgsl b/test/intrinsics/gen/textureDimensions/52045c.wgsl
new file mode 100644
index 0000000..bf44ca6
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/52045c.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/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 res: i32 = textureDimensions(arg_0, 0);
+}
+
+[[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/intrinsics/gen/textureDimensions/52045c.wgsl.expected.hlsl b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.hlsl
new file mode 100644
index 0000000..044faad
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.hlsl
@@ -0,0 +1,28 @@
+Texture1D<int4> arg_0 : register(t0, space1);
+
+void textureDimensions_52045c() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+tint_symbol vertex_main() {
+ textureDimensions_52045c();
+ const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
+ return tint_symbol_1;
+}
+
+void fragment_main() {
+ textureDimensions_52045c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_52045c();
+ return;
+}
diff --git a/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.msl b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.msl
new file mode 100644
index 0000000..22f09ad
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+void textureDimensions_52045c(texture1d<int, access::sample> tint_symbol_2) {
+ int res = int(tint_symbol_2.get_width(0));
+}
+
+vertex tint_symbol vertex_main(texture1d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
+ textureDimensions_52045c(tint_symbol_3);
+ tint_symbol const tint_symbol_1 = {.value=float4()};
+ return tint_symbol_1;
+}
+
+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/intrinsics/gen/textureDimensions/52045c.wgsl.expected.spvasm b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.spvasm
new file mode 100644
index 0000000..626f2d0
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; 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" %tint_pointsize %tint_symbol_1
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %arg_0 "arg_0"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %textureDimensions_52045c "textureDimensions_52045c"
+ OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %int = OpTypeInt 32 1
+ %7 = OpTypeImage %int 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %12 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
+ %void = OpTypeVoid
+ %13 = OpTypeFunction %void
+ %int_0 = OpConstant %int 0
+%_ptr_Function_int = OpTypePointer Function %int
+ %22 = OpConstantNull %int
+ %23 = OpTypeFunction %void %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_52045c = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %18 = OpLoad %7 %arg_0
+ %17 = OpImageQuerySizeLod %int %18 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %23
+%tint_symbol = OpFunctionParameter %v4float
+ %26 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %28 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %30 = OpFunctionCall %void %textureDimensions_52045c
+ %31 = OpFunctionCall %void %tint_symbol_2 %12
+ 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/intrinsics/gen/textureDimensions/52045c.wgsl.expected.wgsl b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.wgsl
new file mode 100644
index 0000000..a031fe4
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/52045c.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+[[group(1), binding(0)]] var arg_0 : texture_1d<i32>;
+
+fn textureDimensions_52045c() {
+ var res : i32 = textureDimensions(arg_0, 0);
+}
+
+[[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/intrinsics/gen/textureDimensions/79df87.wgsl b/test/intrinsics/gen/textureDimensions/79df87.wgsl
new file mode 100644
index 0000000..43b59bf
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/79df87.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/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 res: i32 = textureDimensions(arg_0, 0);
+}
+
+[[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/intrinsics/gen/textureDimensions/79df87.wgsl.expected.hlsl b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.hlsl
new file mode 100644
index 0000000..f5c0aa5
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.hlsl
@@ -0,0 +1,28 @@
+Texture1D<uint4> arg_0 : register(t0, space1);
+
+void textureDimensions_79df87() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+tint_symbol vertex_main() {
+ textureDimensions_79df87();
+ const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
+ return tint_symbol_1;
+}
+
+void fragment_main() {
+ textureDimensions_79df87();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_79df87();
+ return;
+}
diff --git a/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.msl b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.msl
new file mode 100644
index 0000000..fbb7d73
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+void textureDimensions_79df87(texture1d<uint, access::sample> tint_symbol_2) {
+ int res = int(tint_symbol_2.get_width(0));
+}
+
+vertex tint_symbol vertex_main(texture1d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
+ textureDimensions_79df87(tint_symbol_3);
+ tint_symbol const tint_symbol_1 = {.value=float4()};
+ return tint_symbol_1;
+}
+
+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/intrinsics/gen/textureDimensions/79df87.wgsl.expected.spvasm b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.spvasm
new file mode 100644
index 0000000..ad99541
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+; 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" %tint_pointsize %tint_symbol_1
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %arg_0 "arg_0"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %textureDimensions_79df87 "textureDimensions_79df87"
+ OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %uint = OpTypeInt 32 0
+ %7 = OpTypeImage %uint 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %12 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
+ %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 %void %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_79df87 = OpFunction %void None %13
+ %16 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %23
+ %19 = OpLoad %7 %arg_0
+ %17 = OpImageQuerySizeLod %int %19 %int_0
+ OpStore %res %17
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %24
+%tint_symbol = OpFunctionParameter %v4float
+ %27 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %13
+ %29 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %31 = OpFunctionCall %void %textureDimensions_79df87
+ %32 = OpFunctionCall %void %tint_symbol_2 %12
+ 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/intrinsics/gen/textureDimensions/79df87.wgsl.expected.wgsl b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.wgsl
new file mode 100644
index 0000000..d604e48
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/79df87.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+[[group(1), binding(0)]] var arg_0 : texture_1d<u32>;
+
+fn textureDimensions_79df87() {
+ var res : i32 = textureDimensions(arg_0, 0);
+}
+
+[[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/intrinsics/gen/textureDimensions/b3e407.wgsl b/test/intrinsics/gen/textureDimensions/b3e407.wgsl
new file mode 100644
index 0000000..e190837
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/b3e407.wgsl
@@ -0,0 +1,46 @@
+// Copyright 2021 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/intrinsic-gen
+// using the template:
+// test/intrinsics/intrinsics.wgsl.tmpl
+// and the intrinsic defintion file:
+// src/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 res: i32 = textureDimensions(arg_0, 0);
+}
+
+[[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/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.hlsl b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.hlsl
new file mode 100644
index 0000000..43682c8
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.hlsl
@@ -0,0 +1,28 @@
+Texture1D<float4> arg_0 : register(t0, space1);
+
+void textureDimensions_b3e407() {
+ int2 tint_tmp;
+ arg_0.GetDimensions(0, tint_tmp.x, tint_tmp.y);
+ int res = tint_tmp.x;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+tint_symbol vertex_main() {
+ textureDimensions_b3e407();
+ const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
+ return tint_symbol_1;
+}
+
+void fragment_main() {
+ textureDimensions_b3e407();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ textureDimensions_b3e407();
+ return;
+}
diff --git a/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.msl b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.msl
new file mode 100644
index 0000000..f14e2cb
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.msl
@@ -0,0 +1,27 @@
+#include <metal_stdlib>
+
+using namespace metal;
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+void textureDimensions_b3e407(texture1d<float, access::sample> tint_symbol_2) {
+ int res = int(tint_symbol_2.get_width(0));
+}
+
+vertex tint_symbol vertex_main(texture1d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
+ textureDimensions_b3e407(tint_symbol_3);
+ tint_symbol const tint_symbol_1 = {.value=float4()};
+ return tint_symbol_1;
+}
+
+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/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.spvasm b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.spvasm
new file mode 100644
index 0000000..0782a4b
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.spvasm
@@ -0,0 +1,78 @@
+; 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" %tint_pointsize %tint_symbol_1
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %tint_pointsize "tint_pointsize"
+ OpName %arg_0 "arg_0"
+ OpName %tint_symbol_1 "tint_symbol_1"
+ OpName %textureDimensions_b3e407 "textureDimensions_b3e407"
+ OpName %res "res"
+ OpName %tint_symbol_2 "tint_symbol_2"
+ OpName %tint_symbol "tint_symbol"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %tint_pointsize BuiltIn PointSize
+ OpDecorate %arg_0 DescriptorSet 1
+ OpDecorate %arg_0 Binding 0
+ OpDecorate %tint_symbol_1 BuiltIn Position
+ %float = OpTypeFloat 32
+%_ptr_Output_float = OpTypePointer Output %float
+ %4 = OpConstantNull %float
+%tint_pointsize = OpVariable %_ptr_Output_float Output %4
+ %7 = OpTypeImage %float 1D 0 0 0 1 Unknown
+%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7
+ %arg_0 = OpVariable %_ptr_UniformConstant_7 UniformConstant
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %11 = OpConstantNull %v4float
+%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %11
+ %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 %void %v4float
+ %float_1 = OpConstant %float 1
+%textureDimensions_b3e407 = OpFunction %void None %12
+ %15 = OpLabel
+ %res = OpVariable %_ptr_Function_int Function %22
+ %18 = OpLoad %7 %arg_0
+ %16 = OpImageQuerySizeLod %int %18 %int_0
+ OpStore %res %16
+ OpReturn
+ OpFunctionEnd
+%tint_symbol_2 = OpFunction %void None %23
+%tint_symbol = OpFunctionParameter %v4float
+ %26 = OpLabel
+ OpStore %tint_symbol_1 %tint_symbol
+ OpReturn
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %12
+ %28 = OpLabel
+ OpStore %tint_pointsize %float_1
+ %30 = OpFunctionCall %void %textureDimensions_b3e407
+ %31 = OpFunctionCall %void %tint_symbol_2 %11
+ 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/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.wgsl b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.wgsl
new file mode 100644
index 0000000..f39a1ad
--- /dev/null
+++ b/test/intrinsics/gen/textureDimensions/b3e407.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+[[group(1), binding(0)]] var arg_0 : texture_1d<f32>;
+
+fn textureDimensions_b3e407() {
+ var res : i32 = textureDimensions(arg_0, 0);
+}
+
+[[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();
+}