const eval of clamp

Bug: tint:1581
Change-Id: Icffaf023021e704b3beaacf35136a9d6263b31e3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97221
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano 2022-07-27 15:02:25 +00:00 committed by Dawn LUCI CQ
parent 4de90f0bb1
commit bf8ee35498
179 changed files with 5222 additions and 701 deletions

View File

@ -135,6 +135,7 @@ match scalar_no_i32: f32 | f16 | u32 | bool
match scalar_no_u32: f32 | f16 | i32 | bool
match scalar_no_bool: f32 | f16 | i32 | u32
match fia_fi32_f16: fa | ia | f32 | i32 | f16
match fia_fiu32: fa | ia | f32 | i32 | u32
match fa_f32: fa | f32
match fa_f32_f16: fa | f32 | f16
match ia_iu32: ia | i32 | u32
@ -377,8 +378,8 @@ fn atanh(f32) -> f32
fn atanh<N: num>(vec<N, f32>) -> vec<N, f32>
fn ceil(f32) -> f32
fn ceil<N: num>(vec<N, f32>) -> vec<N, f32>
fn clamp<T: fiu32>(T, T, T) -> T
fn clamp<N: num, T: fiu32>(vec<N, T>, vec<N, T>, vec<N, T>) -> vec<N, T>
@const fn clamp<T: fia_fiu32>(T, T, T) -> T
@const fn clamp<N: num, T: fia_fiu32>(vec<N, T>, vec<N, T>, vec<N, T>) -> vec<N, T>
fn cos(f32) -> f32
fn cos<N: num>(vec<N, f32>) -> vec<N, f32>
fn cosh(f32) -> f32

View File

@ -1415,14 +1415,16 @@ TEST_P(ResolverBuiltinTest_ThreeParam_FloatOrInt, Error_NoParams) {
EXPECT_FALSE(r()->Resolve());
EXPECT_EQ(r()->error(), "error: no matching call to " + std::string(param.name) +
"()\n\n"
"2 candidate functions:\n " +
std::string(param.name) +
"(T, T, T) -> T where: T is f32, i32 or u32\n " +
std::string(param.name) +
"(vecN<T>, vecN<T>, vecN<T>) -> vecN<T> where: T is f32, i32 "
"or u32\n");
EXPECT_EQ(
r()->error(),
"error: no matching call to " + std::string(param.name) +
"()\n\n"
"2 candidate functions:\n " +
std::string(param.name) +
"(T, T, T) -> T where: T is abstract-float, abstract-int, f32, i32 or u32\n " +
std::string(param.name) +
"(vecN<T>, vecN<T>, vecN<T>) -> vecN<T> where: T is abstract-float, abstract-int, "
"f32, i32 or u32\n");
}
INSTANTIATE_TEST_SUITE_P(ResolverTest,

View File

@ -79,6 +79,19 @@ auto Dispatch_fia_fi32_f16(F&& f, CONSTANTS&&... cs) {
});
}
/// Helper that calls `f` passing in the value of all `cs`.
/// Assumes all `cs` are of the same type.
template <typename F, typename... CONSTANTS>
auto Dispatch_fia_fiu32(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
[&](const sem::AbstractInt*) { return f(cs->template As<AInt>()...); },
[&](const sem::AbstractFloat*) { return f(cs->template As<AFloat>()...); },
[&](const sem::F32*) { return f(cs->template As<f32>()...); },
[&](const sem::I32*) { return f(cs->template As<i32>()...); },
[&](const sem::U32*) { return f(cs->template As<u32>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
/// Assumes all `cs` are of the same type.
template <typename F, typename... CONSTANTS>
@ -723,6 +736,20 @@ const sem::Constant* ConstEval::atan2(const sem::Type*,
args[1]->ConstantValue());
}
const sem::Constant* ConstEval::clamp(const sem::Type*,
utils::ConstVectorRef<const sem::Expression*> args) {
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1,
const sem::Constant* c2) {
auto create = [&](auto e, auto low, auto high) {
return CreateElement(builder, c0->Type(),
decltype(e)(std::min(std::max(e, low), high)));
};
return Dispatch_fia_fiu32(create, c0, c1, c2);
};
return TransformElements(builder, transform, args[0]->ConstantValue(), args[1]->ConstantValue(),
args[2]->ConstantValue());
}
utils::Result<const sem::Constant*> ConstEval::Convert(const sem::Type* target_ty,
const sem::Constant* value,
const Source& source) {

View File

@ -198,6 +198,13 @@ class ConstEval {
const sem::Constant* atan2(const sem::Type* ty,
utils::ConstVectorRef<const sem::Expression*> args);
/// clamp builtin
/// @param ty the expression type
/// @param args the input arguments
/// @return the result value, or null if the value cannot be calculated
const sem::Constant* clamp(const sem::Type* ty,
utils::ConstVectorRef<const sem::Expression*> args);
private:
/// Adds the given error message to the diagnostics
void AddError(const std::string& msg, const Source& source) const;

View File

@ -3254,6 +3254,31 @@ INSTANTIATE_TEST_SUITE_P( //
testing::ValuesIn(Concat(Atan2Cases<AFloat, true>(), //
Atan2Cases<f32, false>()))));
template <typename T>
std::vector<Case> ClampCases() {
return {
C({T(0), T(0), T(0)}, T(0)),
C({T(0), T(42), kHighest<T>}, T(42)),
C({kLowest<T>, T(0), T(42)}, T(0)),
C({T(0), kLowest<T>, kHighest<T>}, T(0)),
C({T(0), kHighest<T>, kLowest<T>}, kLowest<T>),
C({kHighest<T>, kHighest<T>, kHighest<T>}, kHighest<T>),
C({kLowest<T>, kLowest<T>, kLowest<T>}, kLowest<T>),
C({kHighest<T>, kLowest<T>, kHighest<T>}, kHighest<T>),
C({kLowest<T>, kLowest<T>, kHighest<T>}, kLowest<T>),
};
}
INSTANTIATE_TEST_SUITE_P( //
Clamp,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kClamp),
testing::ValuesIn(Concat(ClampCases<AInt>(), //
ClampCases<i32>(),
ClampCases<u32>(),
ClampCases<AFloat>(),
ClampCases<f32>()))));
} // namespace builtin
} // namespace

File diff suppressed because it is too large Load Diff

View File

@ -1075,14 +1075,14 @@ INSTANTIATE_TEST_SUITE_P(
IntrinsicTableAbstractTernaryTest,
testing::Values( // clang-format off
// result | param a | param b | param c | arg a | arg b | arg c
Case::Create<f32, f32, f32, f32, AFloat, AFloat, AFloat>(),
Case::Create<f32, f32, f32, f32, AFloat, AFloat, AInt>(),
Case::Create<f32, f32, f32, f32, AFloat, AInt, AFloat>(),
Case::Create<f32, f32, f32, f32, AFloat, AInt, AInt>(),
Case::Create<f32, f32, f32, f32, AInt, AFloat, AFloat>(),
Case::Create<f32, f32, f32, f32, AInt, AFloat, AInt>(),
Case::Create<f32, f32, f32, f32, AInt, AInt, AFloat>(),
Case::Create<i32, i32, i32, i32, AInt, AInt, AInt>()
Case::Create<AFloat, AFloat, AFloat, AFloat, AFloat, AFloat, AFloat>(),
Case::Create<AFloat, AFloat, AFloat, AFloat, AFloat, AFloat, AInt>(),
Case::Create<AFloat, AFloat, AFloat, AFloat, AFloat, AInt, AFloat>(),
Case::Create<AFloat, AFloat, AFloat, AFloat, AFloat, AInt, AInt>(),
Case::Create<AFloat, AFloat, AFloat, AFloat, AInt, AFloat, AFloat>(),
Case::Create<AFloat, AFloat, AFloat, AFloat, AInt, AFloat, AInt>(),
Case::Create<AFloat, AFloat, AFloat, AFloat, AInt, AInt, AFloat>(),
Case::Create<AInt, AInt, AInt, AInt, AInt, AInt, AInt>()
// clang-format on
));
@ -1091,14 +1091,14 @@ INSTANTIATE_TEST_SUITE_P(
IntrinsicTableAbstractTernaryTest,
testing::Values( // clang-format off
// result | param a | param b | param c | arg a | arg b | arg c
Case::Create<f32V, f32V, f32V, f32V, AFloatV, AFloatV, AFloatV>(),
Case::Create<f32V, f32V, f32V, f32V, AFloatV, AFloatV, AIntV>(),
Case::Create<f32V, f32V, f32V, f32V, AFloatV, AIntV, AFloatV>(),
Case::Create<f32V, f32V, f32V, f32V, AFloatV, AIntV, AIntV>(),
Case::Create<f32V, f32V, f32V, f32V, AIntV, AFloatV, AFloatV>(),
Case::Create<f32V, f32V, f32V, f32V, AIntV, AFloatV, AIntV>(),
Case::Create<f32V, f32V, f32V, f32V, AIntV, AIntV, AFloatV>(),
Case::Create<i32V, i32V, i32V, i32V, AIntV, AIntV, AIntV>()
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AFloatV, AFloatV, AFloatV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AFloatV, AFloatV, AIntV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AFloatV, AIntV, AFloatV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AFloatV, AIntV, AIntV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AIntV, AFloatV, AFloatV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AIntV, AFloatV, AIntV>(),
Case::Create<AFloatV, AFloatV, AFloatV, AFloatV, AIntV, AIntV, AFloatV>(),
Case::Create<AIntV, AIntV, AIntV, AIntV, AIntV, AIntV, AIntV>()
// clang-format on
));
@ -1270,6 +1270,68 @@ Case::Create<u32V, u32V, u32V, u32V, u32V, u32V, AIntV>(
// clang-format on
));
struct IntrinsicTableAbstractTernaryTest_NonConstEval : public ResolverTestWithParam<Case> {
std::unique_ptr<IntrinsicTable> table = IntrinsicTable::Create(*this);
};
TEST_P(IntrinsicTableAbstractTernaryTest_NonConstEval, MatchMix) {
auto* arg_a = GetParam().arg_a(*this);
auto* arg_b = GetParam().arg_b(*this);
auto* arg_c = GetParam().arg_c(*this);
auto builtin =
table->Lookup(sem::BuiltinType::kMix, utils::Vector{arg_a, arg_b, arg_c}, Source{{12, 34}});
bool matched = builtin.sem != nullptr;
bool expected_match = GetParam().expected_match;
EXPECT_EQ(matched, expected_match) << Diagnostics().str();
auto* result = builtin.sem ? builtin.sem->ReturnType() : nullptr;
auto* expected_result = GetParam().expected_result(*this);
EXPECT_TYPE(result, expected_result);
auto* param_a = builtin.sem ? builtin.sem->Parameters()[0]->Type() : nullptr;
auto* expected_param_a = GetParam().expected_param_a(*this);
EXPECT_TYPE(param_a, expected_param_a);
auto* param_b = builtin.sem ? builtin.sem->Parameters()[1]->Type() : nullptr;
auto* expected_param_b = GetParam().expected_param_b(*this);
EXPECT_TYPE(param_b, expected_param_b);
auto* param_c = builtin.sem ? builtin.sem->Parameters()[2]->Type() : nullptr;
auto* expected_param_c = GetParam().expected_param_c(*this);
EXPECT_TYPE(param_c, expected_param_c);
}
INSTANTIATE_TEST_SUITE_P(
AFloat_f32,
IntrinsicTableAbstractTernaryTest_NonConstEval,
testing::Values( // clang-format off
// result | param a | param b | param c | arg a | arg b | arg c
Case::Create<f32, f32, f32, f32, AFloat, AFloat, AFloat>(),
Case::Create<f32, f32, f32, f32, AFloat, AFloat, f32>(),
Case::Create<f32, f32, f32, f32, AFloat, f32, AFloat>(),
Case::Create<f32, f32, f32, f32, AFloat, f32, f32>(),
Case::Create<f32, f32, f32, f32, f32, AFloat, AFloat>(),
Case::Create<f32, f32, f32, f32, f32, AFloat, f32>(),
Case::Create<f32, f32, f32, f32, f32, f32, AFloat>()
// clang-format on
));
INSTANTIATE_TEST_SUITE_P(
VecAFloat_Vecf32,
IntrinsicTableAbstractTernaryTest_NonConstEval,
testing::Values( // clang-format off
// result | param a | param b | param c | arg a | arg b | arg c
Case::Create<f32V, f32V, f32V, f32V, AFloatV, AFloatV, AFloatV>(),
Case::Create<f32V, f32V, f32V, f32V, AFloatV, AFloatV, f32V>(),
Case::Create<f32V, f32V, f32V, f32V, AFloatV, f32V, AFloatV>(),
Case::Create<f32V, f32V, f32V, f32V, AFloatV, f32V, f32V>(),
Case::Create<f32V, f32V, f32V, f32V, f32V, AFloatV, AFloatV>(),
Case::Create<f32V, f32V, f32V, f32V, f32V, AFloatV, f32V>(),
Case::Create<f32V, f32V, f32V, f32V, f32V, f32V, AFloatV> ()
// clang-format on
));
} // namespace AbstractTernaryTests
} // namespace

View File

@ -1,5 +1,5 @@
void clamp_0acf8f() {
float2 res = clamp((1.0f).xx, (1.0f).xx, (1.0f).xx);
float2 res = (1.0f).xx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_0acf8f() {
float2 res = clamp((1.0f).xx, (1.0f).xx, (1.0f).xx);
float2 res = (1.0f).xx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_0acf8f() {
vec2 res = clamp(vec2(1.0f), vec2(1.0f), vec2(1.0f));
vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_0acf8f() {
vec2 res = clamp(vec2(1.0f), vec2(1.0f), vec2(1.0f));
vec2 res = vec2(1.0f);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_0acf8f() {
vec2 res = clamp(vec2(1.0f), vec2(1.0f), vec2(1.0f));
vec2 res = vec2(1.0f);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_0acf8f() {
float2 res = clamp(float2(1.0f), float2(1.0f), float2(1.0f));
float2 res = float2(1.0f);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 32
; Schema: 0
OpCapability Shader
%15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v2float %float_1 %float_1
%15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%20 = OpConstantNull %v2float
%21 = OpTypeFunction %v4float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%clamp_0acf8f = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %20
%13 = OpExtInst %v2float %15 NClamp %17 %17 %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v2float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %clamp_0acf8f
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %clamp_0acf8f
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_0acf8f
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_0acf8f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_0acf8f
%30 = OpLabel
%31 = OpFunctionCall %void %clamp_0acf8f
OpReturn
OpFunctionEnd

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(vec<2, ia>, vec<2, ia>, vec<2, ia>) -> vec<2, ia>
fn clamp_177548() {
var res = clamp(vec2(1.0), vec2(1.0), vec2(1.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_177548();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_177548();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_177548();
}

View File

@ -0,0 +1,30 @@
void clamp_177548() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_177548();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_177548();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_177548();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_177548() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_177548();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_177548();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_177548();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_177548() {
vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
clamp_177548();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_177548() {
vec2 res = vec2(1.0f);
}
void fragment_main() {
clamp_177548();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_177548() {
vec2 res = vec2(1.0f);
}
void compute_main() {
clamp_177548();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_177548() {
float2 res = float2(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_177548();
return float4(0.0f);
}
vertex tint_symbol vertex_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_177548();
return;
}
kernel void compute_main() {
clamp_177548();
return;
}

View File

@ -0,0 +1,66 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_177548 "clamp_177548"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%clamp_177548 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %clamp_177548
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
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_177548
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %clamp_177548
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn clamp_177548() {
var res = clamp(vec2(1.0), vec2(1.0), vec2(1.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_177548();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_177548();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_177548();
}

View File

@ -1,5 +1,5 @@
void clamp_1a32e3() {
int4 res = clamp((1).xxxx, (1).xxxx, (1).xxxx);
int4 res = (1).xxxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_1a32e3() {
int4 res = clamp((1).xxxx, (1).xxxx, (1).xxxx);
int4 res = (1).xxxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_1a32e3() {
ivec4 res = clamp(ivec4(1), ivec4(1), ivec4(1));
ivec4 res = ivec4(1);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_1a32e3() {
ivec4 res = clamp(ivec4(1), ivec4(1), ivec4(1));
ivec4 res = ivec4(1);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_1a32e3() {
ivec4 res = clamp(ivec4(1), ivec4(1), ivec4(1));
ivec4 res = ivec4(1);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_1a32e3() {
int4 res = clamp(int4(1), int4(1), int4(1));
int4 res = int4(1);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -34,37 +33,36 @@
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%int_1 = OpConstant %int 1
%18 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%_ptr_Function_v4int = OpTypePointer Function %v4int
%21 = OpConstantNull %v4int
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v4int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_1a32e3 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4int Function %21
%13 = OpExtInst %v4int %16 SClamp %18 %18 %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v4int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_1a32e3
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_1a32e3
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %clamp_1a32e3
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_1a32e3
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %clamp_1a32e3
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_1a32e3
OpReturn
OpFunctionEnd

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(fa, fa, fa) -> fa
fn clamp_23aa4f() {
var res = clamp(1, 1, 1);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_23aa4f();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_23aa4f();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_23aa4f();
}

View File

@ -0,0 +1,30 @@
void clamp_23aa4f() {
int res = 1;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_23aa4f();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_23aa4f();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_23aa4f();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_23aa4f() {
int res = 1;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_23aa4f();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_23aa4f();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_23aa4f();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_23aa4f() {
int res = 1;
}
vec4 vertex_main() {
clamp_23aa4f();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_23aa4f() {
int res = 1;
}
void fragment_main() {
clamp_23aa4f();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_23aa4f() {
int res = 1;
}
void compute_main() {
clamp_23aa4f();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_23aa4f() {
int res = 1;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_23aa4f();
return float4(0.0f);
}
vertex tint_symbol vertex_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_23aa4f();
return;
}
kernel void compute_main() {
clamp_23aa4f();
return;
}

View File

@ -0,0 +1,66 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_23aa4f "clamp_23aa4f"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_23aa4f = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %clamp_23aa4f
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_23aa4f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %clamp_23aa4f
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn clamp_23aa4f() {
var res = clamp(1, 1, 1);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_23aa4f();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_23aa4f();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_23aa4f();
}

View File

@ -1,5 +1,5 @@
void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f);
float res = 1.0f;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f);
float res = 1.0f;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f);
float res = 1.0f;
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f);
float res = 1.0f;
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f);
float res = 1.0f;
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_2bd567() {
float res = clamp(1.0f, 1.0f, 1.0f);
float res = 1.0f;
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; Bound: 29
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -33,33 +32,32 @@
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
%18 = OpTypeFunction %v4float
%16 = OpTypeFunction %v4float
%clamp_2bd567 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
%13 = OpExtInst %float %14 NClamp %float_1 %float_1 %float_1
OpStore %res %13
OpStore %res %float_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %clamp_2bd567
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %clamp_2bd567
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %void %clamp_2bd567
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_2bd567
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_2bd567
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_2bd567
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void clamp_2bde41() {
float4 res = clamp((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx);
float4 res = (1.0f).xxxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_2bde41() {
float4 res = clamp((1.0f).xxxx, (1.0f).xxxx, (1.0f).xxxx);
float4 res = (1.0f).xxxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_2bde41() {
vec4 res = clamp(vec4(1.0f), vec4(1.0f), vec4(1.0f));
vec4 res = vec4(1.0f);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_2bde41() {
vec4 res = clamp(vec4(1.0f), vec4(1.0f), vec4(1.0f));
vec4 res = vec4(1.0f);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_2bde41() {
vec4 res = clamp(vec4(1.0f), vec4(1.0f), vec4(1.0f));
vec4 res = vec4(1.0f);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_2bde41() {
float4 res = clamp(float4(1.0f), float4(1.0f), float4(1.0f));
float4 res = float4(1.0f);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 30
; Schema: 0
OpCapability Shader
%14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -32,35 +31,34 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%19 = OpTypeFunction %v4float
%17 = OpTypeFunction %v4float
%clamp_2bde41 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
%13 = OpExtInst %v4float %14 NClamp %16 %16 %16
OpStore %res %13
OpStore %res %14
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %clamp_2bde41
%vertex_main_inner = OpFunction %v4float None %17
%19 = OpLabel
%20 = OpFunctionCall %void %clamp_2bde41
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %25
%22 = OpLabel
%23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_2bde41
%25 = OpLabel
%26 = OpFunctionCall %void %clamp_2bde41
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %clamp_2bde41
%28 = OpLabel
%29 = OpFunctionCall %void %clamp_2bde41
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void clamp_548fc7() {
uint3 res = clamp((1u).xxx, (1u).xxx, (1u).xxx);
uint3 res = (1u).xxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_548fc7() {
uint3 res = clamp((1u).xxx, (1u).xxx, (1u).xxx);
uint3 res = (1u).xxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_548fc7() {
uvec3 res = clamp(uvec3(1u), uvec3(1u), uvec3(1u));
uvec3 res = uvec3(1u);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_548fc7() {
uvec3 res = clamp(uvec3(1u), uvec3(1u), uvec3(1u));
uvec3 res = uvec3(1u);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_548fc7() {
uvec3 res = clamp(uvec3(1u), uvec3(1u), uvec3(1u));
uvec3 res = uvec3(1u);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_548fc7() {
uint3 res = clamp(uint3(1u), uint3(1u), uint3(1u));
uint3 res = uint3(1u);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -34,37 +33,36 @@
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%18 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%21 = OpConstantNull %v3uint
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v3uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_548fc7 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %21
%13 = OpExtInst %v3uint %16 UClamp %18 %18 %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v3uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_548fc7
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_548fc7
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %clamp_548fc7
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_548fc7
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %clamp_548fc7
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_548fc7
OpReturn
OpFunctionEnd

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(vec<3, fa>, vec<3, fa>, vec<3, fa>) -> vec<3, fa>
fn clamp_5cf700() {
var res = clamp(vec3(1), vec3(1), vec3(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_5cf700();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_5cf700();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_5cf700();
}

View File

@ -0,0 +1,30 @@
void clamp_5cf700() {
int3 res = (1).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_5cf700();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_5cf700();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_5cf700();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_5cf700() {
int3 res = (1).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_5cf700();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_5cf700();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_5cf700();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_5cf700() {
ivec3 res = ivec3(1);
}
vec4 vertex_main() {
clamp_5cf700();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_5cf700() {
ivec3 res = ivec3(1);
}
void fragment_main() {
clamp_5cf700();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_5cf700() {
ivec3 res = ivec3(1);
}
void compute_main() {
clamp_5cf700();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_5cf700() {
int3 res = int3(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_5cf700();
return float4(0.0f);
}
vertex tint_symbol vertex_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_5cf700();
return;
}
kernel void compute_main() {
clamp_5cf700();
return;
}

View File

@ -0,0 +1,68 @@
; 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 %clamp_5cf700 "clamp_5cf700"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%int_1 = OpConstant %int 1
%16 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v3int = OpTypePointer Function %v3int
%19 = OpConstantNull %v3int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_5cf700 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_5cf700
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 %clamp_5cf700
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_5cf700
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn clamp_5cf700() {
var res = clamp(vec3(1), vec3(1), vec3(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_5cf700();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_5cf700();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_5cf700();
}

View File

@ -1,5 +1,5 @@
void clamp_5f0819() {
int3 res = clamp((1).xxx, (1).xxx, (1).xxx);
int3 res = (1).xxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_5f0819() {
int3 res = clamp((1).xxx, (1).xxx, (1).xxx);
int3 res = (1).xxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_5f0819() {
ivec3 res = clamp(ivec3(1), ivec3(1), ivec3(1));
ivec3 res = ivec3(1);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_5f0819() {
ivec3 res = clamp(ivec3(1), ivec3(1), ivec3(1));
ivec3 res = ivec3(1);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_5f0819() {
ivec3 res = clamp(ivec3(1), ivec3(1), ivec3(1));
ivec3 res = ivec3(1);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_5f0819() {
int3 res = clamp(int3(1), int3(1), int3(1));
int3 res = int3(1);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -34,37 +33,36 @@
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
%18 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%16 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v3int = OpTypePointer Function %v3int
%21 = OpConstantNull %v3int
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v3int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_5f0819 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %21
%13 = OpExtInst %v3int %16 SClamp %18 %18 %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v3int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_5f0819
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_5f0819
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %clamp_5f0819
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_5f0819
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %clamp_5f0819
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_5f0819
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void clamp_6c1749() {
int2 res = clamp((1).xx, (1).xx, (1).xx);
int2 res = (1).xx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_6c1749() {
int2 res = clamp((1).xx, (1).xx, (1).xx);
int2 res = (1).xx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_6c1749() {
ivec2 res = clamp(ivec2(1), ivec2(1), ivec2(1));
ivec2 res = ivec2(1);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_6c1749() {
ivec2 res = clamp(ivec2(1), ivec2(1), ivec2(1));
ivec2 res = ivec2(1);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_6c1749() {
ivec2 res = clamp(ivec2(1), ivec2(1), ivec2(1));
ivec2 res = ivec2(1);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_6c1749() {
int2 res = clamp(int2(1), int2(1), int2(1));
int2 res = int2(1);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -34,37 +33,36 @@
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
%18 = OpConstantComposite %v2int %int_1 %int_1
%16 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v2int = OpTypePointer Function %v2int
%21 = OpConstantNull %v2int
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v2int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_6c1749 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %21
%13 = OpExtInst %v2int %16 SClamp %18 %18 %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v2int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_6c1749
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_6c1749
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %clamp_6c1749
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_6c1749
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %clamp_6c1749
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_6c1749
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void clamp_7706d7() {
uint2 res = clamp((1u).xx, (1u).xx, (1u).xx);
uint2 res = (1u).xx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_7706d7() {
uint2 res = clamp((1u).xx, (1u).xx, (1u).xx);
uint2 res = (1u).xx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_7706d7() {
uvec2 res = clamp(uvec2(1u), uvec2(1u), uvec2(1u));
uvec2 res = uvec2(1u);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_7706d7() {
uvec2 res = clamp(uvec2(1u), uvec2(1u), uvec2(1u));
uvec2 res = uvec2(1u);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_7706d7() {
uvec2 res = clamp(uvec2(1u), uvec2(1u), uvec2(1u));
uvec2 res = uvec2(1u);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_7706d7() {
uint2 res = clamp(uint2(1u), uint2(1u), uint2(1u));
uint2 res = uint2(1u);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; 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"
@ -34,37 +33,36 @@
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%18 = OpConstantComposite %v2uint %uint_1 %uint_1
%16 = OpConstantComposite %v2uint %uint_1 %uint_1
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%21 = OpConstantNull %v2uint
%22 = OpTypeFunction %v4float
%19 = OpConstantNull %v2uint
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_7706d7 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %21
%13 = OpExtInst %v2uint %16 UClamp %18 %18 %18
OpStore %res %13
%res = OpVariable %_ptr_Function_v2uint Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_7706d7
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_7706d7
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
%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
%31 = OpLabel
%32 = OpFunctionCall %void %clamp_7706d7
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_7706d7
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%34 = OpLabel
%35 = OpFunctionCall %void %clamp_7706d7
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_7706d7
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void clamp_867397() {
float3 res = clamp((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
float3 res = (1.0f).xxx;
}
struct tint_symbol {

View File

@ -1,5 +1,5 @@
void clamp_867397() {
float3 res = clamp((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
float3 res = (1.0f).xxx;
}
struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es
void clamp_867397() {
vec3 res = clamp(vec3(1.0f), vec3(1.0f), vec3(1.0f));
vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float;
void clamp_867397() {
vec3 res = clamp(vec3(1.0f), vec3(1.0f), vec3(1.0f));
vec3 res = vec3(1.0f);
}
void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es
void clamp_867397() {
vec3 res = clamp(vec3(1.0f), vec3(1.0f), vec3(1.0f));
vec3 res = vec3(1.0f);
}
void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal;
void clamp_867397() {
float3 res = clamp(float3(1.0f), float3(1.0f), float3(1.0f));
float3 res = float3(1.0f);
}
struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 34
; Bound: 32
; Schema: 0
OpCapability Shader
%15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%20 = OpConstantNull %v3float
%21 = OpTypeFunction %v4float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%clamp_867397 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %20
%13 = OpExtInst %v3float %15 NClamp %17 %17 %17
OpStore %res %13
%res = OpVariable %_ptr_Function_v3float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21
%23 = OpLabel
%24 = OpFunctionCall %void %clamp_867397
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %clamp_867397
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27
%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
%29 = OpLabel
%30 = OpFunctionCall %void %clamp_867397
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_867397
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_867397
%30 = OpLabel
%31 = OpFunctionCall %void %clamp_867397
OpReturn
OpFunctionEnd

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(vec<4, fa>, vec<4, fa>, vec<4, fa>) -> vec<4, fa>
fn clamp_87df46() {
var res = clamp(vec4(1), vec4(1), vec4(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_87df46();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_87df46();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_87df46();
}

View File

@ -0,0 +1,30 @@
void clamp_87df46() {
int4 res = (1).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_87df46();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_87df46();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_87df46();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_87df46() {
int4 res = (1).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_87df46();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_87df46();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_87df46();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_87df46() {
ivec4 res = ivec4(1);
}
vec4 vertex_main() {
clamp_87df46();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_87df46() {
ivec4 res = ivec4(1);
}
void fragment_main() {
clamp_87df46();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_87df46() {
ivec4 res = ivec4(1);
}
void compute_main() {
clamp_87df46();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_87df46() {
int4 res = int4(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_87df46();
return float4(0.0f);
}
vertex tint_symbol vertex_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_87df46();
return;
}
kernel void compute_main() {
clamp_87df46();
return;
}

View File

@ -0,0 +1,68 @@
; 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 %clamp_87df46 "clamp_87df46"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%int_1 = OpConstant %int 1
%16 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%_ptr_Function_v4int = OpTypePointer Function %v4int
%19 = OpConstantNull %v4int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_87df46 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_87df46
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 %clamp_87df46
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_87df46
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn clamp_87df46() {
var res = clamp(vec4(1), vec4(1), vec4(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_87df46();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_87df46();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_87df46();
}

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(vec<3, ia>, vec<3, ia>, vec<3, ia>) -> vec<3, ia>
fn clamp_8b1eaa() {
var res = clamp(vec3(1.0), vec3(1.0), vec3(1.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_8b1eaa();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_8b1eaa();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_8b1eaa();
}

View File

@ -0,0 +1,30 @@
void clamp_8b1eaa() {
float3 res = (1.0f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_8b1eaa();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_8b1eaa();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_8b1eaa();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_8b1eaa() {
float3 res = (1.0f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_8b1eaa();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_8b1eaa();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_8b1eaa();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_8b1eaa() {
vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
clamp_8b1eaa();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_8b1eaa() {
vec3 res = vec3(1.0f);
}
void fragment_main() {
clamp_8b1eaa();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_8b1eaa() {
vec3 res = vec3(1.0f);
}
void compute_main() {
clamp_8b1eaa();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_8b1eaa() {
float3 res = float3(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_8b1eaa();
return float4(0.0f);
}
vertex tint_symbol vertex_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_8b1eaa();
return;
}
kernel void compute_main() {
clamp_8b1eaa();
return;
}

View File

@ -0,0 +1,66 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_8b1eaa "clamp_8b1eaa"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%clamp_8b1eaa = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19
%21 = OpLabel
%22 = OpFunctionCall %void %clamp_8b1eaa
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
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_8b1eaa
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %clamp_8b1eaa
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn clamp_8b1eaa() {
var res = clamp(vec3(1.0), vec3(1.0), vec3(1.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_8b1eaa();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_8b1eaa();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_8b1eaa();
}

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(ia, ia, ia) -> ia
fn clamp_96e56a() {
var res = clamp(1.0, 1.0, 1.0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_96e56a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_96e56a();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_96e56a();
}

View File

@ -0,0 +1,30 @@
void clamp_96e56a() {
float res = 1.0f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_96e56a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_96e56a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_96e56a();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_96e56a() {
float res = 1.0f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_96e56a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_96e56a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_96e56a();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_96e56a() {
float res = 1.0f;
}
vec4 vertex_main() {
clamp_96e56a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_96e56a() {
float res = 1.0f;
}
void fragment_main() {
clamp_96e56a();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_96e56a() {
float res = 1.0f;
}
void compute_main() {
clamp_96e56a();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_96e56a() {
float res = 1.0f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_96e56a();
return float4(0.0f);
}
vertex tint_symbol vertex_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_96e56a();
return;
}
kernel void compute_main() {
clamp_96e56a();
return;
}

View File

@ -0,0 +1,63 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "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_96e56a "clamp_96e56a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%16 = OpTypeFunction %v4float
%clamp_96e56a = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_1
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %clamp_96e56a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %void %clamp_96e56a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %clamp_96e56a
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn clamp_96e56a() {
var res = clamp(1.0, 1.0, 1.0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_96e56a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_96e56a();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_96e56a();
}

View File

@ -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/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn clamp(vec<2, fa>, vec<2, fa>, vec<2, fa>) -> vec<2, fa>
fn clamp_9d731c() {
var res = clamp(vec2(1), vec2(1), vec2(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
clamp_9d731c();
return vec4<f32>();
}
@fragment
fn fragment_main() {
clamp_9d731c();
}
@compute @workgroup_size(1)
fn compute_main() {
clamp_9d731c();
}

View File

@ -0,0 +1,30 @@
void clamp_9d731c() {
int2 res = (1).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_9d731c();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_9d731c();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_9d731c();
return;
}

View File

@ -0,0 +1,30 @@
void clamp_9d731c() {
int2 res = (1).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
clamp_9d731c();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const 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_9d731c();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
clamp_9d731c();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void clamp_9d731c() {
ivec2 res = ivec2(1);
}
vec4 vertex_main() {
clamp_9d731c();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_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_9d731c() {
ivec2 res = ivec2(1);
}
void fragment_main() {
clamp_9d731c();
}
void main() {
fragment_main();
return;
}
#version 310 es
void clamp_9d731c() {
ivec2 res = ivec2(1);
}
void compute_main() {
clamp_9d731c();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void clamp_9d731c() {
int2 res = int2(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
clamp_9d731c();
return float4(0.0f);
}
vertex tint_symbol vertex_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_9d731c();
return;
}
kernel void compute_main() {
clamp_9d731c();
return;
}

View File

@ -0,0 +1,68 @@
; 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 %clamp_9d731c "clamp_9d731c"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%int_1 = OpConstant %int 1
%16 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v2int = OpTypePointer Function %v2int
%19 = OpConstantNull %v2int
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%clamp_9d731c = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %20
%22 = OpLabel
%23 = OpFunctionCall %void %clamp_9d731c
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 %clamp_9d731c
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %clamp_9d731c
OpReturn
OpFunctionEnd

Some files were not shown because too many files have changed in this diff Show More