tint: remove ConstEval::current_source member and pass down source through function calls
Bug: tint:1581 Bug: tint:1751 Change-Id: I4dea92d4b67d39559ce65f45144215e56b6a3e9a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110724 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
893316014a
commit
72551392e8
|
@ -39,7 +39,6 @@
|
||||||
#include "src/tint/utils/bitcast.h"
|
#include "src/tint/utils/bitcast.h"
|
||||||
#include "src/tint/utils/compiler_macros.h"
|
#include "src/tint/utils/compiler_macros.h"
|
||||||
#include "src/tint/utils/map.h"
|
#include "src/tint/utils/map.h"
|
||||||
#include "src/tint/utils/scoped_assignment.h"
|
|
||||||
#include "src/tint/utils/transform.h"
|
#include "src/tint/utils/transform.h"
|
||||||
|
|
||||||
using namespace tint::number_suffixes; // NOLINT
|
using namespace tint::number_suffixes; // NOLINT
|
||||||
|
@ -651,13 +650,13 @@ ImplResult TransformBinaryElements(ProgramBuilder& builder,
|
||||||
ConstEval::ConstEval(ProgramBuilder& b) : builder(b) {}
|
ConstEval::ConstEval(ProgramBuilder& b) : builder(b) {}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Add(NumberT a, NumberT b) {
|
utils::Result<NumberT> ConstEval::Add(const Source& source, NumberT a, NumberT b) {
|
||||||
NumberT result;
|
NumberT result;
|
||||||
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
||||||
if (auto r = CheckedAdd(a, b)) {
|
if (auto r = CheckedAdd(a, b)) {
|
||||||
result = r->value;
|
result = r->value;
|
||||||
} else {
|
} else {
|
||||||
AddError(OverflowErrorMessage(a, "+", b), *current_source);
|
AddError(OverflowErrorMessage(a, "+", b), source);
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -677,13 +676,13 @@ utils::Result<NumberT> ConstEval::Add(NumberT a, NumberT b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Sub(NumberT a, NumberT b) {
|
utils::Result<NumberT> ConstEval::Sub(const Source& source, NumberT a, NumberT b) {
|
||||||
NumberT result;
|
NumberT result;
|
||||||
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
||||||
if (auto r = CheckedSub(a, b)) {
|
if (auto r = CheckedSub(a, b)) {
|
||||||
result = r->value;
|
result = r->value;
|
||||||
} else {
|
} else {
|
||||||
AddError(OverflowErrorMessage(a, "-", b), *current_source);
|
AddError(OverflowErrorMessage(a, "-", b), source);
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -703,7 +702,7 @@ utils::Result<NumberT> ConstEval::Sub(NumberT a, NumberT b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Mul(NumberT a, NumberT b) {
|
utils::Result<NumberT> ConstEval::Mul(const Source& source, NumberT a, NumberT b) {
|
||||||
using T = UnwrapNumber<NumberT>;
|
using T = UnwrapNumber<NumberT>;
|
||||||
NumberT result;
|
NumberT result;
|
||||||
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
||||||
|
@ -711,7 +710,7 @@ utils::Result<NumberT> ConstEval::Mul(NumberT a, NumberT b) {
|
||||||
if (auto r = CheckedMul(a, b)) {
|
if (auto r = CheckedMul(a, b)) {
|
||||||
result = r->value;
|
result = r->value;
|
||||||
} else {
|
} else {
|
||||||
AddError(OverflowErrorMessage(a, "*", b), *current_source);
|
AddError(OverflowErrorMessage(a, "*", b), source);
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -730,14 +729,14 @@ utils::Result<NumberT> ConstEval::Mul(NumberT a, NumberT b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Div(NumberT a, NumberT b) {
|
utils::Result<NumberT> ConstEval::Div(const Source& source, NumberT a, NumberT b) {
|
||||||
NumberT result;
|
NumberT result;
|
||||||
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
if constexpr (IsAbstract<NumberT> || IsFloatingPoint<NumberT>) {
|
||||||
// Check for over/underflow for abstract values
|
// Check for over/underflow for abstract values
|
||||||
if (auto r = CheckedDiv(a, b)) {
|
if (auto r = CheckedDiv(a, b)) {
|
||||||
result = r->value;
|
result = r->value;
|
||||||
} else {
|
} else {
|
||||||
AddError(OverflowErrorMessage(a, "/", b), *current_source);
|
AddError(OverflowErrorMessage(a, "/", b), source);
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -765,16 +764,20 @@ utils::Result<NumberT> ConstEval::Div(NumberT a, NumberT b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Dot2(NumberT a1, NumberT a2, NumberT b1, NumberT b2) {
|
utils::Result<NumberT> ConstEval::Dot2(const Source& source,
|
||||||
auto r1 = Mul(a1, b1);
|
NumberT a1,
|
||||||
|
NumberT a2,
|
||||||
|
NumberT b1,
|
||||||
|
NumberT b2) {
|
||||||
|
auto r1 = Mul(source, a1, b1);
|
||||||
if (!r1) {
|
if (!r1) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r2 = Mul(a2, b2);
|
auto r2 = Mul(source, a2, b2);
|
||||||
if (!r2) {
|
if (!r2) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r = Add(r1.Get(), r2.Get());
|
auto r = Add(source, r1.Get(), r2.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
|
@ -782,29 +785,30 @@ utils::Result<NumberT> ConstEval::Dot2(NumberT a1, NumberT a2, NumberT b1, Numbe
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Dot3(NumberT a1,
|
utils::Result<NumberT> ConstEval::Dot3(const Source& source,
|
||||||
|
NumberT a1,
|
||||||
NumberT a2,
|
NumberT a2,
|
||||||
NumberT a3,
|
NumberT a3,
|
||||||
NumberT b1,
|
NumberT b1,
|
||||||
NumberT b2,
|
NumberT b2,
|
||||||
NumberT b3) {
|
NumberT b3) {
|
||||||
auto r1 = Mul(a1, b1);
|
auto r1 = Mul(source, a1, b1);
|
||||||
if (!r1) {
|
if (!r1) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r2 = Mul(a2, b2);
|
auto r2 = Mul(source, a2, b2);
|
||||||
if (!r2) {
|
if (!r2) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r3 = Mul(a3, b3);
|
auto r3 = Mul(source, a3, b3);
|
||||||
if (!r3) {
|
if (!r3) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r = Add(r1.Get(), r2.Get());
|
auto r = Add(source, r1.Get(), r2.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
r = Add(r.Get(), r3.Get());
|
r = Add(source, r.Get(), r3.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
|
@ -812,7 +816,8 @@ utils::Result<NumberT> ConstEval::Dot3(NumberT a1,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Dot4(NumberT a1,
|
utils::Result<NumberT> ConstEval::Dot4(const Source& source,
|
||||||
|
NumberT a1,
|
||||||
NumberT a2,
|
NumberT a2,
|
||||||
NumberT a3,
|
NumberT a3,
|
||||||
NumberT a4,
|
NumberT a4,
|
||||||
|
@ -820,31 +825,31 @@ utils::Result<NumberT> ConstEval::Dot4(NumberT a1,
|
||||||
NumberT b2,
|
NumberT b2,
|
||||||
NumberT b3,
|
NumberT b3,
|
||||||
NumberT b4) {
|
NumberT b4) {
|
||||||
auto r1 = Mul(a1, b1);
|
auto r1 = Mul(source, a1, b1);
|
||||||
if (!r1) {
|
if (!r1) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r2 = Mul(a2, b2);
|
auto r2 = Mul(source, a2, b2);
|
||||||
if (!r2) {
|
if (!r2) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r3 = Mul(a3, b3);
|
auto r3 = Mul(source, a3, b3);
|
||||||
if (!r3) {
|
if (!r3) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r4 = Mul(a4, b4);
|
auto r4 = Mul(source, a4, b4);
|
||||||
if (!r4) {
|
if (!r4) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r = Add(r1.Get(), r2.Get());
|
auto r = Add(source, r1.Get(), r2.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
r = Add(r.Get(), r3.Get());
|
r = Add(source, r.Get(), r3.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
r = Add(r.Get(), r4.Get());
|
r = Add(source, r.Get(), r4.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
|
@ -852,16 +857,20 @@ utils::Result<NumberT> ConstEval::Dot4(NumberT a1,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Det2(NumberT a1, NumberT a2, NumberT b1, NumberT b2) {
|
utils::Result<NumberT> ConstEval::Det2(const Source& source,
|
||||||
auto r1 = Mul(a1, b2);
|
NumberT a1,
|
||||||
|
NumberT a2,
|
||||||
|
NumberT b1,
|
||||||
|
NumberT b2) {
|
||||||
|
auto r1 = Mul(source, a1, b2);
|
||||||
if (!r1) {
|
if (!r1) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r2 = Mul(b1, a2);
|
auto r2 = Mul(source, b1, a2);
|
||||||
if (!r2) {
|
if (!r2) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto r = Sub(r1.Get(), r2.Get());
|
auto r = Sub(source, r1.Get(), r2.Get());
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
|
@ -869,86 +878,86 @@ utils::Result<NumberT> ConstEval::Det2(NumberT a1, NumberT a2, NumberT b1, Numbe
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> ConstEval::Clamp(NumberT e, NumberT low, NumberT high) {
|
utils::Result<NumberT> ConstEval::Clamp(const Source&, NumberT e, NumberT low, NumberT high) {
|
||||||
return NumberT{std::min(std::max(e, low), high)};
|
return NumberT{std::min(std::max(e, low), high)};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::ClampFunc(const sem::Type* elem_ty) {
|
auto ConstEval::ClampFunc(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto e, auto low, auto high) -> ImplResult {
|
return [=](auto e, auto low, auto high) -> ImplResult {
|
||||||
if (auto r = Clamp(e, low, high)) {
|
if (auto r = Clamp(source, e, low, high)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::AddFunc(const sem::Type* elem_ty) {
|
auto ConstEval::AddFunc(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a1, auto a2) -> ImplResult {
|
return [=](auto a1, auto a2) -> ImplResult {
|
||||||
if (auto r = Add(a1, a2)) {
|
if (auto r = Add(source, a1, a2)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::SubFunc(const sem::Type* elem_ty) {
|
auto ConstEval::SubFunc(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a1, auto a2) -> ImplResult {
|
return [=](auto a1, auto a2) -> ImplResult {
|
||||||
if (auto r = Sub(a1, a2)) {
|
if (auto r = Sub(source, a1, a2)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::MulFunc(const sem::Type* elem_ty) {
|
auto ConstEval::MulFunc(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a1, auto a2) -> ImplResult {
|
return [=](auto a1, auto a2) -> ImplResult {
|
||||||
if (auto r = Mul(a1, a2)) {
|
if (auto r = Mul(source, a1, a2)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::DivFunc(const sem::Type* elem_ty) {
|
auto ConstEval::DivFunc(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a1, auto a2) -> ImplResult {
|
return [=](auto a1, auto a2) -> ImplResult {
|
||||||
if (auto r = Div(a1, a2)) {
|
if (auto r = Div(source, a1, a2)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::Dot2Func(const sem::Type* elem_ty) {
|
auto ConstEval::Dot2Func(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a1, auto a2, auto b1, auto b2) -> ImplResult {
|
return [=](auto a1, auto a2, auto b1, auto b2) -> ImplResult {
|
||||||
if (auto r = Dot2(a1, a2, b1, b2)) {
|
if (auto r = Dot2(source, a1, a2, b1, b2)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::Dot3Func(const sem::Type* elem_ty) {
|
auto ConstEval::Dot3Func(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a1, auto a2, auto a3, auto b1, auto b2, auto b3) -> ImplResult {
|
return [=](auto a1, auto a2, auto a3, auto b1, auto b2, auto b3) -> ImplResult {
|
||||||
if (auto r = Dot3(a1, a2, a3, b1, b2, b3)) {
|
if (auto r = Dot3(source, a1, a2, a3, b1, b2, b3)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::Dot4Func(const sem::Type* elem_ty) {
|
auto ConstEval::Dot4Func(const Source& source, const sem::Type* elem_ty) {
|
||||||
return
|
return
|
||||||
[=](auto a1, auto a2, auto a3, auto a4, auto b1, auto b2, auto b3, auto b4) -> ImplResult {
|
[=](auto a1, auto a2, auto a3, auto a4, auto b1, auto b2, auto b3, auto b4) -> ImplResult {
|
||||||
if (auto r = Dot4(a1, a2, a3, a4, b1, b2, b3, b4)) {
|
if (auto r = Dot4(source, a1, a2, a3, a4, b1, b2, b3, b4)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ConstEval::Det2Func(const sem::Type* elem_ty) {
|
auto ConstEval::Det2Func(const Source& source, const sem::Type* elem_ty) {
|
||||||
return [=](auto a, auto b, auto c, auto d) -> ImplResult {
|
return [=](auto a, auto b, auto c, auto d) -> ImplResult {
|
||||||
if (auto r = Det2(a, b, c, d)) {
|
if (auto r = Det2(source, a, b, c, d)) {
|
||||||
return CreateElement(builder, elem_ty, r.Get());
|
return CreateElement(builder, elem_ty, r.Get());
|
||||||
}
|
}
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
|
@ -1205,9 +1214,8 @@ ConstEval::Result ConstEval::OpNot(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpPlus(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpPlus(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
||||||
return Dispatch_fia_fiu32_f16(AddFunc(c0->Type()), c0, c1);
|
return Dispatch_fia_fiu32_f16(AddFunc(source, c0->Type()), c0, c1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
||||||
|
@ -1216,9 +1224,8 @@ ConstEval::Result ConstEval::OpPlus(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpMinus(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpMinus(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
||||||
return Dispatch_fia_fiu32_f16(SubFunc(c0->Type()), c0, c1);
|
return Dispatch_fia_fiu32_f16(SubFunc(source, c0->Type()), c0, c1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
||||||
|
@ -1227,9 +1234,8 @@ ConstEval::Result ConstEval::OpMinus(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpMultiply(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpMultiply(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
||||||
return Dispatch_fia_fiu32_f16(MulFunc(c0->Type()), c0, c1);
|
return Dispatch_fia_fiu32_f16(MulFunc(source, c0->Type()), c0, c1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
||||||
|
@ -1238,7 +1244,6 @@ ConstEval::Result ConstEval::OpMultiply(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpMultiplyMatVec(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpMultiplyMatVec(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto* mat_ty = args[0]->Type()->As<sem::Matrix>();
|
auto* mat_ty = args[0]->Type()->As<sem::Matrix>();
|
||||||
auto* vec_ty = args[1]->Type()->As<sem::Vector>();
|
auto* vec_ty = args[1]->Type()->As<sem::Vector>();
|
||||||
auto* elem_ty = vec_ty->type();
|
auto* elem_ty = vec_ty->type();
|
||||||
|
@ -1247,29 +1252,29 @@ ConstEval::Result ConstEval::OpMultiplyMatVec(const sem::Type* ty,
|
||||||
ImplResult result;
|
ImplResult result;
|
||||||
switch (mat_ty->columns()) {
|
switch (mat_ty->columns()) {
|
||||||
case 2:
|
case 2:
|
||||||
result = Dispatch_fa_f32_f16(Dot2Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot2Func(source, elem_ty), //
|
||||||
m->Index(0)->Index(row), //
|
m->Index(0)->Index(row), //
|
||||||
m->Index(1)->Index(row), //
|
m->Index(1)->Index(row), //
|
||||||
v->Index(0), //
|
v->Index(0), //
|
||||||
v->Index(1));
|
v->Index(1));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
result = Dispatch_fa_f32_f16(Dot3Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot3Func(source, elem_ty), //
|
||||||
m->Index(0)->Index(row), //
|
m->Index(0)->Index(row), //
|
||||||
m->Index(1)->Index(row), //
|
m->Index(1)->Index(row), //
|
||||||
m->Index(2)->Index(row), //
|
m->Index(2)->Index(row), //
|
||||||
v->Index(0), //
|
v->Index(0), //
|
||||||
v->Index(1), v->Index(2));
|
v->Index(1), v->Index(2));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
result = Dispatch_fa_f32_f16(Dot4Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot4Func(source, elem_ty), //
|
||||||
m->Index(0)->Index(row), //
|
m->Index(0)->Index(row), //
|
||||||
m->Index(1)->Index(row), //
|
m->Index(1)->Index(row), //
|
||||||
m->Index(2)->Index(row), //
|
m->Index(2)->Index(row), //
|
||||||
m->Index(3)->Index(row), //
|
m->Index(3)->Index(row), //
|
||||||
v->Index(0), //
|
v->Index(0), //
|
||||||
v->Index(1), //
|
v->Index(1), //
|
||||||
v->Index(2), //
|
v->Index(2), //
|
||||||
v->Index(3));
|
v->Index(3));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1289,7 +1294,6 @@ ConstEval::Result ConstEval::OpMultiplyMatVec(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpMultiplyVecMat(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpMultiplyVecMat(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto* vec_ty = args[0]->Type()->As<sem::Vector>();
|
auto* vec_ty = args[0]->Type()->As<sem::Vector>();
|
||||||
auto* mat_ty = args[1]->Type()->As<sem::Matrix>();
|
auto* mat_ty = args[1]->Type()->As<sem::Matrix>();
|
||||||
auto* elem_ty = vec_ty->type();
|
auto* elem_ty = vec_ty->type();
|
||||||
|
@ -1298,30 +1302,30 @@ ConstEval::Result ConstEval::OpMultiplyVecMat(const sem::Type* ty,
|
||||||
ImplResult result;
|
ImplResult result;
|
||||||
switch (mat_ty->rows()) {
|
switch (mat_ty->rows()) {
|
||||||
case 2:
|
case 2:
|
||||||
result = Dispatch_fa_f32_f16(Dot2Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot2Func(source, elem_ty), //
|
||||||
m->Index(col)->Index(0), //
|
m->Index(col)->Index(0), //
|
||||||
m->Index(col)->Index(1), //
|
m->Index(col)->Index(1), //
|
||||||
v->Index(0), //
|
v->Index(0), //
|
||||||
v->Index(1));
|
v->Index(1));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
result = Dispatch_fa_f32_f16(Dot3Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot3Func(source, elem_ty), //
|
||||||
m->Index(col)->Index(0), //
|
m->Index(col)->Index(0), //
|
||||||
m->Index(col)->Index(1), //
|
m->Index(col)->Index(1), //
|
||||||
m->Index(col)->Index(2),
|
m->Index(col)->Index(2),
|
||||||
v->Index(0), //
|
v->Index(0), //
|
||||||
v->Index(1), //
|
v->Index(1), //
|
||||||
v->Index(2));
|
v->Index(2));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
result = Dispatch_fa_f32_f16(Dot4Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot4Func(source, elem_ty), //
|
||||||
m->Index(col)->Index(0), //
|
m->Index(col)->Index(0), //
|
||||||
m->Index(col)->Index(1), //
|
m->Index(col)->Index(1), //
|
||||||
m->Index(col)->Index(2), //
|
m->Index(col)->Index(2), //
|
||||||
m->Index(col)->Index(3), //
|
m->Index(col)->Index(3), //
|
||||||
v->Index(0), //
|
v->Index(0), //
|
||||||
v->Index(1), //
|
v->Index(1), //
|
||||||
v->Index(2), //
|
v->Index(2), //
|
||||||
v->Index(3));
|
v->Index(3));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1341,7 +1345,6 @@ ConstEval::Result ConstEval::OpMultiplyVecMat(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpMultiplyMatMat(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpMultiplyMatMat(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto* mat1 = args[0];
|
auto* mat1 = args[0];
|
||||||
auto* mat2 = args[1];
|
auto* mat2 = args[1];
|
||||||
auto* mat1_ty = mat1->Type()->As<sem::Matrix>();
|
auto* mat1_ty = mat1->Type()->As<sem::Matrix>();
|
||||||
|
@ -1355,30 +1358,30 @@ ConstEval::Result ConstEval::OpMultiplyMatMat(const sem::Type* ty,
|
||||||
ImplResult result;
|
ImplResult result;
|
||||||
switch (mat1_ty->columns()) {
|
switch (mat1_ty->columns()) {
|
||||||
case 2:
|
case 2:
|
||||||
result = Dispatch_fa_f32_f16(Dot2Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot2Func(source, elem_ty), //
|
||||||
m1e(row, 0), //
|
m1e(row, 0), //
|
||||||
m1e(row, 1), //
|
m1e(row, 1), //
|
||||||
m2e(0, col), //
|
m2e(0, col), //
|
||||||
m2e(1, col));
|
m2e(1, col));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
result = Dispatch_fa_f32_f16(Dot3Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot3Func(source, elem_ty), //
|
||||||
m1e(row, 0), //
|
m1e(row, 0), //
|
||||||
m1e(row, 1), //
|
m1e(row, 1), //
|
||||||
m1e(row, 2), //
|
m1e(row, 2), //
|
||||||
m2e(0, col), //
|
m2e(0, col), //
|
||||||
m2e(1, col), //
|
m2e(1, col), //
|
||||||
m2e(2, col));
|
m2e(2, col));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
result = Dispatch_fa_f32_f16(Dot4Func(elem_ty), //
|
result = Dispatch_fa_f32_f16(Dot4Func(source, elem_ty), //
|
||||||
m1e(row, 0), //
|
m1e(row, 0), //
|
||||||
m1e(row, 1), //
|
m1e(row, 1), //
|
||||||
m1e(row, 2), //
|
m1e(row, 2), //
|
||||||
m1e(row, 3), //
|
m1e(row, 3), //
|
||||||
m2e(0, col), //
|
m2e(0, col), //
|
||||||
m2e(1, col), //
|
m2e(1, col), //
|
||||||
m2e(2, col), //
|
m2e(2, col), //
|
||||||
m2e(3, col));
|
m2e(3, col));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1406,9 +1409,8 @@ ConstEval::Result ConstEval::OpMultiplyMatMat(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::OpDivide(const sem::Type* ty,
|
ConstEval::Result ConstEval::OpDivide(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
|
||||||
return Dispatch_fia_fiu32_f16(DivFunc(c0->Type()), c0, c1);
|
return Dispatch_fia_fiu32_f16(DivFunc(source, c0->Type()), c0, c1);
|
||||||
};
|
};
|
||||||
|
|
||||||
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
return TransformBinaryElements(builder, ty, transform, args[0], args[1]);
|
||||||
|
@ -1803,10 +1805,10 @@ ConstEval::Result ConstEval::ceil(const sem::Type* ty,
|
||||||
|
|
||||||
ConstEval::Result ConstEval::clamp(const sem::Type* ty,
|
ConstEval::Result ConstEval::clamp(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source&) {
|
const Source& source) {
|
||||||
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1,
|
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1,
|
||||||
const sem::Constant* c2) {
|
const sem::Constant* c2) {
|
||||||
return Dispatch_fia_fiu32_f16(ClampFunc(c0->Type()), c0, c1, c2);
|
return Dispatch_fia_fiu32_f16(ClampFunc(source, c0->Type()), c0, c1, c2);
|
||||||
};
|
};
|
||||||
return TransformElements(builder, ty, transform, args[0], args[1], args[2]);
|
return TransformElements(builder, ty, transform, args[0], args[1], args[2]);
|
||||||
}
|
}
|
||||||
|
@ -1894,7 +1896,6 @@ ConstEval::Result ConstEval::countTrailingZeros(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::cross(const sem::Type* ty,
|
ConstEval::Result ConstEval::cross(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
auto* u = args[0];
|
auto* u = args[0];
|
||||||
auto* v = args[1];
|
auto* v = args[1];
|
||||||
auto* elem_ty = u->Type()->As<sem::Vector>()->type();
|
auto* elem_ty = u->Type()->As<sem::Vector>()->type();
|
||||||
|
@ -1918,15 +1919,15 @@ ConstEval::Result ConstEval::cross(const sem::Type* ty,
|
||||||
auto* v1 = v->Index(1);
|
auto* v1 = v->Index(1);
|
||||||
auto* v2 = v->Index(2);
|
auto* v2 = v->Index(2);
|
||||||
|
|
||||||
auto x = Dispatch_fa_f32_f16(Det2Func(elem_ty), u1, u2, v1, v2);
|
auto x = Dispatch_fa_f32_f16(Det2Func(source, elem_ty), u1, u2, v1, v2);
|
||||||
if (!x) {
|
if (!x) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto y = Dispatch_fa_f32_f16(Det2Func(elem_ty), v0, v2, u0, u2);
|
auto y = Dispatch_fa_f32_f16(Det2Func(source, elem_ty), v0, v2, u0, u2);
|
||||||
if (!y) {
|
if (!y) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
auto z = Dispatch_fa_f32_f16(Det2Func(elem_ty), u0, u1, v0, v1);
|
auto z = Dispatch_fa_f32_f16(Det2Func(source, elem_ty), u0, u1, v0, v1);
|
||||||
if (!z) {
|
if (!z) {
|
||||||
return utils::Failure;
|
return utils::Failure;
|
||||||
}
|
}
|
||||||
|
@ -2178,9 +2179,9 @@ ConstEval::Result ConstEval::pack2x16float(const sem::Type* ty,
|
||||||
|
|
||||||
ConstEval::Result ConstEval::pack2x16snorm(const sem::Type* ty,
|
ConstEval::Result ConstEval::pack2x16snorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source&) {
|
const Source& source) {
|
||||||
auto calc = [&](f32 val) -> u32 {
|
auto calc = [&](f32 val) -> u32 {
|
||||||
auto clamped = Clamp(val, f32(-1.0f), f32(1.0f)).Get();
|
auto clamped = Clamp(source, val, f32(-1.0f), f32(1.0f)).Get();
|
||||||
return u32(utils::Bitcast<uint16_t>(
|
return u32(utils::Bitcast<uint16_t>(
|
||||||
static_cast<int16_t>(std::floor(0.5f + (32767.0f * clamped)))));
|
static_cast<int16_t>(std::floor(0.5f + (32767.0f * clamped)))));
|
||||||
};
|
};
|
||||||
|
@ -2195,9 +2196,9 @@ ConstEval::Result ConstEval::pack2x16snorm(const sem::Type* ty,
|
||||||
|
|
||||||
ConstEval::Result ConstEval::pack2x16unorm(const sem::Type* ty,
|
ConstEval::Result ConstEval::pack2x16unorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source&) {
|
const Source& source) {
|
||||||
auto calc = [&](f32 val) -> u32 {
|
auto calc = [&](f32 val) -> u32 {
|
||||||
auto clamped = Clamp(val, f32(0.0f), f32(1.0f)).Get();
|
auto clamped = Clamp(source, val, f32(0.0f), f32(1.0f)).Get();
|
||||||
return u32{std::floor(0.5f + (65535.0f * clamped))};
|
return u32{std::floor(0.5f + (65535.0f * clamped))};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2211,9 +2212,9 @@ ConstEval::Result ConstEval::pack2x16unorm(const sem::Type* ty,
|
||||||
|
|
||||||
ConstEval::Result ConstEval::pack4x8snorm(const sem::Type* ty,
|
ConstEval::Result ConstEval::pack4x8snorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source&) {
|
const Source& source) {
|
||||||
auto calc = [&](f32 val) -> u32 {
|
auto calc = [&](f32 val) -> u32 {
|
||||||
auto clamped = Clamp(val, f32(-1.0f), f32(1.0f)).Get();
|
auto clamped = Clamp(source, val, f32(-1.0f), f32(1.0f)).Get();
|
||||||
return u32(
|
return u32(
|
||||||
utils::Bitcast<uint8_t>(static_cast<int8_t>(std::floor(0.5f + (127.0f * clamped)))));
|
utils::Bitcast<uint8_t>(static_cast<int8_t>(std::floor(0.5f + (127.0f * clamped)))));
|
||||||
};
|
};
|
||||||
|
@ -2231,9 +2232,9 @@ ConstEval::Result ConstEval::pack4x8snorm(const sem::Type* ty,
|
||||||
|
|
||||||
ConstEval::Result ConstEval::pack4x8unorm(const sem::Type* ty,
|
ConstEval::Result ConstEval::pack4x8unorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source&) {
|
const Source& source) {
|
||||||
auto calc = [&](f32 val) -> u32 {
|
auto calc = [&](f32 val) -> u32 {
|
||||||
auto clamped = Clamp(val, f32(0.0f), f32(1.0f)).Get();
|
auto clamped = Clamp(source, val, f32(0.0f), f32(1.0f)).Get();
|
||||||
return u32{std::floor(0.5f + (255.0f * clamped))};
|
return u32{std::floor(0.5f + (255.0f * clamped))};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2405,8 +2406,6 @@ ConstEval::Result ConstEval::sinh(const sem::Type* ty,
|
||||||
ConstEval::Result ConstEval::smoothstep(const sem::Type* ty,
|
ConstEval::Result ConstEval::smoothstep(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
const Source& source) {
|
const Source& source) {
|
||||||
TINT_SCOPED_ASSIGNMENT(current_source, &source);
|
|
||||||
|
|
||||||
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1,
|
auto transform = [&](const sem::Constant* c0, const sem::Constant* c1,
|
||||||
const sem::Constant* c2) {
|
const sem::Constant* c2) {
|
||||||
auto create = [&](auto low, auto high, auto x) -> ImplResult {
|
auto create = [&](auto low, auto high, auto x) -> ImplResult {
|
||||||
|
@ -2418,33 +2417,33 @@ ConstEval::Result ConstEval::smoothstep(const sem::Type* ty,
|
||||||
};
|
};
|
||||||
|
|
||||||
// t = clamp((x - low) / (high - low), 0.0, 1.0)
|
// t = clamp((x - low) / (high - low), 0.0, 1.0)
|
||||||
auto x_minus_low = Sub(x, low);
|
auto x_minus_low = Sub(source, x, low);
|
||||||
auto high_minus_low = Sub(high, low);
|
auto high_minus_low = Sub(source, high, low);
|
||||||
if (!x_minus_low || !high_minus_low) {
|
if (!x_minus_low || !high_minus_low) {
|
||||||
return err();
|
return err();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto div = Div(x_minus_low.Get(), high_minus_low.Get());
|
auto div = Div(source, x_minus_low.Get(), high_minus_low.Get());
|
||||||
if (!div) {
|
if (!div) {
|
||||||
return err();
|
return err();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto clamp = Clamp(div.Get(), NumberT(0), NumberT(1));
|
auto clamp = Clamp(source, div.Get(), NumberT(0), NumberT(1));
|
||||||
auto t = clamp.Get();
|
auto t = clamp.Get();
|
||||||
|
|
||||||
// result = t * t * (3.0 - 2.0 * t)
|
// result = t * t * (3.0 - 2.0 * t)
|
||||||
auto t_times_t = Mul(t, t);
|
auto t_times_t = Mul(source, t, t);
|
||||||
auto t_times_2 = Mul(NumberT(2), t);
|
auto t_times_2 = Mul(source, NumberT(2), t);
|
||||||
if (!t_times_t || !t_times_2) {
|
if (!t_times_t || !t_times_2) {
|
||||||
return err();
|
return err();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto three_minus_t_times_2 = Sub(NumberT(3), t_times_2.Get());
|
auto three_minus_t_times_2 = Sub(source, NumberT(3), t_times_2.Get());
|
||||||
if (!three_minus_t_times_2) {
|
if (!three_minus_t_times_2) {
|
||||||
return err();
|
return err();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = Mul(t_times_t.Get(), three_minus_t_times_2.Get());
|
auto result = Mul(source, t_times_t.Get(), three_minus_t_times_2.Get());
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return err();
|
return err();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ class ConstEval {
|
||||||
/// Convert the `value` to `target_type`
|
/// Convert the `value` to `target_type`
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param value the value being converted
|
/// @param value the value being converted
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the converted value, or null if the value cannot be calculated
|
/// @return the converted value, or null if the value cannot be calculated
|
||||||
Result Convert(const sem::Type* ty, const sem::Constant* value, const Source& source);
|
Result Convert(const sem::Type* ty, const sem::Constant* value, const Source& source);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ class ConstEval {
|
||||||
/// Type conversion
|
/// Type conversion
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the converted value, or null if the value cannot be calculated
|
/// @return the converted value, or null if the value cannot be calculated
|
||||||
Result Conv(const sem::Type* ty,
|
Result Conv(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -125,7 +125,7 @@ class ConstEval {
|
||||||
/// Zero value type initializer
|
/// Zero value type initializer
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param args the input arguments (no arguments provided)
|
/// @param args the input arguments (no arguments provided)
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result Zero(const sem::Type* ty,
|
Result Zero(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -134,7 +134,7 @@ class ConstEval {
|
||||||
/// Identity value type initializer
|
/// Identity value type initializer
|
||||||
/// @param ty the result type
|
/// @param ty the result type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result Identity(const sem::Type* ty,
|
Result Identity(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -143,7 +143,7 @@ class ConstEval {
|
||||||
/// Vector splat initializer
|
/// Vector splat initializer
|
||||||
/// @param ty the vector type
|
/// @param ty the vector type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result VecSplat(const sem::Type* ty,
|
Result VecSplat(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -152,7 +152,7 @@ class ConstEval {
|
||||||
/// Vector initializer using scalars
|
/// Vector initializer using scalars
|
||||||
/// @param ty the vector type
|
/// @param ty the vector type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result VecInitS(const sem::Type* ty,
|
Result VecInitS(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -161,7 +161,7 @@ class ConstEval {
|
||||||
/// Vector initializer using a mix of scalars and smaller vectors
|
/// Vector initializer using a mix of scalars and smaller vectors
|
||||||
/// @param ty the vector type
|
/// @param ty the vector type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result VecInitM(const sem::Type* ty,
|
Result VecInitM(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -170,7 +170,7 @@ class ConstEval {
|
||||||
/// Matrix initializer using scalar values
|
/// Matrix initializer using scalar values
|
||||||
/// @param ty the matrix type
|
/// @param ty the matrix type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result MatInitS(const sem::Type* ty,
|
Result MatInitS(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -179,7 +179,7 @@ class ConstEval {
|
||||||
/// Matrix initializer using column vectors
|
/// Matrix initializer using column vectors
|
||||||
/// @param ty the matrix type
|
/// @param ty the matrix type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the constructed value, or null if the value cannot be calculated
|
/// @return the constructed value, or null if the value cannot be calculated
|
||||||
Result MatInitV(const sem::Type* ty,
|
Result MatInitV(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -192,7 +192,7 @@ class ConstEval {
|
||||||
/// Complement operator '~'
|
/// Complement operator '~'
|
||||||
/// @param ty the integer type
|
/// @param ty the integer type
|
||||||
/// @param args the input arguments
|
/// @param args the input arguments
|
||||||
/// @param source the source location of the conversion
|
/// @param source the source location
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpComplement(const sem::Type* ty,
|
Result OpComplement(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -201,7 +201,7 @@ class ConstEval {
|
||||||
/// Unary minus operator '-'
|
/// Unary minus operator '-'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpUnaryMinus(const sem::Type* ty,
|
Result OpUnaryMinus(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -210,7 +210,7 @@ class ConstEval {
|
||||||
/// Unary not operator '!'
|
/// Unary not operator '!'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpNot(const sem::Type* ty,
|
Result OpNot(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -223,7 +223,7 @@ class ConstEval {
|
||||||
/// Plus operator '+'
|
/// Plus operator '+'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpPlus(const sem::Type* ty,
|
Result OpPlus(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -232,7 +232,7 @@ class ConstEval {
|
||||||
/// Minus operator '-'
|
/// Minus operator '-'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpMinus(const sem::Type* ty,
|
Result OpMinus(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -241,7 +241,7 @@ class ConstEval {
|
||||||
/// Multiply operator '*' for the same type on the LHS and RHS
|
/// Multiply operator '*' for the same type on the LHS and RHS
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpMultiply(const sem::Type* ty,
|
Result OpMultiply(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -250,7 +250,7 @@ class ConstEval {
|
||||||
/// Multiply operator '*' for matCxR<T> * vecC<T>
|
/// Multiply operator '*' for matCxR<T> * vecC<T>
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpMultiplyMatVec(const sem::Type* ty,
|
Result OpMultiplyMatVec(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -259,7 +259,7 @@ class ConstEval {
|
||||||
/// Multiply operator '*' for vecR<T> * matCxR<T>
|
/// Multiply operator '*' for vecR<T> * matCxR<T>
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpMultiplyVecMat(const sem::Type* ty,
|
Result OpMultiplyVecMat(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -268,7 +268,7 @@ class ConstEval {
|
||||||
/// Multiply operator '*' for matKxR<T> * matCxK<T>
|
/// Multiply operator '*' for matKxR<T> * matCxK<T>
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpMultiplyMatMat(const sem::Type* ty,
|
Result OpMultiplyMatMat(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -277,7 +277,7 @@ class ConstEval {
|
||||||
/// Divide operator '/'
|
/// Divide operator '/'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpDivide(const sem::Type* ty,
|
Result OpDivide(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -286,7 +286,7 @@ class ConstEval {
|
||||||
/// Equality operator '=='
|
/// Equality operator '=='
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpEqual(const sem::Type* ty,
|
Result OpEqual(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -295,7 +295,7 @@ class ConstEval {
|
||||||
/// Inequality operator '!='
|
/// Inequality operator '!='
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpNotEqual(const sem::Type* ty,
|
Result OpNotEqual(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -304,7 +304,7 @@ class ConstEval {
|
||||||
/// Less than operator '<'
|
/// Less than operator '<'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpLessThan(const sem::Type* ty,
|
Result OpLessThan(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -313,7 +313,7 @@ class ConstEval {
|
||||||
/// Greater than operator '>'
|
/// Greater than operator '>'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpGreaterThan(const sem::Type* ty,
|
Result OpGreaterThan(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -322,7 +322,7 @@ class ConstEval {
|
||||||
/// Less than or equal operator '<='
|
/// Less than or equal operator '<='
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpLessThanEqual(const sem::Type* ty,
|
Result OpLessThanEqual(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -331,7 +331,7 @@ class ConstEval {
|
||||||
/// Greater than or equal operator '>='
|
/// Greater than or equal operator '>='
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpGreaterThanEqual(const sem::Type* ty,
|
Result OpGreaterThanEqual(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -340,7 +340,7 @@ class ConstEval {
|
||||||
/// Bitwise and operator '&'
|
/// Bitwise and operator '&'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpAnd(const sem::Type* ty,
|
Result OpAnd(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -349,7 +349,7 @@ class ConstEval {
|
||||||
/// Bitwise or operator '|'
|
/// Bitwise or operator '|'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpOr(const sem::Type* ty,
|
Result OpOr(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -358,7 +358,7 @@ class ConstEval {
|
||||||
/// Bitwise xor operator '^'
|
/// Bitwise xor operator '^'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpXor(const sem::Type* ty,
|
Result OpXor(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -367,7 +367,7 @@ class ConstEval {
|
||||||
/// Bitwise shift left operator '<<'
|
/// Bitwise shift left operator '<<'
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result OpShiftLeft(const sem::Type* ty,
|
Result OpShiftLeft(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -380,7 +380,7 @@ class ConstEval {
|
||||||
/// abs builtin
|
/// abs 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result abs(const sem::Type* ty,
|
Result abs(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -389,7 +389,7 @@ class ConstEval {
|
||||||
/// acos builtin
|
/// acos 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result acos(const sem::Type* ty,
|
Result acos(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -398,7 +398,7 @@ class ConstEval {
|
||||||
/// acosh builtin
|
/// acosh 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result acosh(const sem::Type* ty,
|
Result acosh(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -407,7 +407,7 @@ class ConstEval {
|
||||||
/// all builtin
|
/// all 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result all(const sem::Type* ty,
|
Result all(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -416,7 +416,7 @@ class ConstEval {
|
||||||
/// any builtin
|
/// any 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result any(const sem::Type* ty,
|
Result any(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -425,7 +425,7 @@ class ConstEval {
|
||||||
/// asin builtin
|
/// asin 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result asin(const sem::Type* ty,
|
Result asin(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -434,7 +434,7 @@ class ConstEval {
|
||||||
/// asinh builtin
|
/// asinh 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result asinh(const sem::Type* ty,
|
Result asinh(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -443,7 +443,7 @@ class ConstEval {
|
||||||
/// atan builtin
|
/// atan 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result atan(const sem::Type* ty,
|
Result atan(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -452,7 +452,7 @@ class ConstEval {
|
||||||
/// atanh builtin
|
/// atanh 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result atanh(const sem::Type* ty,
|
Result atanh(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -461,7 +461,7 @@ class ConstEval {
|
||||||
/// atan2 builtin
|
/// atan2 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result atan2(const sem::Type* ty,
|
Result atan2(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -470,7 +470,7 @@ class ConstEval {
|
||||||
/// ceil builtin
|
/// ceil 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result ceil(const sem::Type* ty,
|
Result ceil(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -479,7 +479,7 @@ class ConstEval {
|
||||||
/// clamp builtin
|
/// clamp 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result clamp(const sem::Type* ty,
|
Result clamp(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -488,7 +488,7 @@ class ConstEval {
|
||||||
/// cos builtin
|
/// cos 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result cos(const sem::Type* ty,
|
Result cos(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -497,7 +497,7 @@ class ConstEval {
|
||||||
/// cosh builtin
|
/// cosh 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result cosh(const sem::Type* ty,
|
Result cosh(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -506,7 +506,7 @@ class ConstEval {
|
||||||
/// countLeadingZeros builtin
|
/// countLeadingZeros 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result countLeadingZeros(const sem::Type* ty,
|
Result countLeadingZeros(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -515,7 +515,7 @@ class ConstEval {
|
||||||
/// countOneBits builtin
|
/// countOneBits 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result countOneBits(const sem::Type* ty,
|
Result countOneBits(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -524,7 +524,7 @@ class ConstEval {
|
||||||
/// countTrailingZeros builtin
|
/// countTrailingZeros 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result countTrailingZeros(const sem::Type* ty,
|
Result countTrailingZeros(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -533,7 +533,7 @@ class ConstEval {
|
||||||
/// cross builtin
|
/// cross 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result cross(const sem::Type* ty,
|
Result cross(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -542,7 +542,7 @@ class ConstEval {
|
||||||
/// extractBits builtin
|
/// extractBits 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result extractBits(const sem::Type* ty,
|
Result extractBits(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -551,7 +551,7 @@ class ConstEval {
|
||||||
/// firstLeadingBit builtin
|
/// firstLeadingBit 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result firstLeadingBit(const sem::Type* ty,
|
Result firstLeadingBit(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -560,7 +560,7 @@ class ConstEval {
|
||||||
/// firstTrailingBit builtin
|
/// firstTrailingBit 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result firstTrailingBit(const sem::Type* ty,
|
Result firstTrailingBit(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -569,7 +569,7 @@ class ConstEval {
|
||||||
/// floor builtin
|
/// floor 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result floor(const sem::Type* ty,
|
Result floor(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -578,7 +578,7 @@ class ConstEval {
|
||||||
/// insertBits builtin
|
/// insertBits 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result insertBits(const sem::Type* ty,
|
Result insertBits(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -587,7 +587,7 @@ class ConstEval {
|
||||||
/// max builtin
|
/// max 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result max(const sem::Type* ty,
|
Result max(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -596,7 +596,7 @@ class ConstEval {
|
||||||
/// min builtin
|
/// min 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result min(const sem::Type* ty, // NOLINT(build/include_what_you_use) -- confused by min
|
Result min(const sem::Type* ty, // NOLINT(build/include_what_you_use) -- confused by min
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -605,7 +605,7 @@ class ConstEval {
|
||||||
/// pack2x16float builtin
|
/// pack2x16float 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result pack2x16float(const sem::Type* ty,
|
Result pack2x16float(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -614,7 +614,7 @@ class ConstEval {
|
||||||
/// pack2x16snorm builtin
|
/// pack2x16snorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result pack2x16snorm(const sem::Type* ty,
|
Result pack2x16snorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -623,7 +623,7 @@ class ConstEval {
|
||||||
/// pack2x16unorm builtin
|
/// pack2x16unorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result pack2x16unorm(const sem::Type* ty,
|
Result pack2x16unorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -632,7 +632,7 @@ class ConstEval {
|
||||||
/// pack4x8snorm builtin
|
/// pack4x8snorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result pack4x8snorm(const sem::Type* ty,
|
Result pack4x8snorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -641,7 +641,7 @@ class ConstEval {
|
||||||
/// pack4x8unorm builtin
|
/// pack4x8unorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result pack4x8unorm(const sem::Type* ty,
|
Result pack4x8unorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -650,7 +650,7 @@ class ConstEval {
|
||||||
/// reverseBits builtin
|
/// reverseBits 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result reverseBits(const sem::Type* ty,
|
Result reverseBits(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -659,7 +659,7 @@ class ConstEval {
|
||||||
/// round builtin
|
/// round 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result round(const sem::Type* ty,
|
Result round(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -668,7 +668,7 @@ class ConstEval {
|
||||||
/// saturate builtin
|
/// saturate 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result saturate(const sem::Type* ty,
|
Result saturate(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -677,7 +677,7 @@ class ConstEval {
|
||||||
/// select builtin with single bool third arg
|
/// select builtin with single bool third arg
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result select_bool(const sem::Type* ty,
|
Result select_bool(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -686,7 +686,7 @@ class ConstEval {
|
||||||
/// select builtin with vector of bool third arg
|
/// select builtin with vector of bool third arg
|
||||||
/// @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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result select_boolvec(const sem::Type* ty,
|
Result select_boolvec(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -695,7 +695,7 @@ class ConstEval {
|
||||||
/// sign builtin
|
/// sign 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result sign(const sem::Type* ty,
|
Result sign(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -704,7 +704,7 @@ class ConstEval {
|
||||||
/// sin builtin
|
/// sin 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result sin(const sem::Type* ty,
|
Result sin(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -713,7 +713,7 @@ class ConstEval {
|
||||||
/// sinh builtin
|
/// sinh 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result sinh(const sem::Type* ty,
|
Result sinh(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -722,7 +722,7 @@ class ConstEval {
|
||||||
/// smoothstep builtin
|
/// smoothstep 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result smoothstep(const sem::Type* ty,
|
Result smoothstep(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -731,7 +731,7 @@ class ConstEval {
|
||||||
/// step builtin
|
/// step 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result step(const sem::Type* ty,
|
Result step(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -740,7 +740,7 @@ class ConstEval {
|
||||||
/// sqrt builtin
|
/// sqrt 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result sqrt(const sem::Type* ty,
|
Result sqrt(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -749,7 +749,7 @@ class ConstEval {
|
||||||
/// tan builtin
|
/// tan 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result tan(const sem::Type* ty,
|
Result tan(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -758,7 +758,7 @@ class ConstEval {
|
||||||
/// tanh builtin
|
/// tanh 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result tanh(const sem::Type* ty,
|
Result tanh(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -767,7 +767,7 @@ class ConstEval {
|
||||||
/// trunc builtin
|
/// trunc 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result trunc(const sem::Type* ty,
|
Result trunc(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -776,7 +776,7 @@ class ConstEval {
|
||||||
/// unpack2x16float builtin
|
/// unpack2x16float 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result unpack2x16float(const sem::Type* ty,
|
Result unpack2x16float(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -785,7 +785,7 @@ class ConstEval {
|
||||||
/// unpack2x16snorm builtin
|
/// unpack2x16snorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result unpack2x16snorm(const sem::Type* ty,
|
Result unpack2x16snorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -794,7 +794,7 @@ class ConstEval {
|
||||||
/// unpack2x16unorm builtin
|
/// unpack2x16unorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result unpack2x16unorm(const sem::Type* ty,
|
Result unpack2x16unorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -803,7 +803,7 @@ class ConstEval {
|
||||||
/// unpack4x8snorm builtin
|
/// unpack4x8snorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result unpack4x8snorm(const sem::Type* ty,
|
Result unpack4x8snorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -812,7 +812,7 @@ class ConstEval {
|
||||||
/// unpack4x8unorm builtin
|
/// unpack4x8unorm 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result unpack4x8unorm(const sem::Type* ty,
|
Result unpack4x8unorm(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -821,7 +821,7 @@ class ConstEval {
|
||||||
/// quantizeToF16 builtin
|
/// quantizeToF16 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
|
||||||
/// @return the result value, or null if the value cannot be calculated
|
/// @return the result value, or null if the value cannot be calculated
|
||||||
Result quantizeToF16(const sem::Type* ty,
|
Result quantizeToF16(const sem::Type* ty,
|
||||||
utils::VectorRef<const sem::Constant*> args,
|
utils::VectorRef<const sem::Constant*> args,
|
||||||
|
@ -838,43 +838,53 @@ class ConstEval {
|
||||||
void AddNote(const std::string& msg, const Source& source) const;
|
void AddNote(const std::string& msg, const Source& source) const;
|
||||||
|
|
||||||
/// Adds two Number<T>s
|
/// Adds two Number<T>s
|
||||||
|
/// @param source the source location
|
||||||
/// @param a the lhs number
|
/// @param a the lhs number
|
||||||
/// @param b the rhs number
|
/// @param b the rhs number
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Add(NumberT a, NumberT b);
|
utils::Result<NumberT> Add(const Source& source, NumberT a, NumberT b);
|
||||||
|
|
||||||
/// Subtracts two Number<T>s
|
/// Subtracts two Number<T>s
|
||||||
|
/// @param source the source location
|
||||||
/// @param a the lhs number
|
/// @param a the lhs number
|
||||||
/// @param b the rhs number
|
/// @param b the rhs number
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Sub(NumberT a, NumberT b);
|
utils::Result<NumberT> Sub(const Source& source, NumberT a, NumberT b);
|
||||||
|
|
||||||
/// Multiplies two Number<T>s
|
/// Multiplies two Number<T>s
|
||||||
|
/// @param source the source location
|
||||||
/// @param a the lhs number
|
/// @param a the lhs number
|
||||||
/// @param b the rhs number
|
/// @param b the rhs number
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Mul(NumberT a, NumberT b);
|
utils::Result<NumberT> Mul(const Source& source, NumberT a, NumberT b);
|
||||||
|
|
||||||
/// Divides two Number<T>s
|
/// Divides two Number<T>s
|
||||||
|
/// @param source the source location
|
||||||
/// @param a the lhs number
|
/// @param a the lhs number
|
||||||
/// @param b the rhs number
|
/// @param b the rhs number
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Div(NumberT a, NumberT b);
|
utils::Result<NumberT> Div(const Source& source, NumberT a, NumberT b);
|
||||||
|
|
||||||
/// Returns the dot product of (a1,a2) with (b1,b2)
|
/// Returns the dot product of (a1,a2) with (b1,b2)
|
||||||
|
/// @param source the source location
|
||||||
/// @param a1 component 1 of lhs vector
|
/// @param a1 component 1 of lhs vector
|
||||||
/// @param a2 component 2 of lhs vector
|
/// @param a2 component 2 of lhs vector
|
||||||
/// @param b1 component 1 of rhs vector
|
/// @param b1 component 1 of rhs vector
|
||||||
/// @param b2 component 2 of rhs vector
|
/// @param b2 component 2 of rhs vector
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Dot2(NumberT a1, NumberT a2, NumberT b1, NumberT b2);
|
utils::Result<NumberT> Dot2(const Source& source,
|
||||||
|
NumberT a1,
|
||||||
|
NumberT a2,
|
||||||
|
NumberT b1,
|
||||||
|
NumberT b2);
|
||||||
|
|
||||||
/// Returns the dot product of (a1,a2,a3) with (b1,b2,b3)
|
/// Returns the dot product of (a1,a2,a3) with (b1,b2,b3)
|
||||||
|
/// @param source the source location
|
||||||
/// @param a1 component 1 of lhs vector
|
/// @param a1 component 1 of lhs vector
|
||||||
/// @param a2 component 2 of lhs vector
|
/// @param a2 component 2 of lhs vector
|
||||||
/// @param a3 component 3 of lhs vector
|
/// @param a3 component 3 of lhs vector
|
||||||
|
@ -883,7 +893,8 @@ class ConstEval {
|
||||||
/// @param b3 component 3 of rhs vector
|
/// @param b3 component 3 of rhs vector
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Dot3(NumberT a1,
|
utils::Result<NumberT> Dot3(const Source& source,
|
||||||
|
NumberT a1,
|
||||||
NumberT a2,
|
NumberT a2,
|
||||||
NumberT a3,
|
NumberT a3,
|
||||||
NumberT b1,
|
NumberT b1,
|
||||||
|
@ -891,6 +902,7 @@ class ConstEval {
|
||||||
NumberT b3);
|
NumberT b3);
|
||||||
|
|
||||||
/// Returns the dot product of (a1,b1,c1,d1) with (a2,b2,c2,d2)
|
/// Returns the dot product of (a1,b1,c1,d1) with (a2,b2,c2,d2)
|
||||||
|
/// @param source the source location
|
||||||
/// @param a1 component 1 of lhs vector
|
/// @param a1 component 1 of lhs vector
|
||||||
/// @param a2 component 2 of lhs vector
|
/// @param a2 component 2 of lhs vector
|
||||||
/// @param a3 component 3 of lhs vector
|
/// @param a3 component 3 of lhs vector
|
||||||
|
@ -901,7 +913,8 @@ class ConstEval {
|
||||||
/// @param b4 component 4 of rhs vector
|
/// @param b4 component 4 of rhs vector
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Dot4(NumberT a1,
|
utils::Result<NumberT> Dot4(const Source& source,
|
||||||
|
NumberT a1,
|
||||||
NumberT a2,
|
NumberT a2,
|
||||||
NumberT a3,
|
NumberT a3,
|
||||||
NumberT a4,
|
NumberT a4,
|
||||||
|
@ -911,77 +924,91 @@ class ConstEval {
|
||||||
NumberT b4);
|
NumberT b4);
|
||||||
|
|
||||||
/// Returns the determinant of the 2x2 matrix [(a1, a2), (b1, b2)]
|
/// Returns the determinant of the 2x2 matrix [(a1, a2), (b1, b2)]
|
||||||
|
/// @param source the source location
|
||||||
/// @param a1 component 1 of the first column vector
|
/// @param a1 component 1 of the first column vector
|
||||||
/// @param a2 component 2 of the first column vector
|
/// @param a2 component 2 of the first column vector
|
||||||
/// @param b1 component 1 of the second column vector
|
/// @param b1 component 1 of the second column vector
|
||||||
/// @param b2 component 2 of the second column vector
|
/// @param b2 component 2 of the second column vector
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Det2(NumberT a1, NumberT a2, NumberT b1, NumberT b2);
|
utils::Result<NumberT> Det2(const Source& source,
|
||||||
|
NumberT a1,
|
||||||
|
NumberT a2,
|
||||||
|
NumberT b1,
|
||||||
|
NumberT b2);
|
||||||
|
|
||||||
/// Clamps e between low and high
|
/// Clamps e between low and high
|
||||||
|
/// @param source the source location
|
||||||
/// @param e the number to clamp
|
/// @param e the number to clamp
|
||||||
/// @param low the lower bound
|
/// @param low the lower bound
|
||||||
/// @param high the upper bound
|
/// @param high the upper bound
|
||||||
/// @returns the result number on success, or logs an error and returns Failure
|
/// @returns the result number on success, or logs an error and returns Failure
|
||||||
template <typename NumberT>
|
template <typename NumberT>
|
||||||
utils::Result<NumberT> Clamp(NumberT e, NumberT low, NumberT high);
|
utils::Result<NumberT> Clamp(const Source& source, NumberT e, NumberT low, NumberT high);
|
||||||
|
|
||||||
/// Returns a callable that calls Add, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Add, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto AddFunc(const sem::Type* elem_ty);
|
auto AddFunc(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Sub, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Sub, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto SubFunc(const sem::Type* elem_ty);
|
auto SubFunc(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Mul, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Mul, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto MulFunc(const sem::Type* elem_ty);
|
auto MulFunc(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Div, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Div, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto DivFunc(const sem::Type* elem_ty);
|
auto DivFunc(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Dot2, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Dot2, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto Dot2Func(const sem::Type* elem_ty);
|
auto Dot2Func(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Dot3, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Dot3, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto Dot3Func(const sem::Type* elem_ty);
|
auto Dot3Func(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Dot4, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Dot4, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto Dot4Func(const sem::Type* elem_ty);
|
auto Dot4Func(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Det2, and creates a Constant with its result of type `elem_ty`
|
/// Returns a callable that calls Det2, and creates a Constant with its result of type `elem_ty`
|
||||||
/// if successful, or returns Failure otherwise.
|
/// if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto Det2Func(const sem::Type* elem_ty);
|
auto Det2Func(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
/// Returns a callable that calls Clamp, and creates a Constant with its result of type
|
/// Returns a callable that calls Clamp, and creates a Constant with its result of type
|
||||||
/// `elem_ty` if successful, or returns Failure otherwise.
|
/// `elem_ty` if successful, or returns Failure otherwise.
|
||||||
|
/// @param source the source location
|
||||||
/// @param elem_ty the element type of the Constant to create on success
|
/// @param elem_ty the element type of the Constant to create on success
|
||||||
/// @returns the callable function
|
/// @returns the callable function
|
||||||
auto ClampFunc(const sem::Type* elem_ty);
|
auto ClampFunc(const Source& source, const sem::Type* elem_ty);
|
||||||
|
|
||||||
ProgramBuilder& builder;
|
ProgramBuilder& builder;
|
||||||
const Source* current_source = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tint::resolver
|
} // namespace tint::resolver
|
||||||
|
|
Loading…
Reference in New Issue