tint: const eval of 'select' builtin

Bug: tint:1581
Change-Id: I222433acb6a30245ab319a15081811f691aca9ff
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104440
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Antonio Maiorano 2022-10-05 01:39:53 +00:00 committed by Dawn LUCI CQ
parent 44f7b8ddf7
commit 8800d885e7
374 changed files with 12808 additions and 4954 deletions

View File

@ -510,9 +510,9 @@ fn round<T: f32_f16>(T) -> T
fn round<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T> fn round<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
fn saturate<T: f32_f16>(T) -> T fn saturate<T: f32_f16>(T) -> T
fn saturate<T: f32_f16, N: num>(vec<N, T>) -> vec<N, T> fn saturate<T: f32_f16, N: num>(vec<N, T>) -> vec<N, T>
fn select<T: scalar>(T, T, bool) -> T @const("select_bool") fn select<T: abstract_or_scalar>(T, T, bool) -> T
fn select<T: scalar, N: num>(vec<N, T>, vec<N, T>, bool) -> vec<N, T> @const("select_bool") fn select<T: abstract_or_scalar, N: num>(vec<N, T>, vec<N, T>, bool) -> vec<N, T>
fn select<N: num, T: scalar>(vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T> @const("select_boolvec") fn select<N: num, T: abstract_or_scalar>(vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T>
fn sign<T: f32_f16>(T) -> T fn sign<T: f32_f16>(T) -> T
fn sign<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T> fn sign<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
fn sin<T: f32_f16>(T) -> T fn sin<T: f32_f16>(T) -> T

View File

@ -131,9 +131,9 @@ TEST_F(ResolverBuiltinTest, Select_Error_NoParams) {
R"(error: no matching call to select() R"(error: no matching call to select()
3 candidate functions: 3 candidate functions:
select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool select(T, T, bool) -> T where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
)"); )");
} }
@ -147,9 +147,9 @@ TEST_F(ResolverBuiltinTest, Select_Error_SelectorInt) {
R"(error: no matching call to select(i32, i32, i32) R"(error: no matching call to select(i32, i32, i32)
3 candidate functions: 3 candidate functions:
select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool select(T, T, bool) -> T where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
)"); )");
} }
@ -164,9 +164,9 @@ TEST_F(ResolverBuiltinTest, Select_Error_Matrix) {
R"(error: no matching call to select(mat2x2<f32>, mat2x2<f32>, bool) R"(error: no matching call to select(mat2x2<f32>, mat2x2<f32>, bool)
3 candidate functions: 3 candidate functions:
select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool select(T, T, bool) -> T where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
)"); )");
} }
@ -180,9 +180,9 @@ TEST_F(ResolverBuiltinTest, Select_Error_MismatchTypes) {
R"(error: no matching call to select(f32, vec2<f32>, bool) R"(error: no matching call to select(f32, vec2<f32>, bool)
3 candidate functions: 3 candidate functions:
select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool select(T, T, bool) -> T where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
)"); )");
} }
@ -196,9 +196,9 @@ TEST_F(ResolverBuiltinTest, Select_Error_MismatchVectorSize) {
R"(error: no matching call to select(vec2<f32>, vec3<f32>, bool) R"(error: no matching call to select(vec2<f32>, vec3<f32>, bool)
3 candidate functions: 3 candidate functions:
select(T, T, bool) -> T where: T is f32, f16, i32, u32 or bool select(T, T, bool) -> T where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, bool) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is f32, f16, i32, u32 or bool select(vecN<T>, vecN<T>, vecN<bool>) -> vecN<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
)"); )");
} }

View File

@ -503,25 +503,30 @@ const ImplConstant* CreateComposite(ProgramBuilder& builder,
} }
} }
/// TransformElements constructs a new constant of type `composite_ty` by applying the namespace detail {
/// transformation function 'f' on each of the most deeply nested elements of 'cs'. Assumes that all /// Implementation of TransformElements
/// input constants `cs` are of the same type.
template <typename F, typename... CONSTANTS> template <typename F, typename... CONSTANTS>
ImplResult TransformElements(ProgramBuilder& builder, ImplResult TransformElements(ProgramBuilder& builder,
const sem::Type* composite_ty, const sem::Type* composite_ty,
F&& f, F&& f,
size_t index,
CONSTANTS&&... cs) { CONSTANTS&&... cs) {
uint32_t n = 0; uint32_t n = 0;
auto* ty = First(cs...)->Type(); auto* ty = First(cs...)->Type();
auto* el_ty = sem::Type::ElementOf(ty, &n); auto* el_ty = sem::Type::ElementOf(ty, &n);
if (el_ty == ty) { if (el_ty == ty) {
constexpr bool kHasIndexParam = traits::IsType<size_t, traits::LastParameterType<F>>;
if constexpr (kHasIndexParam) {
return f(cs..., index);
} else {
return f(cs...); return f(cs...);
} }
}
utils::Vector<const sem::Constant*, 8> els; utils::Vector<const sem::Constant*, 8> els;
els.Reserve(n); els.Reserve(n);
for (uint32_t i = 0; i < n; i++) { for (uint32_t i = 0; i < n; i++) {
if (auto el = TransformElements(builder, sem::Type::ElementOf(composite_ty), if (auto el = detail::TransformElements(builder, sem::Type::ElementOf(composite_ty),
std::forward<F>(f), cs->Index(i)...)) { std::forward<F>(f), index + i, cs->Index(i)...)) {
els.Push(el.Get()); els.Push(el.Get());
} else { } else {
@ -530,10 +535,24 @@ ImplResult TransformElements(ProgramBuilder& builder,
} }
return CreateComposite(builder, composite_ty, std::move(els)); return CreateComposite(builder, composite_ty, std::move(els));
} }
} // namespace detail
/// TransformElements constructs a new constant of type `composite_ty` by applying the
/// transformation function `f` on each of the most deeply nested elements of 'cs'. Assumes that all
/// input constants `cs` are of the same arity (all scalars or all vectors of the same size).
/// If `f`'s last argument is a `size_t`, then the index of the most deeply nested element inside
/// the most deeply nested aggregate type will be passed in.
template <typename F, typename... CONSTANTS>
ImplResult TransformElements(ProgramBuilder& builder,
const sem::Type* composite_ty,
F&& f,
CONSTANTS&&... cs) {
return detail::TransformElements(builder, composite_ty, f, 0, cs...);
}
/// TransformBinaryElements constructs a new constant of type `composite_ty` by applying the /// TransformBinaryElements constructs a new constant of type `composite_ty` by applying the
/// transformation function 'f' on each of the most deeply nested elements of both `c0` and `c1`. /// transformation function 'f' on each of the most deeply nested elements of both `c0` and `c1`.
/// Unlike TransformElements, this function handles the constants being of different types, e.g. /// Unlike TransformElements, this function handles the constants being of different arity, e.g.
/// vector-scalar, scalar-vector. /// vector-scalar, scalar-vector.
template <typename F> template <typename F>
ImplResult TransformBinaryElements(ProgramBuilder& builder, ImplResult TransformBinaryElements(ProgramBuilder& builder,
@ -1516,6 +1535,35 @@ ConstEval::Result ConstEval::clamp(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0], args[1], args[2]); return TransformElements(builder, ty, transform, args[0], args[1], args[2]);
} }
ConstEval::Result ConstEval::select_bool(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
auto cond = args[2]->As<bool>();
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
auto create = [&](auto f, auto t) -> ImplResult {
return CreateElement(builder, sem::Type::DeepestElementOf(ty), cond ? t : f);
};
return Dispatch_fia_fiu32_f16_bool(create, c0, c1);
};
return TransformElements(builder, ty, transform, args[0], args[1]);
}
ConstEval::Result ConstEval::select_boolvec(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source&) {
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1, size_t index) {
auto create = [&](auto f, auto t) -> ImplResult {
// Get corresponding bool value at the current vector value index
auto cond = args[2]->Index(index)->As<bool>();
return CreateElement(builder, sem::Type::DeepestElementOf(ty), cond ? t : f);
};
return Dispatch_fia_fiu32_f16_bool(create, c0, c1);
};
return TransformElements(builder, ty, transform, args[0], args[1]);
}
ConstEval::Result ConstEval::Convert(const sem::Type* target_ty, ConstEval::Result ConstEval::Convert(const sem::Type* target_ty,
const sem::Constant* value, const sem::Constant* value,
const Source& source) { const Source& source) {

View File

@ -395,6 +395,24 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source& source); const Source& source);
/// select builtin with single bool third arg
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result select_bool(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// select builtin with vector of bool third arg
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
Result select_boolvec(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
private: private:
/// Adds the given error message to the diagnostics /// Adds the given error message to the diagnostics
void AddError(const std::string& msg, const Source& source) const; void AddError(const std::string& msg, const Source& source) const;

View File

@ -2879,6 +2879,7 @@ using Types = std::variant< //
Value<builder::vec3<i32>>, Value<builder::vec3<i32>>,
Value<builder::vec3<f32>>, Value<builder::vec3<f32>>,
Value<builder::vec3<f16>>, Value<builder::vec3<f16>>,
Value<builder::vec3<bool>>,
Value<builder::vec4<AInt>>, Value<builder::vec4<AInt>>,
Value<builder::vec4<AFloat>>, Value<builder::vec4<AFloat>>,
@ -2886,6 +2887,7 @@ using Types = std::variant< //
Value<builder::vec4<i32>>, Value<builder::vec4<i32>>,
Value<builder::vec4<f32>>, Value<builder::vec4<f32>>,
Value<builder::vec4<f16>>, Value<builder::vec4<f16>>,
Value<builder::vec4<bool>>,
Value<builder::mat2x2<AInt>>, Value<builder::mat2x2<AInt>>,
Value<builder::mat2x2<AFloat>>, Value<builder::mat2x2<AFloat>>,
@ -4088,7 +4090,6 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) {
} }
/// Creates a Case with Values for args and result /// Creates a Case with Values for args and result
// template <typename T>
static Case C(std::initializer_list<Types> args, Types result) { static Case C(std::initializer_list<Types> args, Types result) {
return Case{utils::Vector<Types, 8>{args}, std::move(result)}; return Case{utils::Vector<Types, 8>{args}, std::move(result)};
} }
@ -4287,6 +4288,52 @@ INSTANTIATE_TEST_SUITE_P( //
ClampCases<f32>(), ClampCases<f32>(),
ClampCases<f16>())))); ClampCases<f16>()))));
template <typename T>
std::vector<Case> SelectCases() {
return {
C({Val(T{1}), Val(T{2}), Val(false)}, Val(T{1})),
C({Val(T{1}), Val(T{2}), Val(true)}, Val(T{2})),
C({Val(T{2}), Val(T{1}), Val(false)}, Val(T{2})),
C({Val(T{2}), Val(T{1}), Val(true)}, Val(T{1})),
C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(false, false)}, Vec(T{1}, T{2})),
C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(false, true)}, Vec(T{1}, T{4})),
C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(true, false)}, Vec(T{3}, T{2})),
C({Vec(T{1}, T{2}), Vec(T{3}, T{4}), Vec(true, true)}, Vec(T{3}, T{4})),
C({Vec(T{1}, T{1}, T{2}, T{2}), //
Vec(T{2}, T{2}, T{1}, T{1}), //
Vec(false, true, false, true)}, //
Vec(T{1}, T{2}, T{2}, T{1})), //
};
}
static std::vector<Case> SelectBoolCases() {
return {
C({Val(true), Val(false), Val(false)}, Val(true)),
C({Val(true), Val(false), Val(true)}, Val(false)),
C({Val(false), Val(true), Val(true)}, Val(true)),
C({Val(false), Val(true), Val(false)}, Val(false)),
C({Vec(true, true, false, false), //
Vec(false, false, true, true), //
Vec(false, true, true, false)}, //
Vec(true, false, true, false)), //
};
}
INSTANTIATE_TEST_SUITE_P( //
Select,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kSelect),
testing::ValuesIn(Concat(SelectCases<AInt>(), //
SelectCases<i32>(),
SelectCases<u32>(),
SelectCases<AFloat>(),
SelectCases<f32>(),
SelectCases<f16>(),
SelectBoolCases()))));
} // namespace builtin } // namespace builtin
} // namespace } // namespace

File diff suppressed because it is too large Load Diff

View File

@ -527,8 +527,7 @@ TEST_F(IntrinsicTableTest, MismatchOpenSizeMatrix) {
ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call")); ASSERT_THAT(Diagnostics().str(), HasSubstr("no matching call"));
} }
// TODO(amaiorano): Enable this test when constexpr `select` is implemented. TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_ConstantEval) {
TEST_F(IntrinsicTableTest, DISABLED_MatchDifferentArgsElementType_ConstantEval) {
auto* af = create<sem::AbstractFloat>(); auto* af = create<sem::AbstractFloat>();
auto* bool_ = create<sem::Bool>(); auto* bool_ = create<sem::Bool>();
auto result = table->Lookup(BuiltinType::kSelect, utils::Vector{af, af, bool_}, auto result = table->Lookup(BuiltinType::kSelect, utils::Vector{af, af, bool_},

View File

@ -73,15 +73,24 @@ struct SignatureOf<R (C::*)(ARGS...) const> {
/// SignatureOfT is an alias to `typename SignatureOf<F>::type`. /// SignatureOfT is an alias to `typename SignatureOf<F>::type`.
template <typename F> template <typename F>
using SignatureOfT = typename SignatureOf<F>::type; using SignatureOfT = typename SignatureOf<Decay<F>>::type;
/// ParameterType is an alias to `typename SignatureOf<F>::type::parameter<N>`. /// ParameterType is an alias to `typename SignatureOf<F>::type::parameter<N>`.
template <typename F, std::size_t N> template <typename F, std::size_t N>
using ParameterType = typename SignatureOfT<F>::template parameter<N>; using ParameterType = typename SignatureOfT<Decay<F>>::template parameter<N>;
/// LastParameterType returns the type of the last parameter of `F`. `F` must have at least one
/// parameter.
template <typename F>
using LastParameterType = ParameterType<F, SignatureOfT<Decay<F>>::parameter_count - 1>;
/// ReturnType is an alias to `typename SignatureOf<F>::type::ret`. /// ReturnType is an alias to `typename SignatureOf<F>::type::ret`.
template <typename F> template <typename F>
using ReturnType = typename SignatureOfT<F>::ret; using ReturnType = typename SignatureOfT<Decay<F>>::ret;
/// Returns true iff decayed T and decayed U are the same.
template <typename T, typename U>
static constexpr bool IsType = std::is_same<Decay<T>, Decay<U>>::value;
/// IsTypeOrDerived<T, BASE> is true iff `T` is of type `BASE`, or derives from /// IsTypeOrDerived<T, BASE> is true iff `T` is of type `BASE`, or derives from
/// `BASE`. /// `BASE`.

View File

@ -356,25 +356,29 @@ TEST_F(GlslGeneratorImplTest_Builtin, Builtin_Call) {
} }
TEST_F(GlslGeneratorImplTest_Builtin, Select_Scalar) { TEST_F(GlslGeneratorImplTest_Builtin, Select_Scalar) {
auto* call = Call("select", 1_f, 2_f, true); GlobalVar("a", Expr(1_f), ast::AddressSpace::kPrivate);
GlobalVar("b", Expr(2_f), ast::AddressSpace::kPrivate);
auto* call = Call("select", "a", "b", true);
WrapInFunction(CallStmt(call)); WrapInFunction(CallStmt(call));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; std::stringstream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "(true ? 2.0f : 1.0f)"); EXPECT_EQ(out.str(), "(true ? b : a)");
} }
TEST_F(GlslGeneratorImplTest_Builtin, Select_Vector) { TEST_F(GlslGeneratorImplTest_Builtin, Select_Vector) {
auto* call = Call("select", vec2<i32>(1_i, 2_i), vec2<i32>(3_i, 4_i), vec2<bool>(true, false)); GlobalVar("a", vec2<i32>(1_i, 2_i), ast::AddressSpace::kPrivate);
GlobalVar("b", vec2<i32>(3_i, 4_i), ast::AddressSpace::kPrivate);
auto* call = Call("select", "a", "b", vec2<bool>(true, false));
WrapInFunction(CallStmt(call)); WrapInFunction(CallStmt(call));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; std::stringstream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "mix(ivec2(1, 2), ivec2(3, 4), bvec2(true, false))"); EXPECT_EQ(out.str(), "mix(a, b, bvec2(true, false))");
} }
TEST_F(GlslGeneratorImplTest_Builtin, FMA_f32) { TEST_F(GlslGeneratorImplTest_Builtin, FMA_f32) {

View File

@ -356,25 +356,29 @@ TEST_F(HlslGeneratorImplTest_Builtin, Builtin_Call) {
} }
TEST_F(HlslGeneratorImplTest_Builtin, Select_Scalar) { TEST_F(HlslGeneratorImplTest_Builtin, Select_Scalar) {
auto* call = Call("select", 1_f, 2_f, true); GlobalVar("a", Expr(1_f), ast::AddressSpace::kPrivate);
GlobalVar("b", Expr(2_f), ast::AddressSpace::kPrivate);
auto* call = Call("select", "a", "b", true);
WrapInFunction(CallStmt(call)); WrapInFunction(CallStmt(call));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; std::stringstream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "(true ? 2.0f : 1.0f)"); EXPECT_EQ(out.str(), "(true ? b : a)");
} }
TEST_F(HlslGeneratorImplTest_Builtin, Select_Vector) { TEST_F(HlslGeneratorImplTest_Builtin, Select_Vector) {
auto* call = Call("select", vec2<i32>(1_i, 2_i), vec2<i32>(3_i, 4_i), vec2<bool>(true, false)); GlobalVar("a", vec2<i32>(1_i, 2_i), ast::AddressSpace::kPrivate);
GlobalVar("b", vec2<i32>(3_i, 4_i), ast::AddressSpace::kPrivate);
auto* call = Call("select", "a", "b", vec2<bool>(true, false));
WrapInFunction(CallStmt(call)); WrapInFunction(CallStmt(call));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
gen.increment_indent(); gen.increment_indent();
std::stringstream out; std::stringstream out;
ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error(); ASSERT_TRUE(gen.EmitExpression(out, call)) << gen.error();
EXPECT_EQ(out.str(), "(bool2(true, false) ? int2(3, 4) : int2(1, 2))"); EXPECT_EQ(out.str(), "(bool2(true, false) ? b : a)");
} }
TEST_F(HlslGeneratorImplTest_Builtin, Modf_Scalar_f32) { TEST_F(HlslGeneratorImplTest_Builtin, Modf_Scalar_f32) {

View File

@ -1,5 +1,5 @@
void select_00b848() { void select_00b848() {
int2 res = ((true).xx ? (1).xx : (1).xx); int2 res = (1).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_00b848() { void select_00b848() {
int2 res = ((true).xx ? (1).xx : (1).xx); int2 res = (1).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_00b848() { void select_00b848() {
int2 res = select(int2(1), int2(1), bool2(true)); int2 res = int2(1);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 39 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -32,42 +32,37 @@
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2 %v2int = OpTypeVector %int 2
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
%true = OpConstantTrue %bool
%19 = OpConstantComposite %v2bool %true %true
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%21 = OpConstantComposite %v2int %int_1 %int_1 %16 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v2int = OpTypePointer Function %v2int %_ptr_Function_v2int = OpTypePointer Function %v2int
%24 = OpConstantNull %v2int %19 = OpConstantNull %v2int
%25 = OpTypeFunction %v4float %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_00b848 = OpFunction %void None %9 %select_00b848 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_v2int Function %24 %res = OpVariable %_ptr_Function_v2int Function %19
%13 = OpSelect %v2int %19 %21 %21 OpStore %res %16
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %25 %vertex_main_inner = OpFunction %v4float None %20
%27 = OpLabel %22 = OpLabel
%28 = OpFunctionCall %void %select_00b848 %23 = OpFunctionCall %void %select_00b848
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%30 = OpLabel %25 = OpLabel
%31 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %31 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%34 = OpLabel %29 = OpLabel
%35 = OpFunctionCall %void %select_00b848 %30 = OpFunctionCall %void %select_00b848
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%37 = OpLabel %32 = OpLabel
%38 = OpFunctionCall %void %select_00b848 %33 = OpFunctionCall %void %select_00b848
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void select_01e2cd() { void select_01e2cd() {
int3 res = ((true).xxx ? (1).xxx : (1).xxx); int3 res = (1).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_01e2cd() { void select_01e2cd() {
int3 res = ((true).xxx ? (1).xxx : (1).xxx); int3 res = (1).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_01e2cd() { void select_01e2cd() {
int3 res = select(int3(1), int3(1), bool3(true)); int3 res = int3(1);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 39 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -32,42 +32,37 @@
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3 %v3int = OpTypeVector %int 3
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
%true = OpConstantTrue %bool
%19 = OpConstantComposite %v3bool %true %true %true
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%21 = OpConstantComposite %v3int %int_1 %int_1 %int_1 %16 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v3int = OpTypePointer Function %v3int %_ptr_Function_v3int = OpTypePointer Function %v3int
%24 = OpConstantNull %v3int %19 = OpConstantNull %v3int
%25 = OpTypeFunction %v4float %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_01e2cd = OpFunction %void None %9 %select_01e2cd = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_v3int Function %24 %res = OpVariable %_ptr_Function_v3int Function %19
%13 = OpSelect %v3int %19 %21 %21 OpStore %res %16
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %25 %vertex_main_inner = OpFunction %v4float None %20
%27 = OpLabel %22 = OpLabel
%28 = OpFunctionCall %void %select_01e2cd %23 = OpFunctionCall %void %select_01e2cd
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%30 = OpLabel %25 = OpLabel
%31 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %31 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%34 = OpLabel %29 = OpLabel
%35 = OpFunctionCall %void %select_01e2cd %30 = OpFunctionCall %void %select_01e2cd
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%37 = OpLabel %32 = OpLabel
%38 = OpFunctionCall %void %select_01e2cd %33 = OpFunctionCall %void %select_01e2cd
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void select_087ea4() { void select_087ea4() {
uint4 res = (true ? (1u).xxxx : (1u).xxxx); uint4 res = (1u).xxxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_087ea4() { void select_087ea4() {
uint4 res = (true ? (1u).xxxx : (1u).xxxx); uint4 res = (1u).xxxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
void select_087ea4() { void select_087ea4() {
uvec4 res = (true ? uvec4(1u) : uvec4(1u)); uvec4 res = uvec4(1u);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float; precision mediump float;
void select_087ea4() { void select_087ea4() {
uvec4 res = (true ? uvec4(1u) : uvec4(1u)); uvec4 res = uvec4(1u);
} }
void fragment_main() { void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es #version 310 es
void select_087ea4() { void select_087ea4() {
uvec4 res = (true ? uvec4(1u) : uvec4(1u)); uvec4 res = uvec4(1u);
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_087ea4() { void select_087ea4() {
uint4 res = select(uint4(1u), uint4(1u), true); uint4 res = uint4(1u);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 42 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -32,45 +32,37 @@
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4 %v4uint = OpTypeVector %uint 4
%bool = OpTypeBool
%true = OpConstantTrue %bool
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%19 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1 %16 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4bool = OpTypePointer Function %v4bool
%23 = OpConstantNull %v4bool
%_ptr_Function_v4uint = OpTypePointer Function %v4uint %_ptr_Function_v4uint = OpTypePointer Function %v4uint
%27 = OpConstantNull %v4uint %19 = OpConstantNull %v4uint
%28 = OpTypeFunction %v4float %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_087ea4 = OpFunction %void None %9 %select_087ea4 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%21 = OpVariable %_ptr_Function_v4bool Function %23 %res = OpVariable %_ptr_Function_v4uint Function %19
%res = OpVariable %_ptr_Function_v4uint Function %27 OpStore %res %16
%24 = OpCompositeConstruct %v4bool %true %true %true %true
%13 = OpSelect %v4uint %24 %19 %19
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %28 %vertex_main_inner = OpFunction %v4float None %20
%30 = OpLabel %22 = OpLabel
%31 = OpFunctionCall %void %select_087ea4 %23 = OpFunctionCall %void %select_087ea4
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%33 = OpLabel %25 = OpLabel
%34 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %34 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%37 = OpLabel %29 = OpLabel
%38 = OpFunctionCall %void %select_087ea4 %30 = OpFunctionCall %void %select_087ea4
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%40 = OpLabel %32 = OpLabel
%41 = OpFunctionCall %void %select_087ea4 %33 = OpFunctionCall %void %select_087ea4
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn select(vec<3, fa>, vec<3, fa>, bool) -> vec<3, fa>
fn select_089657() {
var res = select(vec3(1), vec3(1), true);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
select_089657();
return vec4<f32>();
}
@fragment
fn fragment_main() {
select_089657();
}
@compute @workgroup_size(1)
fn compute_main() {
select_089657();
}

View File

@ -0,0 +1,30 @@
void select_089657() {
int3 res = (1).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_089657();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_089657();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_089657();
return;
}

View File

@ -0,0 +1,30 @@
void select_089657() {
int3 res = (1).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_089657();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_089657();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_089657();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void select_089657() {
ivec3 res = ivec3(1);
}
vec4 vertex_main() {
select_089657();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void select_089657() {
ivec3 res = ivec3(1);
}
void fragment_main() {
select_089657();
}
void main() {
fragment_main();
return;
}
#version 310 es
void select_089657() {
ivec3 res = ivec3(1);
}
void compute_main() {
select_089657();
}
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 select_089657() {
int3 res = int3(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
select_089657();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
select_089657();
return;
}
kernel void compute_main() {
select_089657();
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 %select_089657 "select_089657"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%select_089657 = 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 %select_089657
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 %select_089657
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %select_089657
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void select_10e73b() { void select_10e73b() {
float16_t res = (true ? float16_t(0.0h) : float16_t(0.0h)); float16_t res = float16_t(0.0h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
void select_10e73b() { void select_10e73b() {
float16_t res = (true ? 0.0hf : 0.0hf); float16_t res = 0.0hf;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float; precision mediump float;
void select_10e73b() { void select_10e73b() {
float16_t res = (true ? 0.0hf : 0.0hf); float16_t res = 0.0hf;
} }
void fragment_main() { void fragment_main() {
@ -38,7 +38,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
void select_10e73b() { void select_10e73b() {
float16_t res = (true ? 0.0hf : 0.0hf); float16_t res = 0.0hf;
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_10e73b() { void select_10e73b() {
half res = select(0.0h, 0.0h, true); half res = 0.0h;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 34 ; Bound: 31
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -35,38 +35,35 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%bool = OpTypeBool %14 = OpConstantNull %half
%true = OpConstantTrue %bool
%17 = OpConstantNull %half
%_ptr_Function_half = OpTypePointer Function %half %_ptr_Function_half = OpTypePointer Function %half
%20 = OpTypeFunction %v4float %17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_10e73b = OpFunction %void None %9 %select_10e73b = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_half Function %17 %res = OpVariable %_ptr_Function_half Function %14
%13 = OpSelect %half %true %17 %17 OpStore %res %14
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %20 %vertex_main_inner = OpFunction %v4float None %17
%22 = OpLabel %19 = OpLabel
%23 = OpFunctionCall %void %select_10e73b %20 = OpFunctionCall %void %select_10e73b
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%25 = OpLabel %22 = OpLabel
%26 = OpFunctionCall %v4float %vertex_main_inner %23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %26 OpStore %value %23
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%26 = OpLabel
%27 = OpFunctionCall %void %select_10e73b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel %29 = OpLabel
%30 = OpFunctionCall %void %select_10e73b %30 = OpFunctionCall %void %select_10e73b
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %select_10e73b
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn select(vec<4, fa>, vec<4, fa>, bool) -> vec<4, fa>
fn select_17441a() {
var res = select(vec4(1), vec4(1), true);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
select_17441a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
select_17441a();
}
@compute @workgroup_size(1)
fn compute_main() {
select_17441a();
}

View File

@ -0,0 +1,30 @@
void select_17441a() {
int4 res = (1).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_17441a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_17441a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_17441a();
return;
}

View File

@ -0,0 +1,30 @@
void select_17441a() {
int4 res = (1).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_17441a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_17441a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_17441a();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void select_17441a() {
ivec4 res = ivec4(1);
}
vec4 vertex_main() {
select_17441a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void select_17441a() {
ivec4 res = ivec4(1);
}
void fragment_main() {
select_17441a();
}
void main() {
fragment_main();
return;
}
#version 310 es
void select_17441a() {
ivec4 res = ivec4(1);
}
void compute_main() {
select_17441a();
}
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 select_17441a() {
int4 res = int4(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
select_17441a();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
select_17441a();
return;
}
kernel void compute_main() {
select_17441a();
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 %select_17441a "select_17441a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%select_17441a = 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 %select_17441a
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 %select_17441a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %select_17441a
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void select_1ada2a() { void select_1ada2a() {
vector<float16_t, 3> res = (true ? (float16_t(0.0h)).xxx : (float16_t(0.0h)).xxx); vector<float16_t, 3> res = (float16_t(0.0h)).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
void select_1ada2a() { void select_1ada2a() {
f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); f16vec3 res = f16vec3(0.0hf);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float; precision mediump float;
void select_1ada2a() { void select_1ada2a() {
f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); f16vec3 res = f16vec3(0.0hf);
} }
void fragment_main() { void fragment_main() {
@ -38,7 +38,7 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
void select_1ada2a() { void select_1ada2a() {
f16vec3 res = (true ? f16vec3(0.0hf) : f16vec3(0.0hf)); f16vec3 res = f16vec3(0.0hf);
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_1ada2a() { void select_1ada2a() {
half3 res = select(half3(0.0h), half3(0.0h), true); half3 res = half3(0.0h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 40 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -36,43 +36,35 @@
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v3half = OpTypeVector %half 3 %v3half = OpTypeVector %half 3
%bool = OpTypeBool %15 = OpConstantNull %v3half
%true = OpConstantTrue %bool
%18 = OpConstantNull %v3half
%v3bool = OpTypeVector %bool 3
%_ptr_Function_v3bool = OpTypePointer Function %v3bool
%22 = OpConstantNull %v3bool
%_ptr_Function_v3half = OpTypePointer Function %v3half %_ptr_Function_v3half = OpTypePointer Function %v3half
%26 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_1ada2a = OpFunction %void None %9 %select_1ada2a = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%20 = OpVariable %_ptr_Function_v3bool Function %22 %res = OpVariable %_ptr_Function_v3half Function %15
%res = OpVariable %_ptr_Function_v3half Function %18 OpStore %res %15
%23 = OpCompositeConstruct %v3bool %true %true %true
%13 = OpSelect %v3half %23 %18 %18
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %26 %vertex_main_inner = OpFunction %v4float None %18
%28 = OpLabel %20 = OpLabel
%29 = OpFunctionCall %void %select_1ada2a %21 = OpFunctionCall %void %select_1ada2a
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%31 = OpLabel %23 = OpLabel
%32 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %32 OpStore %value %24
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%35 = OpLabel %27 = OpLabel
%36 = OpFunctionCall %void %select_1ada2a %28 = OpFunctionCall %void %select_1ada2a
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%38 = OpLabel %30 = OpLabel
%39 = OpFunctionCall %void %select_1ada2a %31 = OpFunctionCall %void %select_1ada2a
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void select_1e960b() { void select_1e960b() {
uint2 res = ((true).xx ? (1u).xx : (1u).xx); uint2 res = (1u).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_1e960b() { void select_1e960b() {
uint2 res = ((true).xx ? (1u).xx : (1u).xx); uint2 res = (1u).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_1e960b() { void select_1e960b() {
uint2 res = select(uint2(1u), uint2(1u), bool2(true)); uint2 res = uint2(1u);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 39 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -32,42 +32,37 @@
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2 %v2uint = OpTypeVector %uint 2
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
%true = OpConstantTrue %bool
%19 = OpConstantComposite %v2bool %true %true
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%21 = OpConstantComposite %v2uint %uint_1 %uint_1 %16 = OpConstantComposite %v2uint %uint_1 %uint_1
%_ptr_Function_v2uint = OpTypePointer Function %v2uint %_ptr_Function_v2uint = OpTypePointer Function %v2uint
%24 = OpConstantNull %v2uint %19 = OpConstantNull %v2uint
%25 = OpTypeFunction %v4float %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_1e960b = OpFunction %void None %9 %select_1e960b = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %24 %res = OpVariable %_ptr_Function_v2uint Function %19
%13 = OpSelect %v2uint %19 %21 %21 OpStore %res %16
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %25 %vertex_main_inner = OpFunction %v4float None %20
%27 = OpLabel %22 = OpLabel
%28 = OpFunctionCall %void %select_1e960b %23 = OpFunctionCall %void %select_1e960b
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%30 = OpLabel %25 = OpLabel
%31 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %31 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%34 = OpLabel %29 = OpLabel
%35 = OpFunctionCall %void %select_1e960b %30 = OpFunctionCall %void %select_1e960b
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%37 = OpLabel %32 = OpLabel
%38 = OpFunctionCall %void %select_1e960b %33 = OpFunctionCall %void %select_1e960b
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn select(vec<2, fa>, vec<2, fa>, vec<2, bool>) -> vec<2, fa>
fn select_1f4d93() {
var res = select(vec2(1), vec2(1), vec2<bool>(true));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
select_1f4d93();
return vec4<f32>();
}
@fragment
fn fragment_main() {
select_1f4d93();
}
@compute @workgroup_size(1)
fn compute_main() {
select_1f4d93();
}

View File

@ -0,0 +1,30 @@
void select_1f4d93() {
int2 res = (1).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_1f4d93();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_1f4d93();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_1f4d93();
return;
}

View File

@ -0,0 +1,30 @@
void select_1f4d93() {
int2 res = (1).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_1f4d93();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_1f4d93();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_1f4d93();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void select_1f4d93() {
ivec2 res = ivec2(1);
}
vec4 vertex_main() {
select_1f4d93();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void select_1f4d93() {
ivec2 res = ivec2(1);
}
void fragment_main() {
select_1f4d93();
}
void main() {
fragment_main();
return;
}
#version 310 es
void select_1f4d93() {
ivec2 res = ivec2(1);
}
void compute_main() {
select_1f4d93();
}
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 select_1f4d93() {
int2 res = int2(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
select_1f4d93();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
select_1f4d93();
return;
}
kernel void compute_main() {
select_1f4d93();
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 %select_1f4d93 "select_1f4d93"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%select_1f4d93 = 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 %select_1f4d93
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 %select_1f4d93
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %select_1f4d93
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void select_266aff() { void select_266aff() {
float2 res = ((true).xx ? (1.0f).xx : (1.0f).xx); float2 res = (1.0f).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_266aff() { void select_266aff() {
float2 res = ((true).xx ? (1.0f).xx : (1.0f).xx); float2 res = (1.0f).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_266aff() { void select_266aff() {
float2 res = select(float2(1.0f), float2(1.0f), bool2(true)); float2 res = float2(1.0f);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 37 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -31,41 +31,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2 %v2float = OpTypeVector %float 2
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
%true = OpConstantTrue %bool
%18 = OpConstantComposite %v2bool %true %true
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%20 = OpConstantComposite %v2float %float_1 %float_1 %15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float
%23 = OpConstantNull %v2float %18 = OpConstantNull %v2float
%24 = OpTypeFunction %v4float %19 = OpTypeFunction %v4float
%select_266aff = OpFunction %void None %9 %select_266aff = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %23 %res = OpVariable %_ptr_Function_v2float Function %18
%13 = OpSelect %v2float %18 %20 %20 OpStore %res %15
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %24 %vertex_main_inner = OpFunction %v4float None %19
%26 = OpLabel %21 = OpLabel
%27 = OpFunctionCall %void %select_266aff %22 = OpFunctionCall %void %select_266aff
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%29 = OpLabel %24 = OpLabel
%30 = OpFunctionCall %v4float %vertex_main_inner %25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %30 OpStore %value %25
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%32 = OpLabel %27 = OpLabel
%33 = OpFunctionCall %void %select_266aff %28 = OpFunctionCall %void %select_266aff
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%35 = OpLabel %30 = OpLabel
%36 = OpFunctionCall %void %select_266aff %31 = OpFunctionCall %void %select_266aff
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void select_28a27e() { void select_28a27e() {
uint3 res = ((true).xxx ? (1u).xxx : (1u).xxx); uint3 res = (1u).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_28a27e() { void select_28a27e() {
uint3 res = ((true).xxx ? (1u).xxx : (1u).xxx); uint3 res = (1u).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_28a27e() { void select_28a27e() {
uint3 res = select(uint3(1u), uint3(1u), bool3(true)); uint3 res = uint3(1u);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 39 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -32,42 +32,37 @@
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3 %v3uint = OpTypeVector %uint 3
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
%true = OpConstantTrue %bool
%19 = OpConstantComposite %v3bool %true %true %true
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%21 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1 %16 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%_ptr_Function_v3uint = OpTypePointer Function %v3uint %_ptr_Function_v3uint = OpTypePointer Function %v3uint
%24 = OpConstantNull %v3uint %19 = OpConstantNull %v3uint
%25 = OpTypeFunction %v4float %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_28a27e = OpFunction %void None %9 %select_28a27e = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %24 %res = OpVariable %_ptr_Function_v3uint Function %19
%13 = OpSelect %v3uint %19 %21 %21 OpStore %res %16
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %25 %vertex_main_inner = OpFunction %v4float None %20
%27 = OpLabel %22 = OpLabel
%28 = OpFunctionCall %void %select_28a27e %23 = OpFunctionCall %void %select_28a27e
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%30 = OpLabel %25 = OpLabel
%31 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %31 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%34 = OpLabel %29 = OpLabel
%35 = OpFunctionCall %void %select_28a27e %30 = OpFunctionCall %void %select_28a27e
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%37 = OpLabel %32 = OpLabel
%38 = OpFunctionCall %void %select_28a27e %33 = OpFunctionCall %void %select_28a27e
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn select(vec<3, fa>, vec<3, fa>, vec<3, bool>) -> vec<3, fa>
fn select_2c96d4() {
var res = select(vec3(1), vec3(1), vec3<bool>(true));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
select_2c96d4();
return vec4<f32>();
}
@fragment
fn fragment_main() {
select_2c96d4();
}
@compute @workgroup_size(1)
fn compute_main() {
select_2c96d4();
}

View File

@ -0,0 +1,30 @@
void select_2c96d4() {
int3 res = (1).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_2c96d4();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_2c96d4();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_2c96d4();
return;
}

View File

@ -0,0 +1,30 @@
void select_2c96d4() {
int3 res = (1).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_2c96d4();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_2c96d4();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_2c96d4();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void select_2c96d4() {
ivec3 res = ivec3(1);
}
vec4 vertex_main() {
select_2c96d4();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void select_2c96d4() {
ivec3 res = ivec3(1);
}
void fragment_main() {
select_2c96d4();
}
void main() {
fragment_main();
return;
}
#version 310 es
void select_2c96d4() {
ivec3 res = ivec3(1);
}
void compute_main() {
select_2c96d4();
}
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 select_2c96d4() {
int3 res = int3(1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
select_2c96d4();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
select_2c96d4();
return;
}
kernel void compute_main() {
select_2c96d4();
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 %select_2c96d4 "select_2c96d4"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%select_2c96d4 = 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 %select_2c96d4
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 %select_2c96d4
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel
%33 = OpFunctionCall %void %select_2c96d4
OpReturn
OpFunctionEnd

View File

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

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn select(vec<2, ia>, vec<2, ia>, bool) -> vec<2, ia>
fn select_3a14be() {
var res = select(vec2(1.0), vec2(1.0), true);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
select_3a14be();
return vec4<f32>();
}
@fragment
fn fragment_main() {
select_3a14be();
}
@compute @workgroup_size(1)
fn compute_main() {
select_3a14be();
}

View File

@ -0,0 +1,30 @@
void select_3a14be() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_3a14be();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_3a14be();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_3a14be();
return;
}

View File

@ -0,0 +1,30 @@
void select_3a14be() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_3a14be();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_3a14be();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_3a14be();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void select_3a14be() {
vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
select_3a14be();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void select_3a14be() {
vec2 res = vec2(1.0f);
}
void fragment_main() {
select_3a14be();
}
void main() {
fragment_main();
return;
}
#version 310 es
void select_3a14be() {
vec2 res = vec2(1.0f);
}
void compute_main() {
select_3a14be();
}
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 select_3a14be() {
float2 res = float2(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
select_3a14be();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
select_3a14be();
return;
}
kernel void compute_main() {
select_3a14be();
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 %select_3a14be "select_3a14be"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%select_3a14be = 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 %select_3a14be
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 %select_3a14be
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %select_3a14be
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void select_3c25ce() { void select_3c25ce() {
bool3 res = (true ? (true).xxx : (true).xxx); bool3 res = (true).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_3c25ce() { void select_3c25ce() {
bool3 res = (true ? (true).xxx : (true).xxx); bool3 res = (true).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
#version 310 es #version 310 es
void select_3c25ce() { void select_3c25ce() {
bvec3 res = (true ? bvec3(true) : bvec3(true)); bvec3 res = bvec3(true);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -21,7 +21,7 @@ void main() {
precision mediump float; precision mediump float;
void select_3c25ce() { void select_3c25ce() {
bvec3 res = (true ? bvec3(true) : bvec3(true)); bvec3 res = bvec3(true);
} }
void fragment_main() { void fragment_main() {
@ -35,7 +35,7 @@ void main() {
#version 310 es #version 310 es
void select_3c25ce() { void select_3c25ce() {
bvec3 res = (true ? bvec3(true) : bvec3(true)); bvec3 res = bvec3(true);
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void select_3c25ce() { void select_3c25ce() {
bool3 res = select(bool3(true), bool3(true), true); bool3 res = bool3(true);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 37 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -33,39 +33,36 @@
%bool = OpTypeBool %bool = OpTypeBool
%v3bool = OpTypeVector %bool 3 %v3bool = OpTypeVector %bool 3
%true = OpConstantTrue %bool %true = OpConstantTrue %bool
%17 = OpConstantComposite %v3bool %true %true %true %16 = OpConstantComposite %v3bool %true %true %true
%_ptr_Function_v3bool = OpTypePointer Function %v3bool %_ptr_Function_v3bool = OpTypePointer Function %v3bool
%20 = OpConstantNull %v3bool %19 = OpConstantNull %v3bool
%23 = OpTypeFunction %v4float %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%select_3c25ce = OpFunction %void None %9 %select_3c25ce = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%18 = OpVariable %_ptr_Function_v3bool Function %20 %res = OpVariable %_ptr_Function_v3bool Function %19
%res = OpVariable %_ptr_Function_v3bool Function %20 OpStore %res %16
%21 = OpCompositeConstruct %v3bool %true %true %true
%13 = OpSelect %v3bool %21 %17 %17
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %23 %vertex_main_inner = OpFunction %v4float None %20
%25 = OpLabel %22 = OpLabel
%26 = OpFunctionCall %void %select_3c25ce %23 = OpFunctionCall %void %select_3c25ce
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%28 = OpLabel %25 = OpLabel
%29 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %29 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %select_3c25ce
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%32 = OpLabel %32 = OpLabel
%33 = OpFunctionCall %void %select_3c25ce %33 = OpFunctionCall %void %select_3c25ce
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9
%35 = OpLabel
%36 = OpFunctionCall %void %select_3c25ce
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void select_416e14() { void select_416e14() {
float res = (true ? 1.0f : 1.0f); float res = 1.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void select_416e14() { void select_416e14() {
float res = (true ? 1.0f : 1.0f); float res = 1.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

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

View File

@ -1,7 +1,7 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 32 ; Bound: 29
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -30,37 +30,34 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%bool = OpTypeBool
%true = OpConstantTrue %bool
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%19 = OpTypeFunction %v4float %16 = OpTypeFunction %v4float
%select_416e14 = OpFunction %void None %9 %select_416e14 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8
%13 = OpSelect %float %true %float_1 %float_1 OpStore %res %float_1
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %19 %vertex_main_inner = OpFunction %v4float None %16
%21 = OpLabel %18 = OpLabel
%22 = OpFunctionCall %void %select_416e14 %19 = OpFunctionCall %void %select_416e14
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%24 = OpLabel %21 = OpLabel
%25 = OpFunctionCall %v4float %vertex_main_inner %22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %25 OpStore %value %22
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %9 %fragment_main = OpFunction %void None %9
%24 = OpLabel
%25 = OpFunctionCall %void %select_416e14
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%27 = OpLabel %27 = OpLabel
%28 = OpFunctionCall %void %select_416e14 %28 = OpFunctionCall %void %select_416e14
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %select_416e14
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,43 @@
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
// fn select(vec<2, ia>, vec<2, ia>, vec<2, bool>) -> vec<2, ia>
fn select_431dfb() {
var res = select(vec2(1.0), vec2(1.0), vec2<bool>(true));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
select_431dfb();
return vec4<f32>();
}
@fragment
fn fragment_main() {
select_431dfb();
}
@compute @workgroup_size(1)
fn compute_main() {
select_431dfb();
}

View File

@ -0,0 +1,30 @@
void select_431dfb() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_431dfb();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_431dfb();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_431dfb();
return;
}

View File

@ -0,0 +1,30 @@
void select_431dfb() {
float2 res = (1.0f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
select_431dfb();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
select_431dfb();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
select_431dfb();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void select_431dfb() {
vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
select_431dfb();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void select_431dfb() {
vec2 res = vec2(1.0f);
}
void fragment_main() {
select_431dfb();
}
void main() {
fragment_main();
return;
}
#version 310 es
void select_431dfb() {
vec2 res = vec2(1.0f);
}
void compute_main() {
select_431dfb();
}
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 select_431dfb() {
float2 res = float2(1.0f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
select_431dfb();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
select_431dfb();
return;
}
kernel void compute_main() {
select_431dfb();
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 %select_431dfb "select_431dfb"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %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
%select_431dfb = 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 %select_431dfb
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 %select_431dfb
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %select_431dfb
OpReturn
OpFunctionEnd

View File

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

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