tint: const eval of dot builtin

Bug: tint:1581
Change-Id: Ie7768f8bf254509c1795207de0a1d8b07a317555
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110984
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Antonio Maiorano 2022-11-22 15:02:55 +00:00 committed by Dawn LUCI CQ
parent b2e6b7b865
commit d6d30f4256
112 changed files with 2297 additions and 506 deletions

View File

@ -445,7 +445,7 @@ fn arrayLength<T, A: access>(ptr<storage, array<T>, A>) -> u32
fn determinant<N: num, T: f32_f16>(mat<N, N, T>) -> T fn determinant<N: num, T: f32_f16>(mat<N, N, T>) -> T
fn distance<T: f32_f16>(T, T) -> T fn distance<T: f32_f16>(T, T) -> T
fn distance<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> T fn distance<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> T
fn dot<N: num, T: fiu32_f16>(vec<N, T>, vec<N, T>) -> T @const fn dot<N: num, T: fia_fiu32_f16>(vec<N, T>, vec<N, T>) -> T
fn dot4I8Packed(u32, u32) -> i32 fn dot4I8Packed(u32, u32) -> i32
fn dot4U8Packed(u32, u32) -> u32 fn dot4U8Packed(u32, u32) -> u32
@stage("fragment") fn dpdx(f32) -> f32 @stage("fragment") fn dpdx(f32) -> f32

View File

@ -2062,7 +2062,7 @@ TEST_F(ResolverBuiltinTest, Dot_Error_Scalar) {
R"(error: no matching call to dot(f32, f32) R"(error: no matching call to dot(f32, f32)
1 candidate function: 1 candidate function:
dot(vecN<T>, vecN<T>) -> T where: T is f32, i32, u32 or f16 dot(vecN<T>, vecN<T>) -> T where: T is abstract-float, abstract-int, f32, i32, u32 or f16
)"); )");
} }

View File

@ -1969,6 +1969,36 @@ ConstEval::Result ConstEval::degrees(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0]); return TransformElements(builder, ty, transform, args[0]);
} }
ConstEval::Result ConstEval::dot(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source) {
auto calculate = [&]() -> ImplResult {
auto* v1 = args[0];
auto* v2 = args[1];
auto* vec_ty = v1->Type()->As<sem::Vector>();
switch (vec_ty->Width()) {
case 2:
return Dispatch_fia_fiu32_f16(Dot2Func(source, ty), v1->Index(0), v1->Index(1),
v2->Index(0), v2->Index(1));
case 3:
return Dispatch_fia_fiu32_f16(Dot3Func(source, ty), v1->Index(0), v1->Index(1),
v1->Index(2), v2->Index(0), v2->Index(1),
v2->Index(2));
case 4:
return Dispatch_fia_fiu32_f16(Dot4Func(source, ty), v1->Index(0), v1->Index(1),
v1->Index(2), v1->Index(3), v2->Index(0),
v2->Index(1), v2->Index(2), v2->Index(3));
}
TINT_ICE(Resolver, builder.Diagnostics()) << "Expected scalar or vector";
return utils::Failure;
};
auto r = calculate();
if (!r) {
AddNote("when calculating dot", source);
}
return r;
}
ConstEval::Result ConstEval::extractBits(const sem::Type* ty, ConstEval::Result ConstEval::extractBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source& source) { const Source& source) {

View File

@ -539,7 +539,6 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source& source); const Source& source);
/// degrees builtin
/// @param ty the expression type /// @param ty the expression type
/// @param args the input arguments /// @param args the input arguments
/// @param source the source location of the conversion /// @param source the source location of the conversion
@ -548,6 +547,15 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source& source); const Source& source);
/// dot builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
Result dot(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// extractBits builtin /// extractBits builtin
/// @param ty the expression type /// @param ty the expression type
/// @param args the input arguments /// @param args the input arguments

View File

@ -792,10 +792,60 @@ INSTANTIATE_TEST_SUITE_P( //
ResolverConstEvalBuiltinTest, ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kCross), testing::Combine(testing::Values(sem::BuiltinType::kCross),
testing::ValuesIn(Concat(CrossCases<AFloat>(), // testing::ValuesIn(Concat(CrossCases<AFloat>(), //
CrossCases<f32>(), CrossCases<f32>(), //
CrossCases<f32>(), //
CrossCases<f16>())))); CrossCases<f16>()))));
template <typename T>
std::vector<Case> DotCases() {
auto r = std::vector<Case>{
C({Vec(T(0), T(0)), Vec(T(0), T(0))}, Val(T(0))),
C({Vec(T(0), T(0), T(0)), Vec(T(0), T(0), T(0))}, Val(T(0))),
C({Vec(T(0), T(0), T(0), T(0)), Vec(T(0), T(0), T(0), T(0))}, Val(T(0))),
C({Vec(T(1), T(2), T(3), T(4)), Vec(T(5), T(6), T(7), T(8))}, Val(T(70))),
C({Vec(T(1), T(1)), Vec(T(1), T(1))}, Val(T(2))),
C({Vec(T(1), T(2)), Vec(T(2), T(1))}, Val(T(4))),
C({Vec(T(2), T(2)), Vec(T(2), T(2))}, Val(T(8))),
C({Vec(T::Highest(), T::Highest()), Vec(T(1), T(0))}, Val(T::Highest())),
C({Vec(T::Lowest(), T::Lowest()), Vec(T(1), T(0))}, Val(T::Lowest())),
};
if constexpr (IsAbstract<T> || IsFloatingPoint<T>) {
auto error_msg = [](auto a, const char* op, auto b) {
return "12:34 error: " + OverflowErrorMessage(a, op, b) + R"(
12:34 note: when calculating dot)";
};
ConcatInto( //
r, std::vector<Case>{
E({Vec(T::Highest(), T::Highest()), Vec(T(1), T(1))},
error_msg(T::Highest(), "+", T::Highest())),
E({Vec(T::Lowest(), T::Lowest()), Vec(T(1), T(1))},
error_msg(T::Lowest(), "+", T::Lowest())),
});
} else {
// Overflow is not an error for concrete integrals
ConcatInto( //
r, std::vector<Case>{
C({Vec(T::Highest(), T::Highest()), Vec(T(1), T(1))},
Val(Add(T::Highest(), T::Highest()))),
C({Vec(T::Lowest(), T::Lowest()), Vec(T(1), T(1))},
Val(Add(T::Lowest(), T::Lowest()))),
});
}
return r;
}
INSTANTIATE_TEST_SUITE_P( //
Dot,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kDot),
testing::ValuesIn(Concat(DotCases<AInt>(), //
DotCases<i32>(), //
DotCases<u32>(), //
DotCases<AFloat>(), //
DotCases<f32>(), //
DotCases<f16>()))));
template <typename T> template <typename T>
std::vector<Case> FirstLeadingBitCases() { std::vector<Case> FirstLeadingBitCases() {
using B = BitValues<T>; using B = BitValues<T>;

View File

@ -107,6 +107,19 @@ inline constexpr Number<T> Mul(Number<T> v1, Number<T> v2) {
} }
TINT_END_DISABLE_WARNING(CONSTANT_OVERFLOW); TINT_END_DISABLE_WARNING(CONSTANT_OVERFLOW);
TINT_BEGIN_DISABLE_WARNING(CONSTANT_OVERFLOW);
template <typename T>
inline constexpr Number<T> Add(Number<T> v1, Number<T> v2) {
if constexpr (std::is_integral_v<T> && std::is_signed_v<T>) {
// For signed integrals, avoid C++ UB by adding as unsigned
using UT = std::make_unsigned_t<T>;
return static_cast<Number<T>>(static_cast<UT>(v1) + static_cast<UT>(v2));
} else {
return static_cast<Number<T>>(v1 + v2);
}
}
TINT_END_DISABLE_WARNING(CONSTANT_OVERFLOW);
// Concats any number of std::vectors // Concats any number of std::vectors
template <typename Vec, typename... Vecs> template <typename Vec, typename... Vecs>
[[nodiscard]] inline auto Concat(Vec&& v1, Vecs&&... vs) { [[nodiscard]] inline auto Concat(Vec&& v1, Vecs&&... vs) {

View File

@ -8209,22 +8209,22 @@ constexpr TemplateTypeInfo kTemplateTypes[] = {
{ {
/* [27] */ /* [27] */
/* name */ "T", /* name */ "T",
/* matcher index */ 65, /* matcher index */ 52,
}, },
{ {
/* [28] */ /* [28] */
/* name */ "T", /* name */ "T",
/* matcher index */ 52, /* matcher index */ 64,
}, },
{ {
/* [29] */ /* [29] */
/* name */ "T", /* name */ "T",
/* matcher index */ 64, /* matcher index */ 60,
}, },
{ {
/* [30] */ /* [30] */
/* name */ "T", /* name */ "T",
/* matcher index */ 60, /* matcher index */ 65,
}, },
{ {
/* [31] */ /* [31] */
@ -8838,7 +8838,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[982], /* parameters */ &kParameters[982],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8850,7 +8850,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[983], /* parameters */ &kParameters[983],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8862,7 +8862,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 4, /* num parameters */ 4,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[427], /* parameters */ &kParameters[427],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8874,7 +8874,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[576], /* parameters */ &kParameters[576],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8886,7 +8886,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[579], /* parameters */ &kParameters[579],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8898,7 +8898,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[582], /* parameters */ &kParameters[582],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8910,7 +8910,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[792], /* parameters */ &kParameters[792],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8922,7 +8922,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[794], /* parameters */ &kParameters[794],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -8934,7 +8934,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[796], /* parameters */ &kParameters[796],
/* return matcher indices */ &kMatcherIndices[130], /* return matcher indices */ &kMatcherIndices[130],
@ -9474,7 +9474,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[975], /* parameters */ &kParameters[975],
/* return matcher indices */ &kMatcherIndices[102], /* return matcher indices */ &kMatcherIndices[102],
@ -9486,7 +9486,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[976], /* parameters */ &kParameters[976],
/* return matcher indices */ &kMatcherIndices[102], /* return matcher indices */ &kMatcherIndices[102],
@ -9498,7 +9498,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[573], /* parameters */ &kParameters[573],
/* return matcher indices */ &kMatcherIndices[102], /* return matcher indices */ &kMatcherIndices[102],
@ -9510,7 +9510,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[788], /* parameters */ &kParameters[788],
/* return matcher indices */ &kMatcherIndices[102], /* return matcher indices */ &kMatcherIndices[102],
@ -9522,7 +9522,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[790], /* parameters */ &kParameters[790],
/* return matcher indices */ &kMatcherIndices[102], /* return matcher indices */ &kMatcherIndices[102],
@ -9942,7 +9942,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[968], /* parameters */ &kParameters[968],
/* return matcher indices */ &kMatcherIndices[150], /* return matcher indices */ &kMatcherIndices[150],
@ -9954,7 +9954,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[969], /* parameters */ &kParameters[969],
/* return matcher indices */ &kMatcherIndices[150], /* return matcher indices */ &kMatcherIndices[150],
@ -9966,7 +9966,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[786], /* parameters */ &kParameters[786],
/* return matcher indices */ &kMatcherIndices[150], /* return matcher indices */ &kMatcherIndices[150],
@ -11322,7 +11322,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[27], /* template types */ &kTemplateTypes[30],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[718], /* parameters */ &kParameters[718],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -11334,7 +11334,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[27], /* template types */ &kTemplateTypes[30],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[720], /* parameters */ &kParameters[720],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -11346,7 +11346,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[27], /* template types */ &kTemplateTypes[30],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[722], /* parameters */ &kParameters[722],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -11358,7 +11358,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[27], /* template types */ &kTemplateTypes[30],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[724], /* parameters */ &kParameters[724],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -11394,7 +11394,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[734], /* parameters */ &kParameters[734],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -11406,7 +11406,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[736], /* parameters */ &kParameters[736],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -11442,7 +11442,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[742], /* parameters */ &kParameters[742],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -11454,7 +11454,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[744], /* parameters */ &kParameters[744],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -11550,7 +11550,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[480], /* parameters */ &kParameters[480],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -11562,7 +11562,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[483], /* parameters */ &kParameters[483],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -11574,7 +11574,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 3, /* num parameters */ 3,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[486], /* parameters */ &kParameters[486],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -13302,7 +13302,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[954], /* parameters */ &kParameters[954],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -13314,7 +13314,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[955], /* parameters */ &kParameters[955],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -13326,7 +13326,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[30], /* template types */ &kTemplateTypes[29],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[956], /* parameters */ &kParameters[956],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -13338,7 +13338,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[30], /* template types */ &kTemplateTypes[29],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[957], /* parameters */ &kParameters[957],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -13350,7 +13350,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[726], /* parameters */ &kParameters[726],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
@ -13362,7 +13362,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[29], /* template types */ &kTemplateTypes[28],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[728], /* parameters */ &kParameters[728],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
@ -13374,7 +13374,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[750], /* parameters */ &kParameters[750],
/* return matcher indices */ &kMatcherIndices[35], /* return matcher indices */ &kMatcherIndices[35],
@ -13386,7 +13386,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[752], /* parameters */ &kParameters[752],
/* return matcher indices */ &kMatcherIndices[33], /* return matcher indices */ &kMatcherIndices[33],
@ -13398,7 +13398,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[754], /* parameters */ &kParameters[754],
/* return matcher indices */ &kMatcherIndices[35], /* return matcher indices */ &kMatcherIndices[35],
@ -13410,7 +13410,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[28], /* template types */ &kTemplateTypes[27],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[756], /* parameters */ &kParameters[756],
/* return matcher indices */ &kMatcherIndices[33], /* return matcher indices */ &kMatcherIndices[33],
@ -13506,7 +13506,7 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[27], /* template types */ &kTemplateTypes[30],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[772], /* parameters */ &kParameters[772],
/* return matcher indices */ &kMatcherIndices[33], /* return matcher indices */ &kMatcherIndices[33],
@ -13578,12 +13578,12 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 2, /* num parameters */ 2,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[27], /* template types */ &kTemplateTypes[22],
/* template numbers */ &kTemplateNumbers[4], /* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[604], /* parameters */ &kParameters[604],
/* return matcher indices */ &kMatcherIndices[3], /* return matcher indices */ &kMatcherIndices[3],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr, /* const eval */ &ConstEval::dot,
}, },
{ {
/* [439] */ /* [439] */
@ -14137,7 +14137,7 @@ constexpr IntrinsicInfo kBuiltins[] = {
}, },
{ {
/* [22] */ /* [22] */
/* fn dot<N : num, T : fiu32_f16>(vec<N, T>, vec<N, T>) -> T */ /* fn dot<N : num, T : fia_fiu32_f16>(vec<N, T>, vec<N, T>) -> T */
/* num overloads */ 1, /* num overloads */ 1,
/* overloads */ &kOverloads[438], /* overloads */ &kOverloads[438],
}, },

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 dot(vec<4, fa>, vec<4, fa>) -> fa
fn dot_08eb56() {
var res = dot(vec4(1.), vec4(1.));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
dot_08eb56();
return vec4<f32>();
}
@fragment
fn fragment_main() {
dot_08eb56();
}
@compute @workgroup_size(1)
fn compute_main() {
dot_08eb56();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void dot_08eb56() {
float res = 4.0f;
}
vec4 vertex_main() {
dot_08eb56();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void dot_08eb56() {
float res = 4.0f;
}
void fragment_main() {
dot_08eb56();
}
void main() {
fragment_main();
return;
}
#version 310 es
void dot_08eb56() {
float res = 4.0f;
}
void compute_main() {
dot_08eb56();
}
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 dot_08eb56() {
float res = 4.0f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
dot_08eb56();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
dot_08eb56();
return;
}
kernel void compute_main() {
dot_08eb56();
return;
}

View File

@ -0,0 +1,64 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %dot_08eb56 "dot_08eb56"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_4 = OpConstant %float 4
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_08eb56 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_4
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %dot_08eb56
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %void %dot_08eb56
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %dot_08eb56
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void dot_0c577b() { void dot_0c577b() {
float res = dot((1.0f).xxxx, (1.0f).xxxx); float res = 4.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_0c577b() { void dot_0c577b() {
float res = dot((1.0f).xxxx, (1.0f).xxxx); float res = 4.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void dot_0c577b() { void dot_0c577b() {
float res = dot(float4(1.0f), float4(1.0f)); float res = 4.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: 31 ; Bound: 30
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -30,36 +30,35 @@
%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
%float_1 = OpConstant %float 1 %float_4 = OpConstant %float 4
%15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%18 = OpTypeFunction %v4float %16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_0c577b = OpFunction %void None %9 %dot_0c577b = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8
%13 = OpDot %float %15 %15 OpStore %res %float_4
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18 %vertex_main_inner = OpFunction %v4float None %16
%20 = OpLabel %18 = OpLabel
%21 = OpFunctionCall %void %dot_0c577b %19 = OpFunctionCall %void %dot_0c577b
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%23 = OpLabel %21 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner %22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24 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
%26 = OpLabel %25 = OpLabel
%27 = OpFunctionCall %void %dot_0c577b %26 = OpFunctionCall %void %dot_0c577b
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%29 = OpLabel %28 = OpLabel
%30 = OpFunctionCall %void %dot_0c577b %29 = OpFunctionCall %void %dot_0c577b
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 dot(vec<2, fa>, vec<2, fa>) -> fa
fn dot_0d2c2e() {
var res = dot(vec2(1.), vec2(1.));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
dot_0d2c2e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
dot_0d2c2e();
}
@compute @workgroup_size(1)
fn compute_main() {
dot_0d2c2e();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void dot_0d2c2e() {
float res = 2.0f;
}
vec4 vertex_main() {
dot_0d2c2e();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void dot_0d2c2e() {
float res = 2.0f;
}
void fragment_main() {
dot_0d2c2e();
}
void main() {
fragment_main();
return;
}
#version 310 es
void dot_0d2c2e() {
float res = 2.0f;
}
void compute_main() {
dot_0d2c2e();
}
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 dot_0d2c2e() {
float res = 2.0f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
dot_0d2c2e();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
dot_0d2c2e();
return;
}
kernel void compute_main() {
dot_0d2c2e();
return;
}

View File

@ -0,0 +1,64 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %dot_0d2c2e "dot_0d2c2e"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_2 = OpConstant %float 2
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_0d2c2e = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_2
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %dot_0d2c2e
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %void %dot_0d2c2e
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %dot_0d2c2e
OpReturn
OpFunctionEnd

View File

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

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 dot(vec<2, ia>, vec<2, ia>) -> ia
fn dot_14bc63() {
var res = dot(vec2(1), vec2(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
dot_14bc63();
return vec4<f32>();
}
@fragment
fn fragment_main() {
dot_14bc63();
}
@compute @workgroup_size(1)
fn compute_main() {
dot_14bc63();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void dot_14bc63() {
int res = 2;
}
vec4 vertex_main() {
dot_14bc63();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void dot_14bc63() {
int res = 2;
}
void fragment_main() {
dot_14bc63();
}
void main() {
fragment_main();
return;
}
#version 310 es
void dot_14bc63() {
int res = 2;
}
void compute_main() {
dot_14bc63();
}
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 dot_14bc63() {
int res = 2;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
dot_14bc63();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
dot_14bc63();
return;
}
kernel void compute_main() {
dot_14bc63();
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 %dot_14bc63 "dot_14bc63"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_2 = OpConstant %int 2
%_ptr_Function_int = OpTypePointer Function %int
%17 = OpConstantNull %int
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_14bc63 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_2
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %dot_14bc63
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %dot_14bc63
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %dot_14bc63
OpReturn
OpFunctionEnd

View File

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

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 dot(vec<3, fa>, vec<3, fa>) -> fa
fn dot_5a4c8f() {
var res = dot(vec3(1.), vec3(1.));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
dot_5a4c8f();
return vec4<f32>();
}
@fragment
fn fragment_main() {
dot_5a4c8f();
}
@compute @workgroup_size(1)
fn compute_main() {
dot_5a4c8f();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void dot_5a4c8f() {
float res = 3.0f;
}
vec4 vertex_main() {
dot_5a4c8f();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void dot_5a4c8f() {
float res = 3.0f;
}
void fragment_main() {
dot_5a4c8f();
}
void main() {
fragment_main();
return;
}
#version 310 es
void dot_5a4c8f() {
float res = 3.0f;
}
void compute_main() {
dot_5a4c8f();
}
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 dot_5a4c8f() {
float res = 3.0f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
dot_5a4c8f();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
dot_5a4c8f();
return;
}
kernel void compute_main() {
dot_5a4c8f();
return;
}

View File

@ -0,0 +1,64 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %dot_5a4c8f "dot_5a4c8f"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_3 = OpConstant %float 3
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_5a4c8f = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_3
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %dot_5a4c8f
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%21 = OpLabel
%22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%25 = OpLabel
%26 = OpFunctionCall %void %dot_5a4c8f
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %dot_5a4c8f
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void dot_7548a0() { void dot_7548a0() {
uint res = dot((1u).xxx, (1u).xxx); uint res = 3u;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_7548a0() { void dot_7548a0() {
uint res = dot((1u).xxx, (1u).xxx); uint res = 3u;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
uint tint_int_dot(uvec3 a, uvec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_7548a0() { void dot_7548a0() {
uint res = tint_int_dot(uvec3(1u), uvec3(1u)); uint res = 3u;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
uint tint_int_dot(uvec3 a, uvec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_7548a0() { void dot_7548a0() {
uint res = tint_int_dot(uvec3(1u), uvec3(1u)); uint res = 3u;
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
uint tint_int_dot(uvec3 a, uvec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_7548a0() { void dot_7548a0() {
uint res = tint_int_dot(uvec3(1u), uvec3(1u)); uint res = 3u;
} }
void compute_main() { void compute_main() {

View File

@ -1,13 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
template<typename T>
T tint_dot3(vec<T,3> a, vec<T,3> b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_7548a0() { void dot_7548a0() {
uint res = tint_dot3(uint3(1u), uint3(1u)); uint res = 3u;
} }
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: 45 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -31,49 +31,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3 %uint_3 = OpConstant %uint 3
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%30 = OpConstantNull %uint %17 = OpConstantNull %uint
%31 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_7548a0 = OpFunction %void None %9 %dot_7548a0 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %30 %res = OpVariable %_ptr_Function_uint Function %17
%18 = OpCompositeExtract %uint %17 0 OpStore %res %uint_3
%19 = OpCompositeExtract %uint %17 0
%20 = OpIMul %uint %18 %19
%21 = OpCompositeExtract %uint %17 1
%22 = OpCompositeExtract %uint %17 1
%23 = OpIMul %uint %21 %22
%24 = OpIAdd %uint %20 %23
%25 = OpCompositeExtract %uint %17 2
%26 = OpCompositeExtract %uint %17 2
%27 = OpIMul %uint %25 %26
%13 = OpIAdd %uint %24 %27
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %31 %vertex_main_inner = OpFunction %v4float None %18
%33 = OpLabel %20 = OpLabel
%34 = OpFunctionCall %void %dot_7548a0 %21 = OpFunctionCall %void %dot_7548a0
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%36 = OpLabel %23 = OpLabel
%37 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %37 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
%40 = OpLabel %27 = OpLabel
%41 = OpFunctionCall %void %dot_7548a0 %28 = OpFunctionCall %void %dot_7548a0
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%43 = OpLabel %30 = OpLabel
%44 = OpFunctionCall %void %dot_7548a0 %31 = OpFunctionCall %void %dot_7548a0
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_883f0e() { void dot_883f0e() {
float res = dot((1.0f).xx, (1.0f).xx); float res = 2.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_883f0e() { void dot_883f0e() {
float res = dot((1.0f).xx, (1.0f).xx); float res = 2.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void dot_883f0e() { void dot_883f0e() {
float res = dot(float2(1.0f), float2(1.0f)); float res = 2.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: 30
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -30,37 +30,35 @@
%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
%v2float = OpTypeVector %float 2 %float_2 = OpConstant %float 2
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%19 = OpTypeFunction %v4float %16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_883f0e = OpFunction %void None %9 %dot_883f0e = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8
%13 = OpDot %float %16 %16 OpStore %res %float_2
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 %dot_883f0e %19 = OpFunctionCall %void %dot_883f0e
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
%27 = OpLabel %25 = OpLabel
%28 = OpFunctionCall %void %dot_883f0e %26 = OpFunctionCall %void %dot_883f0e
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%30 = OpLabel %28 = OpLabel
%31 = OpFunctionCall %void %dot_883f0e %29 = OpFunctionCall %void %dot_883f0e
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_8e40f1() { void dot_8e40f1() {
float16_t res = dot((float16_t(1.0h)).xxx, (float16_t(1.0h)).xxx); float16_t res = float16_t(3.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 dot_8e40f1() { void dot_8e40f1() {
float16_t res = dot(f16vec3(1.0hf), f16vec3(1.0hf)); float16_t res = 3.0hf;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float; precision mediump float;
void dot_8e40f1() { void dot_8e40f1() {
float16_t res = dot(f16vec3(1.0hf), f16vec3(1.0hf)); float16_t res = 3.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 dot_8e40f1() { void dot_8e40f1() {
float16_t res = dot(f16vec3(1.0hf), f16vec3(1.0hf)); float16_t res = 3.0hf;
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void dot_8e40f1() { void dot_8e40f1() {
half res = dot(half3(1.0h), half3(1.0h)); half res = 3.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: 35 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -35,39 +35,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v3half = OpTypeVector %half 3 %half_0x1_8p_1 = OpConstant %half 0x1.8p+1
%half_0x1p_0 = OpConstant %half 0x1p+0
%17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_half = OpTypePointer Function %half %_ptr_Function_half = OpTypePointer Function %half
%20 = OpConstantNull %half %17 = OpConstantNull %half
%21 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_8e40f1 = OpFunction %void None %9 %dot_8e40f1 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_half Function %20 %res = OpVariable %_ptr_Function_half Function %17
%13 = OpDot %half %17 %17 OpStore %res %half_0x1_8p_1
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21 %vertex_main_inner = OpFunction %v4float None %18
%23 = OpLabel %20 = OpLabel
%24 = OpFunctionCall %void %dot_8e40f1 %21 = OpFunctionCall %void %dot_8e40f1
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%26 = OpLabel %23 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27 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
%27 = OpLabel
%28 = OpFunctionCall %void %dot_8e40f1
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel %30 = OpLabel
%31 = OpFunctionCall %void %dot_8e40f1 %31 = OpFunctionCall %void %dot_8e40f1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %dot_8e40f1
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_97c7ee() { void dot_97c7ee() {
uint res = dot((1u).xx, (1u).xx); uint res = 2u;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_97c7ee() { void dot_97c7ee() {
uint res = dot((1u).xx, (1u).xx); uint res = 2u;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
uint tint_int_dot(uvec2 a, uvec2 b) {
return a[0]*b[0] + a[1]*b[1];
}
void dot_97c7ee() { void dot_97c7ee() {
uint res = tint_int_dot(uvec2(1u), uvec2(1u)); uint res = 2u;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
uint tint_int_dot(uvec2 a, uvec2 b) {
return a[0]*b[0] + a[1]*b[1];
}
void dot_97c7ee() { void dot_97c7ee() {
uint res = tint_int_dot(uvec2(1u), uvec2(1u)); uint res = 2u;
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
uint tint_int_dot(uvec2 a, uvec2 b) {
return a[0]*b[0] + a[1]*b[1];
}
void dot_97c7ee() { void dot_97c7ee() {
uint res = tint_int_dot(uvec2(1u), uvec2(1u)); uint res = 2u;
} }
void compute_main() { void compute_main() {

View File

@ -1,13 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
template<typename T>
T tint_dot2(vec<T,2> a, vec<T,2> b) {
return a[0]*b[0] + a[1]*b[1];
}
void dot_97c7ee() { void dot_97c7ee() {
uint res = tint_dot2(uint2(1u), uint2(1u)); uint res = 2u;
} }
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: 41 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -31,45 +31,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2 %uint_2 = OpConstant %uint 2
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v2uint %uint_1 %uint_1
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%26 = OpConstantNull %uint %17 = OpConstantNull %uint
%27 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_97c7ee = OpFunction %void None %9 %dot_97c7ee = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %26 %res = OpVariable %_ptr_Function_uint Function %17
%18 = OpCompositeExtract %uint %17 0 OpStore %res %uint_2
%19 = OpCompositeExtract %uint %17 0
%20 = OpIMul %uint %18 %19
%21 = OpCompositeExtract %uint %17 1
%22 = OpCompositeExtract %uint %17 1
%23 = OpIMul %uint %21 %22
%13 = OpIAdd %uint %20 %23
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %27 %vertex_main_inner = OpFunction %v4float None %18
%29 = OpLabel %20 = OpLabel
%30 = OpFunctionCall %void %dot_97c7ee %21 = OpFunctionCall %void %dot_97c7ee
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%32 = OpLabel %23 = OpLabel
%33 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %33 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
%36 = OpLabel %27 = OpLabel
%37 = OpFunctionCall %void %dot_97c7ee %28 = OpFunctionCall %void %dot_97c7ee
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%39 = OpLabel %30 = OpLabel
%40 = OpFunctionCall %void %dot_97c7ee %31 = OpFunctionCall %void %dot_97c7ee
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_ba4246() { void dot_ba4246() {
float res = dot((1.0f).xxx, (1.0f).xxx); float res = 3.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_ba4246() { void dot_ba4246() {
float res = dot((1.0f).xxx, (1.0f).xxx); float res = 3.0f;
} }
struct tint_symbol { struct tint_symbol {

View File

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

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void dot_ba4246() { void dot_ba4246() {
float res = dot(float3(1.0f), float3(1.0f)); float res = 3.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: 30
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -30,37 +30,35 @@
%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
%v3float = OpTypeVector %float 3 %float_3 = OpConstant %float 3
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%19 = OpTypeFunction %v4float %16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_ba4246 = OpFunction %void None %9 %dot_ba4246 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8
%13 = OpDot %float %16 %16 OpStore %res %float_3
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 %dot_ba4246 %19 = OpFunctionCall %void %dot_ba4246
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
%27 = OpLabel %25 = OpLabel
%28 = OpFunctionCall %void %dot_ba4246 %26 = OpFunctionCall %void %dot_ba4246
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%30 = OpLabel %28 = OpLabel
%31 = OpFunctionCall %void %dot_ba4246 %29 = OpFunctionCall %void %dot_ba4246
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 dot(vec<3, ia>, vec<3, ia>) -> ia
fn dot_c11efe() {
var res = dot(vec3(1), vec3(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
dot_c11efe();
return vec4<f32>();
}
@fragment
fn fragment_main() {
dot_c11efe();
}
@compute @workgroup_size(1)
fn compute_main() {
dot_c11efe();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void dot_c11efe() {
int res = 3;
}
vec4 vertex_main() {
dot_c11efe();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void dot_c11efe() {
int res = 3;
}
void fragment_main() {
dot_c11efe();
}
void main() {
fragment_main();
return;
}
#version 310 es
void dot_c11efe() {
int res = 3;
}
void compute_main() {
dot_c11efe();
}
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 dot_c11efe() {
int res = 3;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
dot_c11efe();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
dot_c11efe();
return;
}
kernel void compute_main() {
dot_c11efe();
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 %dot_c11efe "dot_c11efe"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_3 = OpConstant %int 3
%_ptr_Function_int = OpTypePointer Function %int
%17 = OpConstantNull %int
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_c11efe = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_3
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %dot_c11efe
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %dot_c11efe
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %dot_c11efe
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void dot_cd5a04() { void dot_cd5a04() {
float16_t res = dot((float16_t(1.0h)).xx, (float16_t(1.0h)).xx); float16_t res = float16_t(2.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 dot_cd5a04() { void dot_cd5a04() {
float16_t res = dot(f16vec2(1.0hf), f16vec2(1.0hf)); float16_t res = 2.0hf;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float; precision mediump float;
void dot_cd5a04() { void dot_cd5a04() {
float16_t res = dot(f16vec2(1.0hf), f16vec2(1.0hf)); float16_t res = 2.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 dot_cd5a04() { void dot_cd5a04() {
float16_t res = dot(f16vec2(1.0hf), f16vec2(1.0hf)); float16_t res = 2.0hf;
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void dot_cd5a04() { void dot_cd5a04() {
half res = dot(half2(1.0h), half2(1.0h)); half res = 2.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: 35 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -35,39 +35,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v2half = OpTypeVector %half 2 %half_0x1p_1 = OpConstant %half 0x1p+1
%half_0x1p_0 = OpConstant %half 0x1p+0
%17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%_ptr_Function_half = OpTypePointer Function %half %_ptr_Function_half = OpTypePointer Function %half
%20 = OpConstantNull %half %17 = OpConstantNull %half
%21 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_cd5a04 = OpFunction %void None %9 %dot_cd5a04 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_half Function %20 %res = OpVariable %_ptr_Function_half Function %17
%13 = OpDot %half %17 %17 OpStore %res %half_0x1p_1
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21 %vertex_main_inner = OpFunction %v4float None %18
%23 = OpLabel %20 = OpLabel
%24 = OpFunctionCall %void %dot_cd5a04 %21 = OpFunctionCall %void %dot_cd5a04
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%26 = OpLabel %23 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27 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
%27 = OpLabel
%28 = OpFunctionCall %void %dot_cd5a04
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel %30 = OpLabel
%31 = OpFunctionCall %void %dot_cd5a04 %31 = OpFunctionCall %void %dot_cd5a04
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %dot_cd5a04
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_d0d179() { void dot_d0d179() {
float16_t res = dot((float16_t(1.0h)).xxxx, (float16_t(1.0h)).xxxx); float16_t res = float16_t(4.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 dot_d0d179() { void dot_d0d179() {
float16_t res = dot(f16vec4(1.0hf), f16vec4(1.0hf)); float16_t res = 4.0hf;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -23,7 +23,7 @@ void main() {
precision mediump float; precision mediump float;
void dot_d0d179() { void dot_d0d179() {
float16_t res = dot(f16vec4(1.0hf), f16vec4(1.0hf)); float16_t res = 4.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 dot_d0d179() { void dot_d0d179() {
float16_t res = dot(f16vec4(1.0hf), f16vec4(1.0hf)); float16_t res = 4.0hf;
} }
void compute_main() { void compute_main() {

View File

@ -2,7 +2,7 @@
using namespace metal; using namespace metal;
void dot_d0d179() { void dot_d0d179() {
half res = dot(half4(1.0h), half4(1.0h)); half res = 4.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: 35 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
@ -35,39 +35,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v4half = OpTypeVector %half 4 %half_0x1p_2 = OpConstant %half 0x1p+2
%half_0x1p_0 = OpConstant %half 0x1p+0
%17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_half = OpTypePointer Function %half %_ptr_Function_half = OpTypePointer Function %half
%20 = OpConstantNull %half %17 = OpConstantNull %half
%21 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_d0d179 = OpFunction %void None %9 %dot_d0d179 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_half Function %20 %res = OpVariable %_ptr_Function_half Function %17
%13 = OpDot %half %17 %17 OpStore %res %half_0x1p_2
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %21 %vertex_main_inner = OpFunction %v4float None %18
%23 = OpLabel %20 = OpLabel
%24 = OpFunctionCall %void %dot_d0d179 %21 = OpFunctionCall %void %dot_d0d179
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%26 = OpLabel %23 = OpLabel
%27 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %27 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
%27 = OpLabel
%28 = OpFunctionCall %void %dot_d0d179
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel %30 = OpLabel
%31 = OpFunctionCall %void %dot_d0d179 %31 = OpFunctionCall %void %dot_d0d179
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9
%33 = OpLabel
%34 = OpFunctionCall %void %dot_d0d179
OpReturn
OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_e994c7() { void dot_e994c7() {
uint res = dot((1u).xxxx, (1u).xxxx); uint res = 4u;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_e994c7() { void dot_e994c7() {
uint res = dot((1u).xxxx, (1u).xxxx); uint res = 4u;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
uint tint_int_dot(uvec4 a, uvec4 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_e994c7() { void dot_e994c7() {
uint res = tint_int_dot(uvec4(1u), uvec4(1u)); uint res = 4u;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
uint tint_int_dot(uvec4 a, uvec4 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_e994c7() { void dot_e994c7() {
uint res = tint_int_dot(uvec4(1u), uvec4(1u)); uint res = 4u;
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
uint tint_int_dot(uvec4 a, uvec4 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_e994c7() { void dot_e994c7() {
uint res = tint_int_dot(uvec4(1u), uvec4(1u)); uint res = 4u;
} }
void compute_main() { void compute_main() {

View File

@ -1,13 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
template<typename T>
T tint_dot4(vec<T,4> a, vec<T,4> b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_e994c7() { void dot_e994c7() {
uint res = tint_dot4(uint4(1u), uint4(1u)); uint res = 4u;
} }
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: 49 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -31,53 +31,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%uint = OpTypeInt 32 0 %uint = OpTypeInt 32 0
%v4uint = OpTypeVector %uint 4 %uint_4 = OpConstant %uint 4
%uint_1 = OpConstant %uint 1
%17 = OpConstantComposite %v4uint %uint_1 %uint_1 %uint_1 %uint_1
%_ptr_Function_uint = OpTypePointer Function %uint %_ptr_Function_uint = OpTypePointer Function %uint
%34 = OpConstantNull %uint %17 = OpConstantNull %uint
%35 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_e994c7 = OpFunction %void None %9 %dot_e994c7 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %34 %res = OpVariable %_ptr_Function_uint Function %17
%18 = OpCompositeExtract %uint %17 0 OpStore %res %uint_4
%19 = OpCompositeExtract %uint %17 0
%20 = OpIMul %uint %18 %19
%21 = OpCompositeExtract %uint %17 1
%22 = OpCompositeExtract %uint %17 1
%23 = OpIMul %uint %21 %22
%24 = OpIAdd %uint %20 %23
%25 = OpCompositeExtract %uint %17 2
%26 = OpCompositeExtract %uint %17 2
%27 = OpIMul %uint %25 %26
%28 = OpIAdd %uint %24 %27
%29 = OpCompositeExtract %uint %17 3
%30 = OpCompositeExtract %uint %17 3
%31 = OpIMul %uint %29 %30
%13 = OpIAdd %uint %28 %31
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %35 %vertex_main_inner = OpFunction %v4float None %18
%37 = OpLabel %20 = OpLabel
%38 = OpFunctionCall %void %dot_e994c7 %21 = OpFunctionCall %void %dot_e994c7
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%40 = OpLabel %23 = OpLabel
%41 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %41 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
%44 = OpLabel %27 = OpLabel
%45 = OpFunctionCall %void %dot_e994c7 %28 = OpFunctionCall %void %dot_e994c7
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%47 = OpLabel %30 = OpLabel
%48 = OpFunctionCall %void %dot_e994c7 %31 = OpFunctionCall %void %dot_e994c7
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 dot(vec<4, ia>, vec<4, ia>) -> ia
fn dot_eb9fbf() {
var res = dot(vec4(1), vec4(1));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
dot_eb9fbf();
return vec4<f32>();
}
@fragment
fn fragment_main() {
dot_eb9fbf();
}
@compute @workgroup_size(1)
fn compute_main() {
dot_eb9fbf();
}

View File

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

View File

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

View File

@ -0,0 +1,49 @@
#version 310 es
void dot_eb9fbf() {
int res = 4;
}
vec4 vertex_main() {
dot_eb9fbf();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
void dot_eb9fbf() {
int res = 4;
}
void fragment_main() {
dot_eb9fbf();
}
void main() {
fragment_main();
return;
}
#version 310 es
void dot_eb9fbf() {
int res = 4;
}
void compute_main() {
dot_eb9fbf();
}
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 dot_eb9fbf() {
int res = 4;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
dot_eb9fbf();
return float4(0.0f);
}
vertex tint_symbol vertex_main() {
float4 const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main() {
dot_eb9fbf();
return;
}
kernel void compute_main() {
dot_eb9fbf();
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 %dot_eb9fbf "dot_eb9fbf"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_4 = OpConstant %int 4
%_ptr_Function_int = OpTypePointer Function %int
%17 = OpConstantNull %int
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%dot_eb9fbf = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %17
OpStore %res %int_4
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %18
%20 = OpLabel
%21 = OpFunctionCall %void %dot_eb9fbf
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
%23 = OpLabel
%24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
%27 = OpLabel
%28 = OpFunctionCall %void %dot_eb9fbf
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%30 = OpLabel
%31 = OpFunctionCall %void %dot_eb9fbf
OpReturn
OpFunctionEnd

View File

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

View File

@ -1,5 +1,5 @@
void dot_ef6b1d() { void dot_ef6b1d() {
int res = dot((1).xxxx, (1).xxxx); int res = 4;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_ef6b1d() { void dot_ef6b1d() {
int res = dot((1).xxxx, (1).xxxx); int res = 4;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
int tint_int_dot(ivec4 a, ivec4 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_ef6b1d() { void dot_ef6b1d() {
int res = tint_int_dot(ivec4(1), ivec4(1)); int res = 4;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
int tint_int_dot(ivec4 a, ivec4 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_ef6b1d() { void dot_ef6b1d() {
int res = tint_int_dot(ivec4(1), ivec4(1)); int res = 4;
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
int tint_int_dot(ivec4 a, ivec4 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_ef6b1d() { void dot_ef6b1d() {
int res = tint_int_dot(ivec4(1), ivec4(1)); int res = 4;
} }
void compute_main() { void compute_main() {

View File

@ -1,13 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
template<typename T>
T tint_dot4(vec<T,4> a, vec<T,4> b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3];
}
void dot_ef6b1d() { void dot_ef6b1d() {
int res = tint_dot4(int4(1), int4(1)); int res = 4;
} }
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: 49 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
@ -31,53 +31,36 @@
%void = OpTypeVoid %void = OpTypeVoid
%9 = OpTypeFunction %void %9 = OpTypeFunction %void
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4 %int_4 = OpConstant %int 4
%int_1 = OpConstant %int 1
%17 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%_ptr_Function_int = OpTypePointer Function %int %_ptr_Function_int = OpTypePointer Function %int
%34 = OpConstantNull %int %17 = OpConstantNull %int
%35 = OpTypeFunction %v4float %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%dot_ef6b1d = OpFunction %void None %9 %dot_ef6b1d = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%res = OpVariable %_ptr_Function_int Function %34 %res = OpVariable %_ptr_Function_int Function %17
%18 = OpCompositeExtract %int %17 0 OpStore %res %int_4
%19 = OpCompositeExtract %int %17 0
%20 = OpIMul %int %18 %19
%21 = OpCompositeExtract %int %17 1
%22 = OpCompositeExtract %int %17 1
%23 = OpIMul %int %21 %22
%24 = OpIAdd %int %20 %23
%25 = OpCompositeExtract %int %17 2
%26 = OpCompositeExtract %int %17 2
%27 = OpIMul %int %25 %26
%28 = OpIAdd %int %24 %27
%29 = OpCompositeExtract %int %17 3
%30 = OpCompositeExtract %int %17 3
%31 = OpIMul %int %29 %30
%13 = OpIAdd %int %28 %31
OpStore %res %13
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %35 %vertex_main_inner = OpFunction %v4float None %18
%37 = OpLabel %20 = OpLabel
%38 = OpFunctionCall %void %dot_ef6b1d %21 = OpFunctionCall %void %dot_ef6b1d
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %9 %vertex_main = OpFunction %void None %9
%40 = OpLabel %23 = OpLabel
%41 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %41 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
%44 = OpLabel %27 = OpLabel
%45 = OpFunctionCall %void %dot_ef6b1d %28 = OpFunctionCall %void %dot_ef6b1d
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %9 %compute_main = OpFunction %void None %9
%47 = OpLabel %30 = OpLabel
%48 = OpFunctionCall %void %dot_ef6b1d %31 = OpFunctionCall %void %dot_ef6b1d
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
void dot_f1312c() { void dot_f1312c() {
int res = dot((1).xxx, (1).xxx); int res = 3;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,5 +1,5 @@
void dot_f1312c() { void dot_f1312c() {
int res = dot((1).xxx, (1).xxx); int res = 3;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
int tint_int_dot(ivec3 a, ivec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_f1312c() { void dot_f1312c() {
int res = tint_int_dot(ivec3(1), ivec3(1)); int res = 3;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
int tint_int_dot(ivec3 a, ivec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_f1312c() { void dot_f1312c() {
int res = tint_int_dot(ivec3(1), ivec3(1)); int res = 3;
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
int tint_int_dot(ivec3 a, ivec3 b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_f1312c() { void dot_f1312c() {
int res = tint_int_dot(ivec3(1), ivec3(1)); int res = 3;
} }
void compute_main() { void compute_main() {

View File

@ -1,13 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
template<typename T>
T tint_dot3(vec<T,3> a, vec<T,3> b) {
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
void dot_f1312c() { void dot_f1312c() {
int res = tint_dot3(int3(1), int3(1)); int res = 3;
} }
struct tint_symbol { struct tint_symbol {

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