[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>
This commit is contained in:
Ben Clayton 2021-07-15 16:14:34 +00:00 committed by Tint LUCI CQ
parent 58bbe32cf4
commit 9e0b3cceaf
34 changed files with 3701 additions and 2453 deletions

File diff suppressed because it is too large Load Diff

View File

@ -480,7 +480,8 @@ TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) {
ASSERT_EQ(Diagnostics().str(),
R"(error: no matching call to textureDimensions(bool, bool)
25 candidate functions:
26 candidate functions:
textureDimensions(texture: texture_1d<T>, level: i32) -> i32 where: T is f32, i32 or u32
textureDimensions(texture: texture_2d<T>, level: i32) -> vec2<i32> where: T is f32, i32 or u32
textureDimensions(texture: texture_2d_array<T>, level: i32) -> vec2<i32> where: T is f32, i32 or u32
textureDimensions(texture: texture_3d<T>, level: i32) -> vec3<i32> where: T is f32, i32 or u32
@ -517,9 +518,10 @@ TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) {
Diagnostics().str(),
R"(error: no matching call to textureDimensions(texture_depth_2d, bool)
25 candidate functions:
26 candidate functions:
textureDimensions(texture: texture_depth_2d, level: i32) -> vec2<i32>
textureDimensions(texture: texture_depth_2d) -> vec2<i32>
textureDimensions(texture: texture_1d<T>, level: i32) -> i32 where: T is f32, i32 or u32
textureDimensions(texture: texture_2d<T>, level: i32) -> vec2<i32> where: T is f32, i32 or u32
textureDimensions(texture: texture_2d_array<T>, level: i32) -> vec2<i32> where: T is f32, i32 or u32
textureDimensions(texture: texture_3d<T>, level: i32) -> vec3<i32> where: T is f32, i32 or u32

View File

@ -388,6 +388,7 @@ fn unpack4x8unorm(u32) -> vec4<f32>
[[stage("compute")]] fn workgroupBarrier()
fn textureDimensions<T: fiu32>(texture: texture_1d<T>) -> i32
fn textureDimensions<T: fiu32>(texture: texture_1d<T>, level: i32) -> i32
fn textureDimensions<T: fiu32>(texture: texture_2d<T>) -> vec2<i32>
fn textureDimensions<T: fiu32>(texture: texture_2d<T>, level: i32) -> vec2<i32>
fn textureDimensions<T: fiu32>(texture: texture_2d_array<T>) -> vec2<i32>
@ -417,6 +418,7 @@ fn textureNumLayers<T: fiu32>(texture: texture_cube_array<T>) -> i32
fn textureNumLayers(texture: texture_depth_2d_array) -> i32
fn textureNumLayers(texture: texture_depth_cube_array) -> i32
fn textureNumLayers<F: texel_format, A: read_or_write>(texture: texture_storage_2d_array<F, A>) -> i32
fn textureNumLevels<T: fiu32>(texture: texture_1d<T>) -> i32
fn textureNumLevels<T: fiu32>(texture: texture_2d<T>) -> i32
fn textureNumLevels<T: fiu32>(texture: texture_2d_array<T>) -> i32
fn textureNumLevels<T: fiu32>(texture: texture_3d<T>) -> i32

View File

@ -1589,6 +1589,10 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
TINT_ICE(Writer, diagnostics_)
<< "texture dimension does not support mips";
return false;
case ast::TextureDimension::k1d:
num_dimensions = 2;
swizzle = ".y";
break;
case ast::TextureDimension::k2d:
case ast::TextureDimension::kCube:
num_dimensions = 3;

View File

@ -0,0 +1,46 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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();
}

View File

@ -0,0 +1,46 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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();
}

View File

@ -0,0 +1,46 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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();
}

View File

@ -0,0 +1,46 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 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 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();
}

View File

@ -0,0 +1,28 @@
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;
};
tint_symbol vertex_main() {
textureNumLevels_1e6f3b();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
textureNumLevels_1e6f3b();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureNumLevels_1e6f3b();
return;
}

View File

@ -0,0 +1,27 @@
#include <metal_stdlib>
using namespace metal;
struct tint_symbol {
float4 value [[position]];
};
void textureNumLevels_1e6f3b(texture1d<uint, access::sample> tint_symbol_2) {
int res = int(tint_symbol_2.get_num_mip_levels());
}
vertex tint_symbol vertex_main(texture1d<uint, access::sample> tint_symbol_3 [[texture(0)]]) {
textureNumLevels_1e6f3b(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)]]) {
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;
}

View File

@ -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 %textureNumLevels_1e6f3b "textureNumLevels_1e6f3b"
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
%_ptr_Function_int = OpTypePointer Function %int
%22 = OpConstantNull %int
%23 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%textureNumLevels_1e6f3b = OpFunction %void None %13
%16 = OpLabel
%res = OpVariable %_ptr_Function_int Function %22
%19 = OpLoad %7 %arg_0
%17 = OpImageQueryLevels %int %19
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 %textureNumLevels_1e6f3b
%31 = OpFunctionCall %void %tint_symbol_2 %12
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %13
%33 = OpLabel
%34 = OpFunctionCall %void %textureNumLevels_1e6f3b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %13
%36 = OpLabel
%37 = OpFunctionCall %void %textureNumLevels_1e6f3b
OpReturn
OpFunctionEnd

View File

@ -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();
}

View File

@ -0,0 +1,46 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 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 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();
}

View File

@ -0,0 +1,28 @@
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;
};
tint_symbol vertex_main() {
textureNumLevels_32a0ae();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
textureNumLevels_32a0ae();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureNumLevels_32a0ae();
return;
}

View File

@ -0,0 +1,27 @@
#include <metal_stdlib>
using namespace metal;
struct tint_symbol {
float4 value [[position]];
};
void textureNumLevels_32a0ae(texture1d<int, access::sample> tint_symbol_2) {
int res = int(tint_symbol_2.get_num_mip_levels());
}
vertex tint_symbol vertex_main(texture1d<int, access::sample> tint_symbol_3 [[texture(0)]]) {
textureNumLevels_32a0ae(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)]]) {
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;
}

View File

@ -0,0 +1,77 @@
; 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" %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 %textureNumLevels_32a0ae "textureNumLevels_32a0ae"
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
%_ptr_Function_int = OpTypePointer Function %int
%21 = OpConstantNull %int
%22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%textureNumLevels_32a0ae = OpFunction %void None %13
%16 = OpLabel
%res = OpVariable %_ptr_Function_int Function %21
%18 = OpLoad %7 %arg_0
%17 = OpImageQueryLevels %int %18
OpStore %res %17
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %22
%tint_symbol = OpFunctionParameter %v4float
%25 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %13
%27 = OpLabel
OpStore %tint_pointsize %float_1
%29 = OpFunctionCall %void %textureNumLevels_32a0ae
%30 = OpFunctionCall %void %tint_symbol_2 %12
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %13
%32 = OpLabel
%33 = OpFunctionCall %void %textureNumLevels_32a0ae
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %13
%35 = OpLabel
%36 = OpFunctionCall %void %textureNumLevels_32a0ae
OpReturn
OpFunctionEnd

View File

@ -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();
}

View File

@ -0,0 +1,46 @@
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// 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 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();
}

View File

@ -0,0 +1,28 @@
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;
};
tint_symbol vertex_main() {
textureNumLevels_51b5bb();
const tint_symbol tint_symbol_1 = {float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_1;
}
void fragment_main() {
textureNumLevels_51b5bb();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureNumLevels_51b5bb();
return;
}

View File

@ -0,0 +1,27 @@
#include <metal_stdlib>
using namespace metal;
struct tint_symbol {
float4 value [[position]];
};
void textureNumLevels_51b5bb(texture1d<float, access::sample> tint_symbol_2) {
int res = int(tint_symbol_2.get_num_mip_levels());
}
vertex tint_symbol vertex_main(texture1d<float, access::sample> tint_symbol_3 [[texture(0)]]) {
textureNumLevels_51b5bb(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)]]) {
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;
}

View File

@ -0,0 +1,77 @@
; 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" %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 %textureNumLevels_51b5bb "textureNumLevels_51b5bb"
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
%_ptr_Function_int = OpTypePointer Function %int
%21 = OpConstantNull %int
%22 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%textureNumLevels_51b5bb = OpFunction %void None %12
%15 = OpLabel
%res = OpVariable %_ptr_Function_int Function %21
%18 = OpLoad %7 %arg_0
%16 = OpImageQueryLevels %int %18
OpStore %res %16
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %22
%tint_symbol = OpFunctionParameter %v4float
%25 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%27 = OpLabel
OpStore %tint_pointsize %float_1
%29 = OpFunctionCall %void %textureNumLevels_51b5bb
%30 = OpFunctionCall %void %tint_symbol_2 %11
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%32 = OpLabel
%33 = OpFunctionCall %void %textureNumLevels_51b5bb
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%35 = OpLabel
%36 = OpFunctionCall %void %textureNumLevels_51b5bb
OpReturn
OpFunctionEnd

View File

@ -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();
}