Change namespace of tint::type
Move the `tint::type` namespace into `tint::core::type` to better match
the source location and contents.
Change-Id: I2e1ae0ecdffdfcedb8aab1391cdfe2e1453a4741
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/145901
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/core/constant/clone_context.h b/src/tint/lang/core/constant/clone_context.h
index 1556613..3a61e7e 100644
--- a/src/tint/lang/core/constant/clone_context.h
+++ b/src/tint/lang/core/constant/clone_context.h
@@ -27,7 +27,7 @@
/// Context information for cloning of constants
struct CloneContext {
/// The context for cloning type information
- type::CloneContext type_ctx;
+ core::type::CloneContext type_ctx;
/// Destination information
constant::Manager& dst;
diff --git a/src/tint/lang/core/constant/composite.cc b/src/tint/lang/core/constant/composite.cc
index 05f4604..d13ba7d 100644
--- a/src/tint/lang/core/constant/composite.cc
+++ b/src/tint/lang/core/constant/composite.cc
@@ -22,7 +22,7 @@
namespace tint::core::constant {
-Composite::Composite(const type::Type* t, VectorRef<const Value*> els, bool all_0, bool any_0)
+Composite::Composite(const core::type::Type* t, VectorRef<const Value*> els, bool all_0, bool any_0)
: type(t), elements(std::move(els)), all_zero(all_0), any_zero(any_0), hash(CalcHash()) {
TINT_ASSERT(!elements.IsEmpty());
}
diff --git a/src/tint/lang/core/constant/composite.h b/src/tint/lang/core/constant/composite.h
index 6af48f8..b749c70 100644
--- a/src/tint/lang/core/constant/composite.h
+++ b/src/tint/lang/core/constant/composite.h
@@ -35,11 +35,11 @@
/// @param els the composite elements
/// @param all_0 true if all elements are 0
/// @param any_0 true if any element is 0
- Composite(const type::Type* t, VectorRef<const Value*> els, bool all_0, bool any_0);
+ Composite(const core::type::Type* t, VectorRef<const Value*> els, bool all_0, bool any_0);
~Composite() override;
/// @copydoc Value::Type()
- const type::Type* Type() const override { return type; }
+ const core::type::Type* Type() const override { return type; }
/// @copydoc Value::Index()
const Value* Index(size_t i) const override {
@@ -64,7 +64,7 @@
const Composite* Clone(CloneContext& ctx) const override;
/// The composite type
- type::Type const* const type;
+ core::type::Type const* const type;
/// The composite elements
const Vector<const Value*, 4> elements;
/// True if all elements are zero
diff --git a/src/tint/lang/core/constant/composite_test.cc b/src/tint/lang/core/constant/composite_test.cc
index 5ffeb63..2f2bb10 100644
--- a/src/tint/lang/core/constant/composite_test.cc
+++ b/src/tint/lang/core/constant/composite_test.cc
@@ -25,7 +25,7 @@
using ConstantTest_Composite = TestHelper;
TEST_F(ConstantTest_Composite, AllZero) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* fPos0 = constants.Get(0_f);
auto* fNeg0 = constants.Get(-0_f);
@@ -41,7 +41,7 @@
}
TEST_F(ConstantTest_Composite, AnyZero) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* fPos0 = constants.Get(0_f);
auto* fNeg0 = constants.Get(-0_f);
@@ -57,7 +57,7 @@
}
TEST_F(ConstantTest_Composite, Index) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* fPos0 = constants.Get(0_f);
auto* fPos1 = constants.Get(1_f);
@@ -75,7 +75,7 @@
}
TEST_F(ConstantTest_Composite, Clone) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* fPos0 = constants.Get(0_f);
auto* fPos1 = constants.Get(1_f);
@@ -83,11 +83,11 @@
auto* composite = constants.Composite(vec3f, Vector{fPos1, fPos0});
constant::Manager mgr;
- constant::CloneContext ctx{type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
+ constant::CloneContext ctx{core::type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
auto* r = composite->As<Composite>()->Clone(ctx);
ASSERT_NE(r, nullptr);
- EXPECT_TRUE(r->type->Is<type::Vector>());
+ EXPECT_TRUE(r->type->Is<core::type::Vector>());
EXPECT_FALSE(r->all_zero);
EXPECT_TRUE(r->any_zero);
ASSERT_EQ(r->elements.Length(), 2u);
diff --git a/src/tint/lang/core/constant/eval.cc b/src/tint/lang/core/constant/eval.cc
index 5ef8af3..daac5a9 100644
--- a/src/tint/lang/core/constant/eval.cc
+++ b/src/tint/lang/core/constant/eval.cc
@@ -63,8 +63,8 @@
auto Dispatch_iu32(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::I32*) { return f(cs->template ValueAs<i32>()...); },
- [&](const type::U32*) { return f(cs->template ValueAs<u32>()...); });
+ [&](const core::type::I32*) { return f(cs->template ValueAs<i32>()...); },
+ [&](const core::type::U32*) { return f(cs->template ValueAs<u32>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -73,9 +73,9 @@
auto Dispatch_ia_iu32(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
- [&](const type::I32*) { return f(cs->template ValueAs<i32>()...); },
- [&](const type::U32*) { return f(cs->template ValueAs<u32>()...); });
+ [&](const core::type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
+ [&](const core::type::I32*) { return f(cs->template ValueAs<i32>()...); },
+ [&](const core::type::U32*) { return f(cs->template ValueAs<u32>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -84,10 +84,10 @@
auto Dispatch_ia_iu32_bool(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
- [&](const type::I32*) { return f(cs->template ValueAs<i32>()...); },
- [&](const type::U32*) { return f(cs->template ValueAs<u32>()...); },
- [&](const type::Bool*) { return f(cs->template ValueAs<bool>()...); });
+ [&](const core::type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
+ [&](const core::type::I32*) { return f(cs->template ValueAs<i32>()...); },
+ [&](const core::type::U32*) { return f(cs->template ValueAs<u32>()...); },
+ [&](const core::type::Bool*) { return f(cs->template ValueAs<bool>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -96,11 +96,11 @@
auto Dispatch_fia_fi32_f16(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
- [&](const type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
- [&](const type::F32*) { return f(cs->template ValueAs<f32>()...); },
- [&](const type::I32*) { return f(cs->template ValueAs<i32>()...); },
- [&](const type::F16*) { return f(cs->template ValueAs<f16>()...); });
+ [&](const core::type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
+ [&](const core::type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
+ [&](const core::type::F32*) { return f(cs->template ValueAs<f32>()...); },
+ [&](const core::type::I32*) { return f(cs->template ValueAs<i32>()...); },
+ [&](const core::type::F16*) { return f(cs->template ValueAs<f16>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -109,12 +109,12 @@
auto Dispatch_fia_fiu32_f16(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
- [&](const type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
- [&](const type::F32*) { return f(cs->template ValueAs<f32>()...); },
- [&](const type::I32*) { return f(cs->template ValueAs<i32>()...); },
- [&](const type::U32*) { return f(cs->template ValueAs<u32>()...); },
- [&](const type::F16*) { return f(cs->template ValueAs<f16>()...); });
+ [&](const core::type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
+ [&](const core::type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
+ [&](const core::type::F32*) { return f(cs->template ValueAs<f32>()...); },
+ [&](const core::type::I32*) { return f(cs->template ValueAs<i32>()...); },
+ [&](const core::type::U32*) { return f(cs->template ValueAs<u32>()...); },
+ [&](const core::type::F16*) { return f(cs->template ValueAs<f16>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -123,13 +123,13 @@
auto Dispatch_fia_fiu32_f16_bool(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
- [&](const type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
- [&](const type::F32*) { return f(cs->template ValueAs<f32>()...); },
- [&](const type::I32*) { return f(cs->template ValueAs<i32>()...); },
- [&](const type::U32*) { return f(cs->template ValueAs<u32>()...); },
- [&](const type::F16*) { return f(cs->template ValueAs<f16>()...); },
- [&](const type::Bool*) { return f(cs->template ValueAs<bool>()...); });
+ [&](const core::type::AbstractInt*) { return f(cs->template ValueAs<AInt>()...); },
+ [&](const core::type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
+ [&](const core::type::F32*) { return f(cs->template ValueAs<f32>()...); },
+ [&](const core::type::I32*) { return f(cs->template ValueAs<i32>()...); },
+ [&](const core::type::U32*) { return f(cs->template ValueAs<u32>()...); },
+ [&](const core::type::F16*) { return f(cs->template ValueAs<f16>()...); },
+ [&](const core::type::Bool*) { return f(cs->template ValueAs<bool>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -138,9 +138,9 @@
auto Dispatch_fa_f32_f16(F&& f, CONSTANTS&&... cs) {
return Switch(
First(cs...)->Type(), //
- [&](const type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
- [&](const type::F32*) { return f(cs->template ValueAs<f32>()...); },
- [&](const type::F16*) { return f(cs->template ValueAs<f16>()...); });
+ [&](const core::type::AbstractFloat*) { return f(cs->template ValueAs<AFloat>()...); },
+ [&](const core::type::F32*) { return f(cs->template ValueAs<f32>()...); },
+ [&](const core::type::F16*) { return f(cs->template ValueAs<f16>()...); });
}
/// Helper that calls `f` passing in the value of all `cs`.
@@ -151,23 +151,23 @@
}
/// ZeroTypeDispatch is a helper for calling the function `f`, passing a single zero-value argument
-/// of the C++ type that corresponds to the type::Type `type`. For example, calling
+/// of the C++ type that corresponds to the core::type::Type `type`. For example, calling
/// `ZeroTypeDispatch()` with a type of `type::I32*` will call the function f with a single argument
/// of `i32(0)`.
/// @returns the value returned by calling `f`.
/// @note `type` must be a scalar or abstract numeric type. Other types will not call `f`, and will
/// return the zero-initialized value of the return type for `f`.
template <typename F>
-auto ZeroTypeDispatch(const type::Type* type, F&& f) {
+auto ZeroTypeDispatch(const core::type::Type* type, F&& f) {
return Switch(
- type, //
- [&](const type::AbstractInt*) { return f(AInt(0)); }, //
- [&](const type::AbstractFloat*) { return f(AFloat(0)); }, //
- [&](const type::I32*) { return f(i32(0)); }, //
- [&](const type::U32*) { return f(u32(0)); }, //
- [&](const type::F32*) { return f(f32(0)); }, //
- [&](const type::F16*) { return f(f16(0)); }, //
- [&](const type::Bool*) { return f(static_cast<bool>(0)); });
+ type, //
+ [&](const core::type::AbstractInt*) { return f(AInt(0)); }, //
+ [&](const core::type::AbstractFloat*) { return f(AFloat(0)); }, //
+ [&](const core::type::I32*) { return f(i32(0)); }, //
+ [&](const core::type::U32*) { return f(u32(0)); }, //
+ [&](const core::type::F32*) { return f(f32(0)); }, //
+ [&](const core::type::F16*) { return f(f16(0)); }, //
+ [&](const core::type::Bool*) { return f(static_cast<bool>(0)); });
}
template <typename NumberT>
@@ -240,7 +240,7 @@
/// @returns the converted scalar, or nullptr on error.
template <typename T>
const ScalarBase* ScalarConvert(const Scalar<T>* scalar,
- const type::Type* target_ty,
+ const core::type::Type* target_ty,
ConvertContext& ctx) {
TINT_BEGIN_DISABLE_WARNING(UNREACHABLE_CODE);
if (target_ty == scalar->type) {
@@ -317,19 +317,19 @@
/// Converts the constant value to the target type.
/// @returns the converted value, or nullptr on error.
const Value* ConvertInternal(const Value* root_value,
- const type::Type* root_target_ty,
+ const core::type::Type* root_target_ty,
ConvertContext& ctx) {
struct ActionConvert {
const Value* value = nullptr;
- const type::Type* target_ty = nullptr;
+ const core::type::Type* target_ty = nullptr;
};
struct ActionBuildSplat {
size_t count = 0;
- const type::Type* type = nullptr;
+ const core::type::Type* type = nullptr;
};
struct ActionBuildComposite {
size_t count = 0;
- const type::Type* type = nullptr;
+ const core::type::Type* type = nullptr;
};
using Action = std::variant<ActionConvert, ActionBuildSplat, ActionBuildComposite>;
@@ -398,8 +398,8 @@
return true;
},
[&](const Splat* splat) {
- const type::Type* target_el_ty = nullptr;
- if (auto* str = convert->target_ty->As<type::Struct>()) {
+ const core::type::Type* target_el_ty = nullptr;
+ if (auto* str = convert->target_ty->As<core::type::Struct>()) {
// Structure conversion.
auto members = str->Members();
target_el_ty = members[0]->Type();
@@ -429,7 +429,7 @@
// Build the new composite from the converted element types.
pending.Push(ActionBuildComposite{el_count, convert->target_ty});
- if (auto* str = convert->target_ty->As<type::Struct>()) {
+ if (auto* str = convert->target_ty->As<core::type::Struct>()) {
if (TINT_UNLIKELY(str->Members().Length() != el_count)) {
TINT_ICE()
<< "const-eval conversion of structure has mismatched element counts";
@@ -464,7 +464,7 @@
/// Implementation of TransformElements
template <typename F, typename... CONSTANTS>
Eval::Result TransformElements(Manager& mgr,
- const type::Type* composite_ty,
+ const core::type::Type* composite_ty,
F&& f,
size_t index,
CONSTANTS&&... cs) {
@@ -503,7 +503,7 @@
/// the most deeply nested aggregate type will be passed in.
template <typename F, typename... CONSTANTS>
Eval::Result TransformElements(Manager& mgr,
- const type::Type* composite_ty,
+ const core::type::Type* composite_ty,
F&& f,
CONSTANTS&&... cs) {
return detail::TransformElements(mgr, composite_ty, f, 0, cs...);
@@ -515,7 +515,7 @@
/// vector-scalar, scalar-vector.
template <typename F>
Eval::Result TransformBinaryElements(Manager& mgr,
- const type::Type* composite_ty,
+ const core::type::Type* composite_ty,
F&& f,
const Value* c0,
const Value* c1) {
@@ -553,9 +553,9 @@
: mgr(manager), diags(diagnostics), use_runtime_semantics_(use_runtime_semantics) {}
template <typename T>
-Eval::Result Eval::CreateScalar(const Source& source, const type::Type* t, T v) {
+Eval::Result Eval::CreateScalar(const Source& source, const core::type::Type* t, T v) {
static_assert(IsNumber<T> || std::is_same_v<T, bool>, "T must be a Number or bool");
- TINT_ASSERT(t->Is<type::Scalar>());
+ TINT_ASSERT(t->Is<core::type::Scalar>());
if constexpr (IsFloatingPoint<T>) {
if (!std::isfinite(v.value)) {
@@ -570,18 +570,18 @@
return mgr.Get<Scalar<T>>(t, v);
}
-const Value* Eval::ZeroValue(const type::Type* type) {
+const Value* Eval::ZeroValue(const core::type::Type* type) {
return Switch(
type, //
- [&](const type::Vector* v) -> const Value* {
+ [&](const core::type::Vector* v) -> const Value* {
auto* zero_el = ZeroValue(v->type());
return mgr.Splat(type, zero_el, v->Width());
},
- [&](const type::Matrix* m) -> const Value* {
+ [&](const core::type::Matrix* m) -> const Value* {
auto* zero_el = ZeroValue(m->ColumnType());
return mgr.Splat(type, zero_el, m->columns());
},
- [&](const type::Array* a) -> const Value* {
+ [&](const core::type::Array* a) -> const Value* {
if (auto n = a->ConstantCount()) {
if (auto* zero_el = ZeroValue(a->ElemType())) {
return mgr.Splat(type, zero_el, n.value());
@@ -589,8 +589,8 @@
}
return nullptr;
},
- [&](const type::Struct* s) -> const Value* {
- Hashmap<const type::Type*, const Value*, 8> zero_by_type;
+ [&](const core::type::Struct* s) -> const Value* {
+ Hashmap<const core::type::Type*, const Value*, 8> zero_by_type;
Vector<const Value*, 4> zeros;
zeros.Reserve(s->Members().Length());
for (auto* member : s->Members()) {
@@ -1047,7 +1047,7 @@
return NumberT{std::sqrt(v)};
}
-auto Eval::SqrtFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::SqrtFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto v) -> Eval::Result {
if (auto r = Sqrt(source, v)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1069,7 +1069,7 @@
return NumberT{std::min(std::max(e, low), high)};
}
-auto Eval::ClampFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::ClampFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto e, auto low, auto high) -> Eval::Result {
if (auto r = Clamp(source, e, low, high)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1078,7 +1078,7 @@
};
}
-auto Eval::AddFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::AddFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2) -> Eval::Result {
if (auto r = Add(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1087,7 +1087,7 @@
};
}
-auto Eval::SubFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::SubFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2) -> Eval::Result {
if (auto r = Sub(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1096,7 +1096,7 @@
};
}
-auto Eval::MulFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::MulFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2) -> Eval::Result {
if (auto r = Mul(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1105,7 +1105,7 @@
};
}
-auto Eval::DivFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::DivFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2) -> Eval::Result {
if (auto r = Div(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1114,7 +1114,7 @@
};
}
-auto Eval::ModFunc(const Source& source, const type::Type* elem_ty) {
+auto Eval::ModFunc(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2) -> Eval::Result {
if (auto r = Mod(source, a1, a2)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1123,7 +1123,7 @@
};
}
-auto Eval::Dot2Func(const Source& source, const type::Type* elem_ty) {
+auto Eval::Dot2Func(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2, auto b1, auto b2) -> Eval::Result {
if (auto r = Dot2(source, a1, a2, b1, b2)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1132,7 +1132,7 @@
};
}
-auto Eval::Dot3Func(const Source& source, const type::Type* elem_ty) {
+auto Eval::Dot3Func(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2, auto a3, auto b1, auto b2, auto b3) -> Eval::Result {
if (auto r = Dot3(source, a1, a2, a3, b1, b2, b3)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1141,7 +1141,7 @@
};
}
-auto Eval::Dot4Func(const Source& source, const type::Type* elem_ty) {
+auto Eval::Dot4Func(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a1, auto a2, auto a3, auto a4, auto b1, auto b2, auto b3,
auto b4) -> Eval::Result {
if (auto r = Dot4(source, a1, a2, a3, a4, b1, b2, b3, b4)) {
@@ -1152,7 +1152,7 @@
}
Eval::Result Eval::Dot(const Source& source, const Value* v1, const Value* v2) {
- auto* vec_ty = v1->Type()->As<type::Vector>();
+ auto* vec_ty = v1->Type()->As<core::type::Vector>();
TINT_ASSERT(vec_ty);
auto* elem_ty = vec_ty->type();
switch (vec_ty->Width()) {
@@ -1176,8 +1176,8 @@
return Failure;
}
-Eval::Result Eval::Length(const Source& source, const type::Type* ty, const Value* c0) {
- auto* vec_ty = c0->Type()->As<type::Vector>();
+Eval::Result Eval::Length(const Source& source, const core::type::Type* ty, const Value* c0) {
+ auto* vec_ty = c0->Type()->As<core::type::Vector>();
// Evaluates to the absolute value of e if T is scalar.
if (vec_ty == nullptr) {
auto create = [&](auto e) {
@@ -1196,7 +1196,7 @@
}
Eval::Result Eval::Mul(const Source& source,
- const type::Type* ty,
+ const core::type::Type* ty,
const Value* v1,
const Value* v2) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1206,7 +1206,7 @@
}
Eval::Result Eval::Sub(const Source& source,
- const type::Type* ty,
+ const core::type::Type* ty,
const Value* v1,
const Value* v2) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1215,7 +1215,7 @@
return TransformBinaryElements(mgr, ty, transform, v1, v2);
}
-auto Eval::Det2Func(const Source& source, const type::Type* elem_ty) {
+auto Eval::Det2Func(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a, auto b, auto c, auto d) -> Eval::Result {
if (auto r = Det2(source, a, b, c, d)) {
return CreateScalar(source, elem_ty, r.Get());
@@ -1224,7 +1224,7 @@
};
}
-auto Eval::Det3Func(const Source& source, const type::Type* elem_ty) {
+auto Eval::Det3Func(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a, auto b, auto c, auto d, auto e, auto f, auto g, auto h,
auto i) -> Eval::Result {
if (auto r = Det3(source, a, b, c, d, e, f, g, h, i)) {
@@ -1234,7 +1234,7 @@
};
}
-auto Eval::Det4Func(const Source& source, const type::Type* elem_ty) {
+auto Eval::Det4Func(const Source& source, const core::type::Type* elem_ty) {
return [=](auto a, auto b, auto c, auto d, auto e, auto f, auto g, auto h, auto i, auto j,
auto k, auto l, auto m, auto n, auto o, auto p) -> Eval::Result {
if (auto r = Det4(source, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)) {
@@ -1244,7 +1244,7 @@
};
}
-Eval::Result Eval::ArrayOrStructCtor(const type::Type* ty, VectorRef<const Value*> args) {
+Eval::Result Eval::ArrayOrStructCtor(const core::type::Type* ty, VectorRef<const Value*> args) {
if (args.IsEmpty()) {
return ZeroValue(ty);
}
@@ -1258,7 +1258,9 @@
return mgr.Composite(ty, std::move(args));
}
-Eval::Result Eval::Conv(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Conv(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto* el_ty = ty->Elements(ty).type;
if (!el_ty) {
return nullptr;
@@ -1271,26 +1273,32 @@
return Convert(ty, args[0], source);
}
-Eval::Result Eval::Zero(const type::Type* ty, VectorRef<const Value*>, const Source&) {
+Eval::Result Eval::Zero(const core::type::Type* ty, VectorRef<const Value*>, const Source&) {
return ZeroValue(ty);
}
-Eval::Result Eval::Identity(const type::Type*, VectorRef<const Value*> args, const Source&) {
+Eval::Result Eval::Identity(const core::type::Type*, VectorRef<const Value*> args, const Source&) {
return args[0];
}
-Eval::Result Eval::VecSplat(const type::Type* ty, VectorRef<const Value*> args, const Source&) {
+Eval::Result Eval::VecSplat(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source&) {
if (auto* arg = args[0]) {
- return mgr.Splat(ty, arg, static_cast<const type::Vector*>(ty)->Width());
+ return mgr.Splat(ty, arg, static_cast<const core::type::Vector*>(ty)->Width());
}
return nullptr;
}
-Eval::Result Eval::VecInitS(const type::Type* ty, VectorRef<const Value*> args, const Source&) {
+Eval::Result Eval::VecInitS(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source&) {
return mgr.Composite(ty, args);
}
-Eval::Result Eval::VecInitM(const type::Type* ty, VectorRef<const Value*> args, const Source&) {
+Eval::Result Eval::VecInitM(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source&) {
Vector<const Value*, 4> els;
for (auto* arg : args) {
auto* val = arg;
@@ -1298,7 +1306,7 @@
return nullptr;
}
auto* arg_ty = arg->Type();
- if (auto* arg_vec = arg_ty->As<type::Vector>()) {
+ if (auto* arg_vec = arg_ty->As<core::type::Vector>()) {
// Extract out vector elements.
for (uint32_t j = 0; j < arg_vec->Width(); j++) {
auto* el = val->Index(j);
@@ -1314,8 +1322,10 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::MatInitS(const type::Type* ty, VectorRef<const Value*> args, const Source&) {
- auto* m = static_cast<const type::Matrix*>(ty);
+Eval::Result Eval::MatInitS(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source&) {
+ auto* m = static_cast<const core::type::Matrix*>(ty);
Vector<const Value*, 4> els;
for (uint32_t c = 0; c < m->columns(); c++) {
@@ -1329,12 +1339,14 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::MatInitV(const type::Type* ty, VectorRef<const Value*> args, const Source&) {
+Eval::Result Eval::MatInitV(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source&) {
return mgr.Composite(ty, args);
}
Eval::Result Eval::Index(const Value* obj_val,
- const type::Type* obj_ty,
+ const core::type::Type* obj_ty,
const Value* idx_val,
const Source& idx_source) {
auto el = obj_ty->UnwrapRef()->Elements();
@@ -1356,7 +1368,9 @@
return obj_val ? obj_val->Index(static_cast<size_t>(idx)) : nullptr;
}
-Eval::Result Eval::Swizzle(const type::Type* ty, const Value* object, VectorRef<uint32_t> indices) {
+Eval::Result Eval::Swizzle(const core::type::Type* ty,
+ const Value* object,
+ VectorRef<uint32_t> indices) {
if (indices.Length() == 1) {
return object->Index(static_cast<size_t>(indices[0]));
}
@@ -1365,7 +1379,7 @@
return mgr.Composite(ty, std::move(values));
}
-Eval::Result Eval::Bitcast(const type::Type* ty, const Value* value, const Source& source) {
+Eval::Result Eval::Bitcast(const core::type::Type* ty, const Value* value, const Source& source) {
// Target type
auto dst_elements = ty->Elements(ty->DeepestElement(), 1u);
auto dst_el_ty = dst_elements.type;
@@ -1382,7 +1396,8 @@
buffer.Reserve(total_bitwidth);
// Ensure elements are of 32-bit or 16-bit numerical scalar type.
- TINT_ASSERT((src_el_ty->IsAnyOf<type::F32, type::I32, type::U32, type::F16>()));
+ TINT_ASSERT(
+ (src_el_ty->IsAnyOf<core::type::F32, core::type::I32, core::type::U32, core::type::F16>()));
// Pushes bits from source value into the buffer.
auto push_src_element_bits = [&](const Value* element) {
auto push_32_bits = [&](uint32_t v) {
@@ -1397,19 +1412,19 @@
};
Switch(
src_el_ty,
- [&](const type::U32*) { //
+ [&](const core::type::U32*) { //
uint32_t r = element->ValueAs<u32>();
push_32_bits(r);
},
- [&](const type::I32*) { //
+ [&](const core::type::I32*) { //
uint32_t r = tint::Bitcast<u32>(element->ValueAs<i32>());
push_32_bits(r);
},
- [&](const type::F32*) { //
+ [&](const core::type::F32*) { //
uint32_t r = tint::Bitcast<u32>(element->ValueAs<f32>());
push_32_bits(r);
},
- [&](const type::F16*) { //
+ [&](const core::type::F16*) { //
uint16_t r = element->ValueAs<f16>().BitsRepresentation();
push_16_bits(r);
});
@@ -1441,28 +1456,28 @@
return Switch(
dst_el_ty,
- [&](const type::U32*) { //
+ [&](const core::type::U32*) { //
auto r = CreateScalar(source, dst_el_ty, u32(v));
if (r) {
els.Push(r.Get());
}
return r;
},
- [&](const type::I32*) { //
+ [&](const core::type::I32*) { //
auto r = CreateScalar(source, dst_el_ty, tint::Bitcast<i32>(v));
if (r) {
els.Push(r.Get());
}
return r;
},
- [&](const type::F32*) { //
+ [&](const core::type::F32*) { //
auto r = CreateScalar(source, dst_el_ty, tint::Bitcast<f32>(v));
if (r) {
els.Push(r.Get());
}
return r;
},
- [&](const type::F16*) { //
+ [&](const core::type::F16*) { //
auto r = CreateScalar(source, dst_el_ty, f16::FromBits(static_cast<uint16_t>(v)));
if (r) {
els.Push(r.Get());
@@ -1484,7 +1499,7 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::Complement(const type::Type* ty,
+Eval::Result Eval::Complement(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c) {
@@ -1496,7 +1511,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::UnaryMinus(const type::Type* ty,
+Eval::Result Eval::UnaryMinus(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c) {
@@ -1521,7 +1536,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::Not(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Not(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c) {
auto create = [&](auto i) { return CreateScalar(source, c->Type(), decltype(i)(!i)); };
return Dispatch_bool(create, c);
@@ -1529,7 +1546,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::Plus(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Plus(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
return Dispatch_fia_fiu32_f16(AddFunc(source, c0->Type()), c0, c1);
};
@@ -1537,21 +1556,23 @@
return TransformBinaryElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::Minus(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Minus(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
return Sub(source, ty, args[0], args[1]);
}
-Eval::Result Eval::Multiply(const type::Type* ty,
+Eval::Result Eval::Multiply(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
return Mul(source, ty, args[0], args[1]);
}
-Eval::Result Eval::MultiplyMatVec(const type::Type* ty,
+Eval::Result Eval::MultiplyMatVec(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
- auto* mat_ty = args[0]->Type()->As<type::Matrix>();
- auto* vec_ty = args[1]->Type()->As<type::Vector>();
+ auto* mat_ty = args[0]->Type()->As<core::type::Matrix>();
+ auto* vec_ty = args[1]->Type()->As<core::type::Vector>();
auto* elem_ty = vec_ty->type();
auto dot = [&](const Value* m, size_t row, const Value* v) {
@@ -1597,11 +1618,11 @@
}
return mgr.Composite(ty, result);
}
-Eval::Result Eval::MultiplyVecMat(const type::Type* ty,
+Eval::Result Eval::MultiplyVecMat(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
- auto* vec_ty = args[0]->Type()->As<type::Vector>();
- auto* mat_ty = args[1]->Type()->As<type::Matrix>();
+ auto* vec_ty = args[0]->Type()->As<core::type::Vector>();
+ auto* mat_ty = args[1]->Type()->As<core::type::Matrix>();
auto* elem_ty = vec_ty->type();
auto dot = [&](const Value* v, const Value* m, size_t col) {
@@ -1648,13 +1669,13 @@
return mgr.Composite(ty, result);
}
-Eval::Result Eval::MultiplyMatMat(const type::Type* ty,
+Eval::Result Eval::MultiplyMatMat(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* mat1 = args[0];
auto* mat2 = args[1];
- auto* mat1_ty = mat1->Type()->As<type::Matrix>();
- auto* mat2_ty = mat2->Type()->As<type::Matrix>();
+ auto* mat1_ty = mat1->Type()->As<core::type::Matrix>();
+ auto* mat2_ty = mat2->Type()->As<core::type::Matrix>();
auto* elem_ty = mat1_ty->type();
auto dot = [&](const Value* m1, size_t row, const Value* m2, size_t col) {
@@ -1706,13 +1727,13 @@
}
// Add column vector to matrix
- auto* col_vec_ty = ty->As<type::Matrix>()->ColumnType();
+ auto* col_vec_ty = ty->As<core::type::Matrix>()->ColumnType();
result_mat.Push(mgr.Composite(col_vec_ty, col_vec));
}
return mgr.Composite(ty, result_mat);
}
-Eval::Result Eval::Divide(const type::Type* ty,
+Eval::Result Eval::Divide(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1722,7 +1743,7 @@
return TransformBinaryElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::Modulo(const type::Type* ty,
+Eval::Result Eval::Modulo(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1732,7 +1753,9 @@
return TransformBinaryElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::Equal(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Equal(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto i, auto j) -> Eval::Result {
return CreateScalar(source, ty->DeepestElement(), i == j);
@@ -1743,7 +1766,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::NotEqual(const type::Type* ty,
+Eval::Result Eval::NotEqual(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1756,7 +1779,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::LessThan(const type::Type* ty,
+Eval::Result Eval::LessThan(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1769,7 +1792,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::GreaterThan(const type::Type* ty,
+Eval::Result Eval::GreaterThan(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1782,7 +1805,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::LessThanEqual(const type::Type* ty,
+Eval::Result Eval::LessThanEqual(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1795,7 +1818,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::GreaterThanEqual(const type::Type* ty,
+Eval::Result Eval::GreaterThanEqual(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1808,7 +1831,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::LogicalAnd(const type::Type* ty,
+Eval::Result Eval::LogicalAnd(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
// Due to short-circuiting, this function is only called if lhs is true, so we only return the
@@ -1817,7 +1840,7 @@
return CreateScalar(source, ty, args[1]->ValueAs<bool>());
}
-Eval::Result Eval::LogicalOr(const type::Type* ty,
+Eval::Result Eval::LogicalOr(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
// Due to short-circuiting, this function is only called if lhs is false, so we only only return
@@ -1826,7 +1849,9 @@
return CreateScalar(source, ty, args[1]->ValueAs<bool>());
}
-Eval::Result Eval::And(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::And(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto i, auto j) -> Eval::Result {
using T = decltype(i);
@@ -1844,7 +1869,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::Or(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Or(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto i, auto j) -> Eval::Result {
using T = decltype(i);
@@ -1862,7 +1889,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::Xor(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::Xor(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto i, auto j) -> Eval::Result {
return CreateScalar(source, ty->DeepestElement(), decltype(i){i ^ j});
@@ -1873,7 +1902,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::ShiftLeft(const type::Type* ty,
+Eval::Result Eval::ShiftLeft(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -1962,7 +1991,7 @@
return Dispatch_ia_iu32(create, c0, c1);
};
- if (TINT_UNLIKELY(!args[1]->Type()->DeepestElement()->Is<type::U32>())) {
+ if (TINT_UNLIKELY(!args[1]->Type()->DeepestElement()->Is<core::type::U32>())) {
TINT_ICE() << "Element type of rhs of ShiftLeft must be a u32";
return Failure;
}
@@ -1970,7 +1999,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::ShiftRight(const type::Type* ty,
+Eval::Result Eval::ShiftRight(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -2029,7 +2058,7 @@
return Dispatch_ia_iu32(create, c0, c1);
};
- if (TINT_UNLIKELY(!args[1]->Type()->DeepestElement()->Is<type::U32>())) {
+ if (TINT_UNLIKELY(!args[1]->Type()->DeepestElement()->Is<core::type::U32>())) {
TINT_ICE() << "Element type of rhs of ShiftLeft must be a u32";
return Failure;
}
@@ -2037,7 +2066,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::abs(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::abs(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e) {
using NumberT = decltype(e);
@@ -2060,7 +2091,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::acos(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::acos(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -2080,7 +2113,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::acosh(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::acosh(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -2100,15 +2135,21 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::all(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::all(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
return CreateScalar(source, ty, !args[0]->AnyZero());
}
-Eval::Result Eval::any(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::any(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
return CreateScalar(source, ty, !args[0]->AllZero());
}
-Eval::Result Eval::asin(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::asin(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -2128,7 +2169,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::asinh(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::asinh(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) {
return CreateScalar(source, c0->Type(), decltype(i)(std::asinh(i.value)));
@@ -2139,7 +2182,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::atan(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::atan(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) {
return CreateScalar(source, c0->Type(), decltype(i)(std::atan(i.value)));
@@ -2149,7 +2194,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::atanh(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::atanh(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -2170,7 +2217,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::atan2(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::atan2(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto i, auto j) {
return CreateScalar(source, c0->Type(), decltype(i)(std::atan2(i.value, j.value)));
@@ -2180,7 +2229,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::ceil(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::ceil(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e) {
return CreateScalar(source, c0->Type(), decltype(e)(std::ceil(e)));
@@ -2190,14 +2241,18 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::clamp(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::clamp(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1, const Value* c2) {
return Dispatch_fia_fiu32_f16(ClampFunc(source, c0->Type()), c0, c1, c2);
};
return TransformElements(mgr, ty, transform, args[0], args[1], args[2]);
}
-Eval::Result Eval::cos(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::cos(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -2208,7 +2263,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::cosh(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::cosh(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -2219,7 +2276,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::countLeadingZeros(const type::Type* ty,
+Eval::Result Eval::countLeadingZeros(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2234,7 +2291,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::countOneBits(const type::Type* ty,
+Eval::Result Eval::countOneBits(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2258,7 +2315,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::countTrailingZeros(const type::Type* ty,
+Eval::Result Eval::countTrailingZeros(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2273,10 +2330,12 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::cross(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::cross(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto* u = args[0];
auto* v = args[1];
- auto* elem_ty = u->Type()->As<type::Vector>()->type();
+ auto* elem_ty = u->Type()->As<core::type::Vector>()->type();
// cross product of a v3 is the determinant of the 3x3 matrix:
//
@@ -2313,7 +2372,7 @@
return mgr.Composite(ty, Vector<const Value*, 3>{x.Get(), y.Get(), z.Get()});
}
-Eval::Result Eval::degrees(const type::Type* ty,
+Eval::Result Eval::degrees(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2339,12 +2398,12 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::determinant(const type::Type* ty,
+Eval::Result Eval::determinant(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto calculate = [&]() -> Eval::Result {
auto* m = args[0];
- auto* mat_ty = m->Type()->As<type::Matrix>();
+ auto* mat_ty = m->Type()->As<core::type::Matrix>();
auto me = [&](size_t r, size_t c) { return m->Index(c)->Index(r); };
switch (mat_ty->rows()) {
case 2:
@@ -2375,7 +2434,7 @@
return r;
}
-Eval::Result Eval::distance(const type::Type* ty,
+Eval::Result Eval::distance(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto err = [&]() -> Eval::Result {
@@ -2395,7 +2454,9 @@
return len;
}
-Eval::Result Eval::dot(const type::Type*, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::dot(const core::type::Type*,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto r = Dot(source, args[0], args[1]);
if (!r) {
AddNote("when calculating dot", source);
@@ -2403,7 +2464,9 @@
return r;
}
-Eval::Result Eval::exp(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::exp(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e0) -> Eval::Result {
using NumberT = decltype(e0);
@@ -2423,7 +2486,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::exp2(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::exp2(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e0) -> Eval::Result {
using NumberT = decltype(e0);
@@ -2443,7 +2508,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::extractBits(const type::Type* ty,
+Eval::Result Eval::extractBits(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2503,7 +2568,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::faceForward(const type::Type* ty,
+Eval::Result Eval::faceForward(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
// Returns e1 if dot(e2, e3) is negative, and -e1 otherwise.
@@ -2522,7 +2587,7 @@
return UnaryMinus(ty, Vector{e1}, source);
}
-Eval::Result Eval::firstLeadingBit(const type::Type* ty,
+Eval::Result Eval::firstLeadingBit(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2566,7 +2631,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::firstTrailingBit(const type::Type* ty,
+Eval::Result Eval::firstTrailingBit(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2592,7 +2657,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::floor(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::floor(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e) {
return CreateScalar(source, c0->Type(), decltype(e)(std::floor(e)));
@@ -2602,7 +2669,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::fma(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::fma(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c1, const Value* c2, const Value* c3) {
auto create = [&](auto e1, auto e2, auto e3) -> Eval::Result {
auto err_msg = [&] {
@@ -2626,7 +2695,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1], args[2]);
}
-Eval::Result Eval::fract(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::fract(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c1) {
auto create = [&](auto e) -> Eval::Result {
using NumberT = decltype(e);
@@ -2638,7 +2709,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::frexp(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::frexp(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto* arg = args[0];
struct FractExp {
@@ -2651,19 +2724,19 @@
double fract = std::frexp(s->ValueAs<AFloat>(), &exp);
return Switch(
s->Type(),
- [&](const type::F32*) {
+ [&](const core::type::F32*) {
return FractExp{
CreateScalar(source, mgr.types.f32(), f32(fract)),
CreateScalar(source, mgr.types.i32(), i32(exp)),
};
},
- [&](const type::F16*) {
+ [&](const core::type::F16*) {
return FractExp{
CreateScalar(source, mgr.types.f16(), f16(fract)),
CreateScalar(source, mgr.types.i32(), i32(exp)),
};
},
- [&](const type::AbstractFloat*) {
+ [&](const core::type::AbstractFloat*) {
return FractExp{
CreateScalar(source, mgr.types.AFloat(), AFloat(fract)),
CreateScalar(source, mgr.types.AInt(), AInt(exp)),
@@ -2676,7 +2749,7 @@
});
};
- if (auto* vec = arg->Type()->As<type::Vector>()) {
+ if (auto* vec = arg->Type()->As<core::type::Vector>()) {
Vector<const Value*, 4> fract_els;
Vector<const Value*, 4> exp_els;
for (uint32_t i = 0; i < vec->Width(); i++) {
@@ -2705,7 +2778,7 @@
}
}
-Eval::Result Eval::insertBits(const type::Type* ty,
+Eval::Result Eval::insertBits(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
@@ -2762,7 +2835,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::inverseSqrt(const type::Type* ty,
+Eval::Result Eval::inverseSqrt(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -2800,7 +2873,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::ldexp(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::ldexp(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c1, size_t index) {
auto create = [&](auto e1) -> Eval::Result {
using E1Type = decltype(e1);
@@ -2809,7 +2884,7 @@
E2Type e2;
auto* c2 = args[1];
- if (c2->Type()->Is<type::Vector>()) {
+ if (c2->Type()->Is<core::type::Vector>()) {
e2 = c2->Index(index)->ValueAs<E2Type>();
} else {
e2 = c2->ValueAs<E2Type>();
@@ -2844,7 +2919,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::length(const type::Type* ty,
+Eval::Result Eval::length(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto r = Length(source, ty, args[0]);
@@ -2854,7 +2929,9 @@
return r;
}
-Eval::Result Eval::log(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::log(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto v) -> Eval::Result {
using NumberT = decltype(v);
@@ -2873,7 +2950,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::log2(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::log2(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto v) -> Eval::Result {
using NumberT = decltype(v);
@@ -2892,7 +2971,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::max(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::max(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto e0, auto e1) {
return CreateScalar(source, c0->Type(), decltype(e0)(std::max(e0, e1)));
@@ -2902,7 +2983,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::min(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::min(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto e0, auto e1) {
return CreateScalar(source, c0->Type(), decltype(e0)(std::min(e0, e1)));
@@ -2912,14 +2995,16 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::mix(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::mix(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1, size_t index) {
auto create = [&](auto e1, auto e2) -> Eval::Result {
using NumberT = decltype(e1);
// e3 is either a vector or a scalar
NumberT e3;
auto* c2 = args[2];
- if (c2->Type()->Is<type::Vector>()) {
+ if (c2->Type()->Is<core::type::Vector>()) {
e3 = c2->Index(index)->ValueAs<NumberT>();
} else {
e3 = c2->ValueAs<NumberT>();
@@ -2953,7 +3038,9 @@
return r;
}
-Eval::Result Eval::modf(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::modf(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform_fract = [&](const Value* c) {
auto create = [&](auto e) {
return CreateScalar(source, c->Type(), decltype(e)(e.value - std::trunc(e.value)));
@@ -2984,7 +3071,7 @@
return mgr.Composite(ty, std::move(fields));
}
-Eval::Result Eval::normalize(const type::Type* ty,
+Eval::Result Eval::normalize(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* len_ty = ty->DeepestElement();
@@ -3005,7 +3092,7 @@
return Divide(ty, Vector{args[0], v}, source);
}
-Eval::Result Eval::pack2x16float(const type::Type* ty,
+Eval::Result Eval::pack2x16float(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto convert = [&](f32 val) -> tint::Result<uint32_t> {
@@ -3037,7 +3124,7 @@
return CreateScalar(source, ty, ret);
}
-Eval::Result Eval::pack2x16snorm(const type::Type* ty,
+Eval::Result Eval::pack2x16snorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
@@ -3054,7 +3141,7 @@
return CreateScalar(source, ty, ret);
}
-Eval::Result Eval::pack2x16unorm(const type::Type* ty,
+Eval::Result Eval::pack2x16unorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
@@ -3070,7 +3157,7 @@
return CreateScalar(source, ty, ret);
}
-Eval::Result Eval::pack4x8snorm(const type::Type* ty,
+Eval::Result Eval::pack4x8snorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
@@ -3090,7 +3177,7 @@
return CreateScalar(source, ty, ret);
}
-Eval::Result Eval::pack4x8unorm(const type::Type* ty,
+Eval::Result Eval::pack4x8unorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto calc = [&](f32 val) -> u32 {
@@ -3109,7 +3196,9 @@
return CreateScalar(source, ty, ret);
}
-Eval::Result Eval::pow(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::pow(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto e1, auto e2) -> Eval::Result {
auto r = CheckedPow(e1, e2);
@@ -3128,7 +3217,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::radians(const type::Type* ty,
+Eval::Result Eval::radians(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -3154,7 +3243,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::reflect(const type::Type* ty,
+Eval::Result Eval::reflect(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto calculate = [&]() -> Eval::Result {
@@ -3162,7 +3251,7 @@
// e1 - 2 * dot(e2, e1) * e2.
auto* e1 = args[0];
auto* e2 = args[1];
- auto* vec_ty = ty->As<type::Vector>();
+ auto* vec_ty = ty->As<core::type::Vector>();
auto* el_ty = vec_ty->type();
// dot(e2, e1)
@@ -3197,10 +3286,10 @@
return r;
}
-Eval::Result Eval::refract(const type::Type* ty,
+Eval::Result Eval::refract(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
- auto* vec_ty = ty->As<type::Vector>();
+ auto* vec_ty = ty->As<core::type::Vector>();
auto* el_ty = vec_ty->type();
auto compute_k = [&](auto e3, auto dot_e2_e1) -> Eval::Result {
@@ -3295,7 +3384,7 @@
return r;
}
-Eval::Result Eval::reverseBits(const type::Type* ty,
+Eval::Result Eval::reverseBits(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -3322,7 +3411,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::round(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::round(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e) {
using NumberT = decltype(e);
@@ -3356,7 +3447,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::saturate(const type::Type* ty,
+Eval::Result Eval::saturate(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0) {
@@ -3370,7 +3461,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::select_bool(const type::Type* ty,
+Eval::Result Eval::select_bool(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto cond = args[2]->ValueAs<bool>();
@@ -3384,7 +3475,7 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::select_boolvec(const type::Type* ty,
+Eval::Result Eval::select_boolvec(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1, size_t index) {
@@ -3399,7 +3490,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::sign(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::sign(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto e) -> Eval::Result {
using NumberT = decltype(e);
@@ -3419,7 +3512,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::sin(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::sin(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -3430,7 +3525,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::sinh(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::sinh(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -3441,7 +3538,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::smoothstep(const type::Type* ty,
+Eval::Result Eval::smoothstep(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c0, const Value* c1, const Value* c2) {
@@ -3491,7 +3588,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1], args[2]);
}
-Eval::Result Eval::step(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::step(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0, const Value* c1) {
auto create = [&](auto edge, auto x) -> Eval::Result {
using NumberT = decltype(edge);
@@ -3503,7 +3602,9 @@
return TransformElements(mgr, ty, transform, args[0], args[1]);
}
-Eval::Result Eval::sqrt(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::sqrt(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
return Dispatch_fa_f32_f16(SqrtFunc(source, c0->Type()), c0);
};
@@ -3511,7 +3612,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::tan(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::tan(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -3522,7 +3625,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::tanh(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::tanh(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) -> Eval::Result {
using NumberT = decltype(i);
@@ -3533,11 +3638,13 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::transpose(const type::Type* ty, VectorRef<const Value*> args, const Source&) {
+Eval::Result Eval::transpose(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source&) {
auto* m = args[0];
- auto* mat_ty = m->Type()->As<type::Matrix>();
+ auto* mat_ty = m->Type()->As<core::type::Matrix>();
auto me = [&](size_t r, size_t c) { return m->Index(c)->Index(r); };
- auto* result_mat_ty = ty->As<type::Matrix>();
+ auto* result_mat_ty = ty->As<core::type::Matrix>();
// Produce column vectors from each row
Vector<const Value*, 4> result_mat;
@@ -3551,7 +3658,9 @@
return mgr.Composite(ty, result_mat);
}
-Eval::Result Eval::trunc(const type::Type* ty, VectorRef<const Value*> args, const Source& source) {
+Eval::Result Eval::trunc(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source) {
auto transform = [&](const Value* c0) {
auto create = [&](auto i) {
return CreateScalar(source, c0->Type(), decltype(i)(std::trunc(i.value)));
@@ -3561,7 +3670,7 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::unpack2x16float(const type::Type* ty,
+Eval::Result Eval::unpack2x16float(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
@@ -3589,7 +3698,7 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::unpack2x16snorm(const type::Type* ty,
+Eval::Result Eval::unpack2x16snorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
@@ -3609,7 +3718,7 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::unpack2x16unorm(const type::Type* ty,
+Eval::Result Eval::unpack2x16unorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
@@ -3628,7 +3737,7 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::unpack4x8snorm(const type::Type* ty,
+Eval::Result Eval::unpack4x8snorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
@@ -3648,7 +3757,7 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::unpack4x8unorm(const type::Type* ty,
+Eval::Result Eval::unpack4x8unorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto* inner_ty = ty->DeepestElement();
@@ -3667,7 +3776,7 @@
return mgr.Composite(ty, std::move(els));
}
-Eval::Result Eval::quantizeToF16(const type::Type* ty,
+Eval::Result Eval::quantizeToF16(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source) {
auto transform = [&](const Value* c) -> Eval::Result {
@@ -3686,7 +3795,9 @@
return TransformElements(mgr, ty, transform, args[0]);
}
-Eval::Result Eval::Convert(const type::Type* target_ty, const Value* value, const Source& source) {
+Eval::Result Eval::Convert(const core::type::Type* target_ty,
+ const Value* value,
+ const Source& source) {
if (value->Type() == target_ty) {
return value;
}
diff --git a/src/tint/lang/core/constant/eval.h b/src/tint/lang/core/constant/eval.h
index 6a81c42..035f353 100644
--- a/src/tint/lang/core/constant/eval.h
+++ b/src/tint/lang/core/constant/eval.h
@@ -16,6 +16,7 @@
#define SRC_TINT_LANG_CORE_CONSTANT_EVAL_H_
#include <stddef.h>
+#include <algorithm>
#include <string>
#include "src/tint/lang/core/number.h"
@@ -51,7 +52,7 @@
using Result = tint::Result<const Value*>;
/// Typedef for a constant evaluation function
- using Function = Result (Eval::*)(const type::Type* result_ty,
+ using Function = Result (Eval::*)(const core::type::Type* result_ty,
VectorRef<const Value*>,
const Source&);
@@ -69,14 +70,14 @@
/// @param ty the target type - must be an array or struct
/// @param args the input arguments
/// @return the constructed value, or null if the value cannot be calculated
- Result ArrayOrStructCtor(const type::Type* ty, VectorRef<const Value*> args);
+ Result ArrayOrStructCtor(const core::type::Type* ty, VectorRef<const Value*> args);
/// @param ty the target type
/// @param value the value being converted
/// @param source the source location
/// @return the bit-cast of the given expression to the given type, or null if the value cannot
/// be calculated
- Result Bitcast(const type::Type* ty, const Value* value, const Source& source);
+ Result Bitcast(const core::type::Type* ty, const Value* value, const Source& source);
/// @param obj the object being indexed. May be null, in which case Index() will still validate
/// the index is in bounds for the type.
@@ -85,7 +86,7 @@
/// @param idx_source the source of the index expression
/// @return the result of the index, or null if the value cannot be calculated
Result Index(const Value* obj,
- const type::Type* obj_ty,
+ const core::type::Type* obj_ty,
const Value* idx,
const Source& idx_source);
@@ -93,14 +94,14 @@
/// @param vector the vector being swizzled
/// @param indices the swizzle indices
/// @return the result of the swizzle, or null if the value cannot be calculated
- Result Swizzle(const type::Type* ty, const Value* vector, VectorRef<uint32_t> indices);
+ Result Swizzle(const core::type::Type* ty, const Value* vector, VectorRef<uint32_t> indices);
/// Convert the `value` to `target_type`
/// @param ty the result type
/// @param value the value being converted
/// @param source the source location
/// @return the converted value, or null if the value cannot be calculated
- Result Convert(const type::Type* ty, const Value* value, const Source& source);
+ Result Convert(const core::type::Type* ty, const Value* value, const Source& source);
////////////////////////////////////////////////////////////////////////////////////////////////
// Constant value evaluation methods, to be indirectly called via the intrinsic table
@@ -111,56 +112,56 @@
/// @param args the input arguments
/// @param source the source location
/// @return the converted value, or null if the value cannot be calculated
- Result Conv(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Conv(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Zero value constructor
/// @param ty the result type
/// @param args the input arguments (no arguments provided)
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result Zero(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Zero(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Identity value constructor
/// @param ty the result type
/// @param args the input arguments
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result Identity(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Identity(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Vector splat constructor
/// @param ty the vector type
/// @param args the input arguments
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result VecSplat(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result VecSplat(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Vector constructor using scalars
/// @param ty the vector type
/// @param args the input arguments
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result VecInitS(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result VecInitS(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Vector constructor using a mix of scalars and smaller vectors
/// @param ty the vector type
/// @param args the input arguments
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result VecInitM(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result VecInitM(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Matrix constructor using scalar values
/// @param ty the matrix type
/// @param args the input arguments
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result MatInitS(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result MatInitS(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Matrix constructor using column vectors
/// @param ty the matrix type
/// @param args the input arguments
/// @param source the source location
/// @return the constructed value, or null if the value cannot be calculated
- Result MatInitV(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result MatInitV(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
////////////////////////////////////////////////////////////////////////////
// Unary Operators
@@ -171,21 +172,25 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Complement(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Complement(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Unary minus operator '-'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result UnaryMinus(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result UnaryMinus(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Unary not operator '!'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Not(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Not(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
////////////////////////////////////////////////////////////////////////////
// Binary Operators
@@ -196,98 +201,108 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Plus(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Plus(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Minus operator '-'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Minus(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Minus(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Multiply operator '*' for the same type on the LHS and RHS
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Multiply(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Multiply(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Multiply operator '*' for matCxR<T> * vecC<T>
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result MultiplyMatVec(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result MultiplyMatVec(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Multiply operator '*' for vecR<T> * matCxR<T>
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result MultiplyVecMat(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result MultiplyVecMat(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Multiply operator '*' for matKxR<T> * matCxK<T>
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result MultiplyMatMat(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result MultiplyMatMat(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Divide operator '/'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Divide(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Divide(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Modulo operator '%'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Modulo(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Modulo(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Equality operator '=='
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Equal(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Equal(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Inequality operator '!='
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result NotEqual(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result NotEqual(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Less than operator '<'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result LessThan(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result LessThan(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Greater than operator '>'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result GreaterThan(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result GreaterThan(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Less than or equal operator '<='
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result LessThanEqual(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result LessThanEqual(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Greater than or equal operator '>='
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result GreaterThanEqual(const type::Type* ty,
+ Result GreaterThanEqual(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -296,49 +311,57 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result LogicalAnd(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result LogicalAnd(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Logical or operator '||'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result LogicalOr(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result LogicalOr(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Bitwise and operator '&'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result And(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result And(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Bitwise or operator '|'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Or(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Or(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Bitwise xor operator '^'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result Xor(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result Xor(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// Bitwise shift left operator '<<'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result ShiftLeft(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result ShiftLeft(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// Bitwise shift right operator '<<'
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result ShiftRight(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result ShiftRight(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
////////////////////////////////////////////////////////////////////////////
// Builtins
@@ -349,105 +372,105 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result abs(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result abs(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// acos builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result acos(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result acos(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// acosh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result acosh(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result acosh(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// all builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result all(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result all(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// any builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result any(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result any(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// asin builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result asin(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result asin(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// asinh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result asinh(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result asinh(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// atan builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result atan(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result atan(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// atanh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result atanh(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result atanh(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// atan2 builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result atan2(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result atan2(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// ceil builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result ceil(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result ceil(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// clamp builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result clamp(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result clamp(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// cos builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result cos(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result cos(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// cosh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result cosh(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result cosh(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// countLeadingZeros builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result countLeadingZeros(const type::Type* ty,
+ Result countLeadingZeros(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -456,14 +479,16 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result countOneBits(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result countOneBits(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// countTrailingZeros builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result countTrailingZeros(const type::Type* ty,
+ Result countTrailingZeros(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -472,70 +497,76 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result cross(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result cross(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// degrees builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
- Result degrees(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result degrees(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// determinant builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
- Result determinant(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result determinant(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// distance builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
- Result distance(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result distance(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// dot builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result dot(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result dot(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// exp builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result exp(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result exp(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// exp2 builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result exp2(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result exp2(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// extractBits builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result extractBits(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result extractBits(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// faceForward builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result faceForward(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result faceForward(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// firstLeadingBit builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result firstLeadingBit(const type::Type* ty,
+ Result firstLeadingBit(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -544,7 +575,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result firstTrailingBit(const type::Type* ty,
+ Result firstTrailingBit(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -553,282 +584,309 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result floor(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result floor(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// fma builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result fma(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result fma(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// fract builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result fract(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result fract(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// frexp builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result frexp(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result frexp(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// insertBits builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result insertBits(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result insertBits(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// inverseSqrt builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result inverseSqrt(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result inverseSqrt(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// ldexp builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result ldexp(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result ldexp(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// length builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result length(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result length(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// log builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result log(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result log(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// log2 builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result log2(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result log2(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// max builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result max(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result max(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// min builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result min(const type::Type* ty, // NOLINT(build/include_what_you_use) -- confused by min
- VectorRef<const Value*> args,
- const Source& source);
+ Result min(
+ const core::type::Type* ty, // NOLINT(build/include_what_you_use) -- confused by min
+ VectorRef<const Value*> args,
+ const Source& source);
/// mix builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result mix(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result mix(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// modf builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result modf(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result modf(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// normalize builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result normalize(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result normalize(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// pack2x16float builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pack2x16float(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result pack2x16float(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// pack2x16snorm builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pack2x16snorm(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result pack2x16snorm(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// pack2x16unorm builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pack2x16unorm(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result pack2x16unorm(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// pack4x8snorm builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pack4x8snorm(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result pack4x8snorm(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// pack4x8unorm builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pack4x8unorm(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result pack4x8unorm(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// pow builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result pow(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result pow(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// radians builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
- Result radians(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result radians(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// reflect builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
- Result reflect(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result reflect(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// refract builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location of the conversion
/// @return the result value, or null if the value cannot be calculated
- Result refract(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result refract(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// reverseBits builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result reverseBits(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result reverseBits(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// round builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result round(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result round(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// saturate builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result saturate(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result saturate(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// select builtin with single bool third arg
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result select_bool(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result select_bool(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// select builtin with vector of bool third arg
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result select_boolvec(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result select_boolvec(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// sign builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sign(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result sign(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// sin builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sin(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result sin(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// sinh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sinh(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result sinh(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// smoothstep builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result smoothstep(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result smoothstep(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// step builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result step(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result step(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// sqrt builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result sqrt(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result sqrt(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// tan builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result tan(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result tan(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// tanh builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result tanh(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result tanh(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// transpose builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result transpose(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result transpose(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// trunc builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result trunc(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result trunc(const core::type::Type* ty, VectorRef<const Value*> args, const Source& source);
/// unpack2x16float builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result unpack2x16float(const type::Type* ty,
+ Result unpack2x16float(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -837,7 +895,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result unpack2x16snorm(const type::Type* ty,
+ Result unpack2x16snorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -846,7 +904,7 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result unpack2x16unorm(const type::Type* ty,
+ Result unpack2x16unorm(const core::type::Type* ty,
VectorRef<const Value*> args,
const Source& source);
@@ -855,21 +913,27 @@
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result unpack4x8snorm(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result unpack4x8snorm(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// unpack4x8unorm builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result unpack4x8unorm(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result unpack4x8unorm(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
/// quantizeToF16 builtin
/// @param ty the expression type
/// @param args the input arguments
/// @param source the source location
/// @return the result value, or null if the value cannot be calculated
- Result quantizeToF16(const type::Type* ty, VectorRef<const Value*> args, const Source& source);
+ Result quantizeToF16(const core::type::Type* ty,
+ VectorRef<const Value*> args,
+ const Source& source);
private:
/// Adds the given error message to the diagnostics
@@ -887,10 +951,10 @@
/// @param v the scalar value
/// @return the constant value with the same type and value
template <typename T>
- Eval::Result CreateScalar(const Source& source, const type::Type* t, T v);
+ Eval::Result CreateScalar(const Source& source, const core::type::Type* t, T v);
/// ZeroValue returns a Constant for the zero-value of the type `type`.
- const Value* ZeroValue(const type::Type* type);
+ const Value* ZeroValue(const core::type::Type* type);
/// Adds two Number<T>s
/// @param source the source location
@@ -1085,91 +1149,91 @@
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto AddFunc(const Source& source, const type::Type* elem_ty);
+ auto AddFunc(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto SubFunc(const Source& source, const type::Type* elem_ty);
+ auto SubFunc(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto MulFunc(const Source& source, const type::Type* elem_ty);
+ auto MulFunc(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto DivFunc(const Source& source, const type::Type* elem_ty);
+ auto DivFunc(const Source& source, const core::type::Type* elem_ty);
/// Returns a callable that calls Mod, and creates a Constant with its result of type `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
/// @returns the callable function
- auto ModFunc(const Source& source, const type::Type* elem_ty);
+ auto ModFunc(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto Dot2Func(const Source& source, const type::Type* elem_ty);
+ auto Dot2Func(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto Dot3Func(const Source& source, const type::Type* elem_ty);
+ auto Dot3Func(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto Dot4Func(const Source& source, const type::Type* elem_ty);
+ auto Dot4Func(const Source& source, const core::type::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.
/// @param source the source location
/// @param elem_ty the element type of the Constant to create on success
/// @returns the callable function
- auto Det2Func(const Source& source, const type::Type* elem_ty);
+ auto Det2Func(const Source& source, const core::type::Type* elem_ty);
/// Returns a callable that calls Det3, and creates a Constant with its result of type `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
/// @returns the callable function
- auto Det3Func(const Source& source, const type::Type* elem_ty);
+ auto Det3Func(const Source& source, const core::type::Type* elem_ty);
/// Returns a callable that calls Det4, and creates a Constant with its result of type `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
/// @returns the callable function
- auto Det4Func(const Source& source, const type::Type* elem_ty);
+ auto Det4Func(const Source& source, const core::type::Type* elem_ty);
/// Returns a callable that calls Clamp, and creates a Constant with its result of type
/// `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
/// @returns the callable function
- auto ClampFunc(const Source& source, const type::Type* elem_ty);
+ auto ClampFunc(const Source& source, const core::type::Type* elem_ty);
/// Returns a callable that calls SqrtFunc, and creates a Constant with its
/// result of type `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
/// @returns the callable function
- auto SqrtFunc(const Source& source, const type::Type* elem_ty);
+ auto SqrtFunc(const Source& source, const core::type::Type* elem_ty);
/// Returns the dot product of v1 and v2.
/// @param source the source location
@@ -1183,7 +1247,7 @@
/// @param ty the return type
/// @param c0 the constant to calculate the length of
/// @returns the length of c0
- Result Length(const Source& source, const type::Type* ty, const Value* c0);
+ Result Length(const Source& source, const core::type::Type* ty, const Value* c0);
/// Returns the product of v1 and v2
/// @param source the source location
@@ -1191,7 +1255,7 @@
/// @param v1 lhs value
/// @param v2 rhs value
/// @returns the product of v1 and v2
- Result Mul(const Source& source, const type::Type* ty, const Value* v1, const Value* v2);
+ Result Mul(const Source& source, const core::type::Type* ty, const Value* v1, const Value* v2);
/// Returns the difference between v2 and v1
/// @param source the source location
@@ -1199,7 +1263,7 @@
/// @param v1 lhs value
/// @param v2 rhs value
/// @returns the difference between v2 and v1
- Result Sub(const Source& source, const type::Type* ty, const Value* v1, const Value* v2);
+ Result Sub(const Source& source, const core::type::Type* ty, const Value* v1, const Value* v2);
private:
Manager& mgr;
diff --git a/src/tint/lang/core/constant/eval_binary_op_test.cc b/src/tint/lang/core/constant/eval_binary_op_test.cc
index 89e2247..8eff2f8 100644
--- a/src/tint/lang/core/constant/eval_binary_op_test.cc
+++ b/src/tint/lang/core/constant/eval_binary_op_test.cc
@@ -1195,7 +1195,7 @@
auto* sem2 = Sem().Get(expr2);
ASSERT_NE(sem2, nullptr);
- auto aint_ty = create<type::AbstractInt>();
+ auto aint_ty = create<core::type::AbstractInt>();
EXPECT_EQ(sem1->Type(), aint_ty);
EXPECT_EQ(sem2->Type(), aint_ty);
}
diff --git a/src/tint/lang/core/constant/eval_builtin_test.cc b/src/tint/lang/core/constant/eval_builtin_test.cc
index 75d1c11..22e8bf4 100644
--- a/src/tint/lang/core/constant/eval_builtin_test.cc
+++ b/src/tint/lang/core/constant/eval_builtin_test.cc
@@ -166,7 +166,7 @@
ASSERT_NE(value, nullptr);
EXPECT_TYPE(value->Type(), sem->Type());
- if (value->Type()->Is<type::Struct>()) {
+ if (value->Type()->Is<core::type::Struct>()) {
// The result type of the constant-evaluated expression is a structure.
// Compare each of the fields individually.
for (size_t i = 0; i < expected_case.values.Length(); i++) {
diff --git a/src/tint/lang/core/constant/eval_construction_test.cc b/src/tint/lang/core/constant/eval_construction_test.cc
index e5c7b3d..4e9ae4ea 100644
--- a/src/tint/lang/core/constant/eval_construction_test.cc
+++ b/src/tint/lang/core/constant/eval_construction_test.cc
@@ -29,7 +29,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::AbstractFloat>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -45,7 +45,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::AbstractInt>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::AbstractInt>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -60,7 +60,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::I32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -75,7 +75,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::U32>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::U32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -90,7 +90,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::F32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -107,7 +107,7 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::F16>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::F16>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -123,7 +123,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::Bool>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::Bool>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -155,16 +155,16 @@
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->AllZero());
- if (sem->Type()->Is<type::Scalar>()) {
+ if (sem->Type()->Is<core::type::Scalar>()) {
EXPECT_EQ(sem->ConstantValue()->Index(0), nullptr);
EXPECT_EQ(sem->ConstantValue()->ValueAs<f32>(), 0.0f);
- } else if (auto* vec = sem->Type()->As<type::Vector>()) {
+ } else if (auto* vec = sem->Type()->As<core::type::Vector>()) {
for (size_t i = 0; i < vec->Width(); ++i) {
EXPECT_TRUE(sem->ConstantValue()->Index(i)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(i)->AllZero());
EXPECT_EQ(sem->ConstantValue()->Index(i)->ValueAs<f32>(), 0.0f);
}
- } else if (auto* mat = sem->Type()->As<type::Matrix>()) {
+ } else if (auto* mat = sem->Type()->As<core::type::Matrix>()) {
for (size_t i = 0; i < mat->columns(); ++i) {
EXPECT_TRUE(sem->ConstantValue()->Index(i)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(i)->AllZero());
@@ -174,7 +174,7 @@
EXPECT_EQ(sem->ConstantValue()->Index(i)->Index(j)->ValueAs<f32>(), 0.0f);
}
}
- } else if (auto* arr = sem->Type()->As<type::Array>()) {
+ } else if (auto* arr = sem->Type()->As<core::type::Array>()) {
for (size_t i = 0; i < *(arr->ConstantCount()); ++i) {
EXPECT_TRUE(sem->ConstantValue()->Index(i)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(i)->AllZero());
@@ -216,9 +216,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -245,9 +245,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::U32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::U32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -274,9 +274,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -305,9 +305,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -334,9 +334,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::Bool>());
+ EXPECT_TRUE(vec->type()->Is<core::type::Bool>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -363,9 +363,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -392,9 +392,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::U32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::U32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -421,9 +421,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -452,9 +452,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -482,9 +482,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::Bool>());
+ EXPECT_TRUE(vec->type()->Is<core::type::Bool>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -512,9 +512,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::AbstractInt>());
+ EXPECT_TRUE(vec->type()->Is<core::type::AbstractInt>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -542,9 +542,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(vec->type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -571,9 +571,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -600,9 +600,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::U32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::U32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -629,9 +629,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -660,9 +660,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -689,9 +689,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::Bool>());
+ EXPECT_TRUE(vec->type()->Is<core::type::Bool>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -718,9 +718,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -747,9 +747,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::U32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::U32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -776,9 +776,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -805,9 +805,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -834,9 +834,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -863,9 +863,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -892,9 +892,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -923,9 +923,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -954,9 +954,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -985,9 +985,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -1016,9 +1016,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -1047,9 +1047,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -1076,9 +1076,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::Bool>());
+ EXPECT_TRUE(vec->type()->Is<core::type::Bool>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -1105,9 +1105,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::Bool>());
+ EXPECT_TRUE(vec->type()->Is<core::type::Bool>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -1134,9 +1134,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::Bool>());
+ EXPECT_TRUE(vec->type()->Is<core::type::Bool>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -1163,9 +1163,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* mat = sem->Type()->As<type::Matrix>();
+ auto* mat = sem->Type()->As<core::type::Matrix>();
ASSERT_NE(mat, nullptr);
- EXPECT_TRUE(mat->type()->Is<type::F32>());
+ EXPECT_TRUE(mat->type()->Is<core::type::F32>());
EXPECT_EQ(mat->columns(), 2u);
EXPECT_EQ(mat->rows(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -1207,9 +1207,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* mat = sem->Type()->As<type::Matrix>();
+ auto* mat = sem->Type()->As<core::type::Matrix>();
ASSERT_NE(mat, nullptr);
- EXPECT_TRUE(mat->type()->Is<type::F16>());
+ EXPECT_TRUE(mat->type()->Is<core::type::F16>());
EXPECT_EQ(mat->columns(), 2u);
EXPECT_EQ(mat->rows(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -1249,9 +1249,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* mat = sem->Type()->As<type::Matrix>();
+ auto* mat = sem->Type()->As<core::type::Matrix>();
ASSERT_NE(mat, nullptr);
- EXPECT_TRUE(mat->type()->Is<type::F32>());
+ EXPECT_TRUE(mat->type()->Is<core::type::F32>());
EXPECT_EQ(mat->columns(), 3u);
EXPECT_EQ(mat->rows(), 2u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -1294,9 +1294,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* mat = sem->Type()->As<type::Matrix>();
+ auto* mat = sem->Type()->As<core::type::Matrix>();
ASSERT_NE(mat, nullptr);
- EXPECT_TRUE(mat->type()->Is<type::F32>());
+ EXPECT_TRUE(mat->type()->Is<core::type::F32>());
EXPECT_EQ(mat->columns(), 3u);
EXPECT_EQ(mat->rows(), 2u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -1336,9 +1336,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::I32>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::I32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->AllZero());
@@ -1368,9 +1368,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::F32>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::F32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->AllZero());
@@ -1400,9 +1400,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::Vector>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::Vector>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->AllZero());
@@ -1444,9 +1444,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::Struct>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::Struct>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->AllZero());
@@ -1476,9 +1476,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::I32>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::I32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -1523,7 +1523,7 @@
auto* sem = Sem().GetVal(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -1568,10 +1568,10 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* outer_arr = sem->Type()->As<type::Array>();
+ auto* outer_arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(outer_arr, nullptr);
- EXPECT_TRUE(outer_arr->ElemType()->Is<type::Array>());
- EXPECT_TRUE(outer_arr->ElemType()->As<type::Array>()->ElemType()->Is<type::F32>());
+ EXPECT_TRUE(outer_arr->ElemType()->Is<core::type::Array>());
+ EXPECT_TRUE(outer_arr->ElemType()->As<core::type::Array>()->ElemType()->Is<core::type::F32>());
auto* arr = sem->ConstantValue();
EXPECT_FALSE(arr->AnyZero());
@@ -1600,9 +1600,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::F32>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::F32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -1633,9 +1633,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::Vector>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::Vector>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -1661,9 +1661,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
- EXPECT_TRUE(arr->ElemType()->Is<type::Struct>());
+ EXPECT_TRUE(arr->ElemType()->Is<core::type::Struct>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -1703,7 +1703,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 5u);
@@ -1711,15 +1711,15 @@
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs<i32>(), 0);
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::U32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::U32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs<u32>(), 0u);
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs<f32>(), 0.0f);
- EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<type::F16>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<core::type::F16>());
EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs<f16>(), 0.0f);
- EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<type::Bool>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<core::type::Bool>());
EXPECT_EQ(sem->ConstantValue()->Index(4)->ValueAs<bool>(), false);
for (size_t i = 0; i < str->Members().Length(); ++i) {
@@ -1750,7 +1750,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 1u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -1761,15 +1761,15 @@
EXPECT_TRUE(inner_struct->AnyZero());
EXPECT_TRUE(inner_struct->AllZero());
- EXPECT_TRUE(inner_struct->Index(0)->Type()->Is<type::I32>());
+ EXPECT_TRUE(inner_struct->Index(0)->Type()->Is<core::type::I32>());
EXPECT_EQ(inner_struct->Index(0)->ValueAs<i32>(), 0);
- EXPECT_TRUE(inner_struct->Index(1)->Type()->Is<type::U32>());
+ EXPECT_TRUE(inner_struct->Index(1)->Type()->Is<core::type::U32>());
EXPECT_EQ(inner_struct->Index(1)->ValueAs<u32>(), 0u);
- EXPECT_TRUE(inner_struct->Index(2)->Type()->Is<type::F32>());
+ EXPECT_TRUE(inner_struct->Index(2)->Type()->Is<core::type::F32>());
EXPECT_EQ(inner_struct->Index(2)->ValueAs<f32>(), 0.0f);
- EXPECT_TRUE(inner_struct->Index(3)->Type()->Is<type::F16>());
+ EXPECT_TRUE(inner_struct->Index(3)->Type()->Is<core::type::F16>());
EXPECT_EQ(inner_struct->Index(3)->ValueAs<f16>(), 0.0f);
- EXPECT_TRUE(inner_struct->Index(4)->Type()->Is<type::Bool>());
+ EXPECT_TRUE(inner_struct->Index(4)->Type()->Is<core::type::Bool>());
EXPECT_EQ(inner_struct->Index(4)->ValueAs<bool>(), false);
for (size_t i = 0; i < str->Members().Length(); ++i) {
@@ -1787,7 +1787,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 3u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -1797,17 +1797,17 @@
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs<i32>(), 0_i);
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs<i32>(), 0_i);
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs<i32>(), 0_i);
}
@@ -1828,7 +1828,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 5u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -1838,27 +1838,27 @@
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs<i32>(), 0_i);
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::U32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::U32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs<u32>(), 0_u);
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs<f32>(), 0._f);
EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<type::F16>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<core::type::F16>());
EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs<f16>(), 0._h);
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<type::Bool>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<core::type::Bool>());
EXPECT_EQ(sem->ConstantValue()->Index(4)->ValueAs<bool>(), false);
}
@@ -1875,7 +1875,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 3u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -1885,27 +1885,39 @@
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(0)->Type()->As<type::Vector>()->type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(0)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs<f32>(), 0._f);
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(1)->Type()->As<type::Vector>()->type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(1)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs<f32>(), 0._f);
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(2)->Type()->As<type::Vector>()->type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(2)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->ValueAs<f32>(), 0._f);
@@ -1928,7 +1940,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 5u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -1938,26 +1950,38 @@
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(0)->Type()->As<type::Vector>()->type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(0)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs<i32>(), 0_i);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs<i32>(), 0_i);
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(1)->Type()->As<type::Vector>()->type()->Is<type::U32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(1)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::U32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs<u32>(), 0_u);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs<u32>(), 0_u);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs<u32>(), 0_u);
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(2)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(2)->Type()->As<type::Vector>()->type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(2)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs<f32>(), 0._f);
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->ValueAs<f32>(), 0._f);
@@ -1965,18 +1989,26 @@
EXPECT_TRUE(sem->ConstantValue()->Index(3)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(3)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(3)->Type()->As<type::Vector>()->type()->Is<type::F16>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(3)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F16>());
EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->ValueAs<f16>(), 0._h);
EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->ValueAs<f16>(), 0._h);
EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->ValueAs<f16>(), 0._h);
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(4)->Type()->As<type::Vector>()->type()->Is<type::Bool>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(4)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::Bool>());
EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->ValueAs<bool>(), false);
EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->ValueAs<bool>(), false);
}
@@ -1999,7 +2031,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 2u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -2009,14 +2041,14 @@
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::Struct>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::Struct>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs<i32>(), 0_i);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs<u32>(), 0_u);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs<f32>(), 0_f);
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::Struct>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::Struct>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs<i32>(), 0_i);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs<u32>(), 0_u);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs<f32>(), 0_f);
@@ -2039,7 +2071,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 5u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -2049,27 +2081,27 @@
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->ValueAs<i32>(), 1_i);
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::U32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::U32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->ValueAs<u32>(), 2_u);
EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->ValueAs<f32>(), 3._f);
EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<type::F16>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<core::type::F16>());
EXPECT_EQ(sem->ConstantValue()->Index(3)->ValueAs<f16>(), 4._h);
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<type::Bool>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<core::type::Bool>());
EXPECT_EQ(sem->ConstantValue()->Index(4)->ValueAs<bool>(), false);
}
@@ -2091,7 +2123,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 5u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -2101,26 +2133,38 @@
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(0)->Type()->As<type::Vector>()->type()->Is<type::I32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(0)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::I32>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs<i32>(), 1_i);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs<i32>(), 1_i);
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(1)->Type()->As<type::Vector>()->type()->Is<type::U32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(1)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::U32>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs<u32>(), 2_u);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs<u32>(), 2_u);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs<u32>(), 2_u);
EXPECT_FALSE(sem->ConstantValue()->Index(2)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(2)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(2)->Type()->As<type::Vector>()->type()->Is<type::F32>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(2)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(2)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F32>());
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(0)->ValueAs<f32>(), 3._f);
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(1)->ValueAs<f32>(), 3._f);
EXPECT_EQ(sem->ConstantValue()->Index(2)->Index(2)->ValueAs<f32>(), 3._f);
@@ -2128,18 +2172,26 @@
EXPECT_FALSE(sem->ConstantValue()->Index(3)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(3)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(3)->Type()->As<type::Vector>()->type()->Is<type::F16>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(3)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(3)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::F16>());
EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(0)->ValueAs<f16>(), 4._h);
EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(1)->ValueAs<f16>(), 4._h);
EXPECT_EQ(sem->ConstantValue()->Index(3)->Index(2)->ValueAs<f16>(), 4._h);
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AnyZero());
EXPECT_TRUE(sem->ConstantValue()->Index(4)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<type::Vector>());
- EXPECT_TRUE(
- sem->ConstantValue()->Index(4)->Type()->As<type::Vector>()->type()->Is<type::Bool>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(4)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(sem->ConstantValue()
+ ->Index(4)
+ ->Type()
+ ->As<core::type::Vector>()
+ ->type()
+ ->Is<core::type::Bool>());
EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(0)->ValueAs<bool>(), false);
EXPECT_EQ(sem->ConstantValue()->Index(4)->Index(1)->ValueAs<bool>(), false);
}
@@ -2163,7 +2215,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 2u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -2173,14 +2225,14 @@
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::Struct>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::Struct>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs<i32>(), 1_i);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs<u32>(), 2_u);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(2)->ValueAs<f32>(), 3_f);
EXPECT_TRUE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::Struct>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::Struct>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs<i32>(), 4_i);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs<u32>(), 0_u);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs<f32>(), 6_f);
@@ -2199,7 +2251,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* str = sem->Type()->As<type::Struct>();
+ auto* str = sem->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 2u);
ASSERT_NE(sem->ConstantValue(), nullptr);
@@ -2209,13 +2261,13 @@
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<type::Array>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(0)->Type()->Is<core::type::Array>());
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(0)->ValueAs<i32>(), 1_i);
EXPECT_EQ(sem->ConstantValue()->Index(0)->Index(1)->ValueAs<u32>(), 2_i);
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<type::Array>());
+ EXPECT_TRUE(sem->ConstantValue()->Index(1)->Type()->Is<core::type::Array>());
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(0)->ValueAs<i32>(), 1_f);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(1)->ValueAs<u32>(), 2_f);
EXPECT_EQ(sem->ConstantValue()->Index(1)->Index(2)->ValueAs<f32>(), 3_f);
diff --git a/src/tint/lang/core/constant/eval_conversion_test.cc b/src/tint/lang/core/constant/eval_conversion_test.cc
index b7e952d..23279d4 100644
--- a/src/tint/lang/core/constant/eval_conversion_test.cc
+++ b/src/tint/lang/core/constant/eval_conversion_test.cc
@@ -82,7 +82,7 @@
auto* target_sem_ty = type.sem(*this);
if (kind == Kind::kVector) {
- target_sem_ty = create<type::Vector>(target_sem_ty, 3u);
+ target_sem_ty = create<core::type::Vector>(target_sem_ty, 3u);
}
if (unrepresentable) {
@@ -233,9 +233,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -262,9 +262,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -293,9 +293,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -324,9 +324,9 @@
auto* sem = Sem().Get(expr);
EXPECT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -353,9 +353,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::I32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::I32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
@@ -382,9 +382,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::U32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::U32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -423,9 +423,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F16>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F16>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_TRUE(sem->ConstantValue()->AnyZero());
@@ -466,12 +466,12 @@
EXPECT_TRUE(c->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(c->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(c->ConstantValue()->Index(0)->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(c->ConstantValue()->Index(0)->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(c->ConstantValue()->Index(0)->ValueAs<AFloat>(), 0_f);
EXPECT_TRUE(c->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(c->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(c->ConstantValue()->Index(1)->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(c->ConstantValue()->Index(1)->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(c->ConstantValue()->Index(1)->ValueAs<AFloat>(), 0_a);
auto* v = Sem().GetVal(materialized);
@@ -483,12 +483,12 @@
EXPECT_TRUE(v->ConstantValue()->Index(0)->AnyZero());
EXPECT_TRUE(v->ConstantValue()->Index(0)->AllZero());
- EXPECT_TRUE(v->ConstantValue()->Index(0)->Type()->Is<type::F32>());
+ EXPECT_TRUE(v->ConstantValue()->Index(0)->Type()->Is<core::type::F32>());
EXPECT_EQ(v->ConstantValue()->Index(0)->ValueAs<f32>(), 0_f);
EXPECT_TRUE(v->ConstantValue()->Index(1)->AnyZero());
EXPECT_TRUE(v->ConstantValue()->Index(1)->AllZero());
- EXPECT_TRUE(v->ConstantValue()->Index(1)->Type()->Is<type::F32>());
+ EXPECT_TRUE(v->ConstantValue()->Index(1)->Type()->Is<core::type::F32>());
EXPECT_EQ(v->ConstantValue()->Index(1)->ValueAs<f32>(), 0_f);
}
diff --git a/src/tint/lang/core/constant/eval_indexing_test.cc b/src/tint/lang/core/constant/eval_indexing_test.cc
index 8ee61b4..c84a71e 100644
--- a/src/tint/lang/core/constant/eval_indexing_test.cc
+++ b/src/tint/lang/core/constant/eval_indexing_test.cc
@@ -28,7 +28,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- ASSERT_TRUE(sem->Type()->Is<type::I32>());
+ ASSERT_TRUE(sem->Type()->Is<core::type::I32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -131,7 +131,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- ASSERT_TRUE(sem->Type()->Is<type::I32>());
+ ASSERT_TRUE(sem->Type()->Is<core::type::I32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -146,7 +146,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
EXPECT_EQ(vec->Width(), 2u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -170,7 +170,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- ASSERT_TRUE(sem->Type()->Is<type::I32>());
+ ASSERT_TRUE(sem->Type()->Is<core::type::I32>());
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
EXPECT_FALSE(sem->ConstantValue()->AnyZero());
EXPECT_FALSE(sem->ConstantValue()->AllZero());
@@ -188,7 +188,7 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
EXPECT_EQ(vec->Width(), 2u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -235,9 +235,9 @@
auto* sem = Sem().Get(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
- EXPECT_TRUE(vec->type()->Is<type::F32>());
+ EXPECT_TRUE(vec->type()->Is<core::type::F32>());
EXPECT_EQ(vec->Width(), 3u);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -303,9 +303,9 @@
{
auto* mat = Sem().Get(mat_expr);
EXPECT_NE(mat, nullptr);
- auto* ty = mat->Type()->As<type::Matrix>();
+ auto* ty = mat->Type()->As<core::type::Matrix>();
ASSERT_NE(mat->Type(), nullptr);
- EXPECT_TRUE(ty->ColumnType()->Is<type::Vector>());
+ EXPECT_TRUE(ty->ColumnType()->Is<core::type::Vector>());
EXPECT_EQ(ty->columns(), 2u);
EXPECT_EQ(ty->rows(), 3u);
EXPECT_EQ(mat->ConstantValue()->Type(), mat->Type());
@@ -339,9 +339,9 @@
{
auto* vec = Sem().Get(vec_expr);
EXPECT_NE(vec, nullptr);
- auto* ty = vec->Type()->As<type::Vector>();
+ auto* ty = vec->Type()->As<core::type::Vector>();
ASSERT_NE(vec->Type(), nullptr);
- EXPECT_TRUE(ty->type()->Is<type::F32>());
+ EXPECT_TRUE(ty->type()->Is<core::type::F32>());
EXPECT_EQ(ty->Width(), 3u);
EXPECT_EQ(vec->ConstantValue()->Type(), vec->Type());
EXPECT_TRUE(vec->ConstantValue()->AnyZero());
@@ -362,7 +362,7 @@
{
auto* f = Sem().Get(f32_expr);
EXPECT_NE(f, nullptr);
- EXPECT_TRUE(f->Type()->Is<type::F32>());
+ EXPECT_TRUE(f->Type()->Is<core::type::F32>());
EXPECT_EQ(f->ConstantValue()->Type(), f->Type());
EXPECT_FALSE(f->ConstantValue()->AnyZero());
EXPECT_FALSE(f->ConstantValue()->AllZero());
diff --git a/src/tint/lang/core/constant/eval_member_access_test.cc b/src/tint/lang/core/constant/eval_member_access_test.cc
index 34a3007..fb6271d 100644
--- a/src/tint/lang/core/constant/eval_member_access_test.cc
+++ b/src/tint/lang/core/constant/eval_member_access_test.cc
@@ -42,7 +42,7 @@
auto* outer = Sem().Get(outer_expr);
ASSERT_NE(outer, nullptr);
- auto* str = outer->Type()->As<type::Struct>();
+ auto* str = outer->Type()->As<core::type::Struct>();
ASSERT_NE(str, nullptr);
EXPECT_EQ(str->Members().Length(), 2u);
ASSERT_NE(outer->ConstantValue(), nullptr);
@@ -54,7 +54,7 @@
ASSERT_NE(o1->ConstantValue(), nullptr);
EXPECT_FALSE(o1->ConstantValue()->AnyZero());
EXPECT_FALSE(o1->ConstantValue()->AllZero());
- EXPECT_TRUE(o1->ConstantValue()->Type()->Is<type::Struct>());
+ EXPECT_TRUE(o1->ConstantValue()->Type()->Is<core::type::Struct>());
EXPECT_EQ(o1->ConstantValue()->Index(0)->ValueAs<i32>(), 1_i);
EXPECT_EQ(o1->ConstantValue()->Index(1)->ValueAs<u32>(), 2_u);
EXPECT_EQ(o1->ConstantValue()->Index(2)->ValueAs<f32>(), 3_f);
@@ -64,7 +64,7 @@
ASSERT_NE(i2->ConstantValue(), nullptr);
EXPECT_FALSE(i2->ConstantValue()->AnyZero());
EXPECT_FALSE(i2->ConstantValue()->AllZero());
- EXPECT_TRUE(i2->ConstantValue()->Type()->Is<type::U32>());
+ EXPECT_TRUE(i2->ConstantValue()->Type()->Is<core::type::U32>());
EXPECT_EQ(i2->ConstantValue()->ValueAs<u32>(), 2_u);
}
@@ -78,11 +78,11 @@
auto* sem = Sem().Get(c);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::Matrix>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::Matrix>());
auto* cv = sem->ConstantValue();
EXPECT_TYPE(cv->Type(), sem->Type());
- EXPECT_TRUE(cv->Index(0)->Type()->Is<type::Vector>());
- EXPECT_TRUE(cv->Index(0)->Index(0)->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(cv->Index(0)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(cv->Index(0)->Index(0)->Type()->Is<core::type::AbstractFloat>());
EXPECT_FALSE(cv->AnyZero());
EXPECT_FALSE(cv->AllZero());
auto* c0 = cv->Index(0);
@@ -116,56 +116,56 @@
auto* sem = Sem().Get(c);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::Matrix>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::Matrix>());
auto* cv = sem->ConstantValue();
EXPECT_TYPE(cv->Type(), sem->Type());
- EXPECT_TRUE(cv->Index(0)->Type()->Is<type::Vector>());
- EXPECT_TRUE(cv->Index(0)->Index(0)->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(cv->Index(0)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(cv->Index(0)->Index(0)->Type()->Is<core::type::AbstractFloat>());
EXPECT_FALSE(cv->AnyZero());
EXPECT_FALSE(cv->AllZero());
auto* sem_col0 = Sem().Get(col_0);
ASSERT_NE(sem_col0, nullptr);
- EXPECT_TRUE(sem_col0->Type()->Is<type::Vector>());
+ EXPECT_TRUE(sem_col0->Type()->Is<core::type::Vector>());
EXPECT_EQ(sem_col0->ConstantValue()->Index(0)->ValueAs<AFloat>(), 1.0);
EXPECT_EQ(sem_col0->ConstantValue()->Index(1)->ValueAs<AFloat>(), 2.0);
EXPECT_EQ(sem_col0->ConstantValue()->Index(2)->ValueAs<AFloat>(), 3.0);
auto* sem_col1 = Sem().Get(col_1);
ASSERT_NE(sem_col1, nullptr);
- EXPECT_TRUE(sem_col1->Type()->Is<type::Vector>());
+ EXPECT_TRUE(sem_col1->Type()->Is<core::type::Vector>());
EXPECT_EQ(sem_col1->ConstantValue()->Index(0)->ValueAs<AFloat>(), 4.0);
EXPECT_EQ(sem_col1->ConstantValue()->Index(1)->ValueAs<AFloat>(), 5.0);
EXPECT_EQ(sem_col1->ConstantValue()->Index(2)->ValueAs<AFloat>(), 6.0);
auto* sem_e00 = Sem().Get(e00);
ASSERT_NE(sem_e00, nullptr);
- EXPECT_TRUE(sem_e00->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem_e00->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(sem_e00->ConstantValue()->ValueAs<AFloat>(), 1.0);
auto* sem_e01 = Sem().Get(e01);
ASSERT_NE(sem_e01, nullptr);
- EXPECT_TRUE(sem_e01->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem_e01->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(sem_e01->ConstantValue()->ValueAs<AFloat>(), 2.0);
auto* sem_e02 = Sem().Get(e02);
ASSERT_NE(sem_e02, nullptr);
- EXPECT_TRUE(sem_e02->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem_e02->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(sem_e02->ConstantValue()->ValueAs<AFloat>(), 3.0);
auto* sem_e10 = Sem().Get(e10);
ASSERT_NE(sem_e10, nullptr);
- EXPECT_TRUE(sem_e10->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem_e10->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(sem_e10->ConstantValue()->ValueAs<AFloat>(), 4.0);
auto* sem_e11 = Sem().Get(e11);
ASSERT_NE(sem_e11, nullptr);
- EXPECT_TRUE(sem_e11->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem_e11->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(sem_e11->ConstantValue()->ValueAs<AFloat>(), 5.0);
auto* sem_e12 = Sem().Get(e12);
ASSERT_NE(sem_e12, nullptr);
- EXPECT_TRUE(sem_e12->Type()->Is<type::AbstractFloat>());
+ EXPECT_TRUE(sem_e12->Type()->Is<core::type::AbstractFloat>());
EXPECT_EQ(sem_e12->ConstantValue()->ValueAs<AFloat>(), 6.0);
}
@@ -192,56 +192,56 @@
auto* sem = Sem().Get(c);
ASSERT_NE(sem, nullptr);
- EXPECT_TRUE(sem->Type()->Is<type::Matrix>());
+ EXPECT_TRUE(sem->Type()->Is<core::type::Matrix>());
auto* cv = sem->ConstantValue();
EXPECT_TYPE(cv->Type(), sem->Type());
- EXPECT_TRUE(cv->Index(0)->Type()->Is<type::Vector>());
- EXPECT_TRUE(cv->Index(0)->Index(0)->Type()->Is<type::F32>());
+ EXPECT_TRUE(cv->Index(0)->Type()->Is<core::type::Vector>());
+ EXPECT_TRUE(cv->Index(0)->Index(0)->Type()->Is<core::type::F32>());
EXPECT_FALSE(cv->AnyZero());
EXPECT_FALSE(cv->AllZero());
auto* sem_col0 = Sem().Get(col_0);
ASSERT_NE(sem_col0, nullptr);
- EXPECT_TRUE(sem_col0->Type()->Is<type::Vector>());
+ EXPECT_TRUE(sem_col0->Type()->Is<core::type::Vector>());
EXPECT_EQ(sem_col0->ConstantValue()->Index(0)->ValueAs<f32>(), 1.0f);
EXPECT_EQ(sem_col0->ConstantValue()->Index(1)->ValueAs<f32>(), 2.0f);
EXPECT_EQ(sem_col0->ConstantValue()->Index(2)->ValueAs<f32>(), 3.0f);
auto* sem_col1 = Sem().Get(col_1);
ASSERT_NE(sem_col1, nullptr);
- EXPECT_TRUE(sem_col1->Type()->Is<type::Vector>());
+ EXPECT_TRUE(sem_col1->Type()->Is<core::type::Vector>());
EXPECT_EQ(sem_col1->ConstantValue()->Index(0)->ValueAs<f32>(), 4.0f);
EXPECT_EQ(sem_col1->ConstantValue()->Index(1)->ValueAs<f32>(), 5.0f);
EXPECT_EQ(sem_col1->ConstantValue()->Index(2)->ValueAs<f32>(), 6.0f);
auto* sem_e00 = Sem().Get(e00);
ASSERT_NE(sem_e00, nullptr);
- EXPECT_TRUE(sem_e00->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem_e00->Type()->Is<core::type::F32>());
EXPECT_EQ(sem_e00->ConstantValue()->ValueAs<f32>(), 1.0f);
auto* sem_e01 = Sem().Get(e01);
ASSERT_NE(sem_e01, nullptr);
- EXPECT_TRUE(sem_e01->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem_e01->Type()->Is<core::type::F32>());
EXPECT_EQ(sem_e01->ConstantValue()->ValueAs<f32>(), 2.0f);
auto* sem_e02 = Sem().Get(e02);
ASSERT_NE(sem_e02, nullptr);
- EXPECT_TRUE(sem_e02->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem_e02->Type()->Is<core::type::F32>());
EXPECT_EQ(sem_e02->ConstantValue()->ValueAs<f32>(), 3.0f);
auto* sem_e10 = Sem().Get(e10);
ASSERT_NE(sem_e10, nullptr);
- EXPECT_TRUE(sem_e10->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem_e10->Type()->Is<core::type::F32>());
EXPECT_EQ(sem_e10->ConstantValue()->ValueAs<f32>(), 4.0f);
auto* sem_e11 = Sem().Get(e11);
ASSERT_NE(sem_e11, nullptr);
- EXPECT_TRUE(sem_e11->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem_e11->Type()->Is<core::type::F32>());
EXPECT_EQ(sem_e11->ConstantValue()->ValueAs<f32>(), 5.0f);
auto* sem_e12 = Sem().Get(e12);
ASSERT_NE(sem_e12, nullptr);
- EXPECT_TRUE(sem_e12->Type()->Is<type::F32>());
+ EXPECT_TRUE(sem_e12->Type()->Is<core::type::F32>());
EXPECT_EQ(sem_e12->ConstantValue()->ValueAs<f32>(), 6.0f);
}
@@ -281,7 +281,7 @@
auto* sem = Sem().GetVal(expr);
ASSERT_NE(sem, nullptr);
- auto* arr = sem->Type()->As<type::Array>();
+ auto* arr = sem->Type()->As<core::type::Array>();
ASSERT_NE(arr, nullptr);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
@@ -356,7 +356,7 @@
auto* sem = Sem().GetVal(expr);
ASSERT_NE(sem, nullptr);
- auto* vec = sem->Type()->As<type::Vector>();
+ auto* vec = sem->Type()->As<core::type::Vector>();
ASSERT_NE(vec, nullptr);
EXPECT_TYPE(sem->ConstantValue()->Type(), sem->Type());
diff --git a/src/tint/lang/core/constant/eval_runtime_semantics_test.cc b/src/tint/lang/core/constant/eval_runtime_semantics_test.cc
index f9b5dec..1407e86 100644
--- a/src/tint/lang/core/constant/eval_runtime_semantics_test.cc
+++ b/src/tint/lang/core/constant/eval_runtime_semantics_test.cc
@@ -433,7 +433,8 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Normalize_ZeroLength) {
auto* zero = constants.Get(f32(0));
auto* vec =
- eval.VecSplat(create<type::Vector>(create<type::F32>(), 4u), Vector{zero}, {}).Get();
+ eval.VecSplat(create<core::type::Vector>(create<core::type::F32>(), 4u), Vector{zero}, {})
+ .Get();
auto result = eval.normalize(vec->Type(), Vector{vec}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->Index(0)->ValueAs<f32>(), 0.f);
@@ -447,8 +448,9 @@
auto* a = constants.Get(f32(75250.f));
auto* b = constants.Get(f32(42.1f));
auto* vec =
- eval.VecInitS(create<type::Vector>(create<type::F32>(), 2u), Vector{a, b}, {}).Get();
- auto result = eval.pack2x16float(create<type::U32>(), Vector{vec}, {});
+ eval.VecInitS(create<core::type::Vector>(create<core::type::F32>(), 2u), Vector{a, b}, {})
+ .Get();
+ auto result = eval.pack2x16float(create<core::type::U32>(), Vector{vec}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0x51430000);
EXPECT_EQ(error(), R"(warning: value 75250.0 cannot be represented as 'f16')");
@@ -465,7 +467,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Unpack2x16Float_OutOfRange) {
auto* a = constants.Get(u32(0x51437C00));
- auto result = eval.unpack2x16float(create<type::U32>(), Vector{a}, {});
+ auto result = eval.unpack2x16float(create<core::type::U32>(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_FLOAT_EQ(result.Get()->Index(0)->ValueAs<f32>(), 0.f);
EXPECT_FLOAT_EQ(result.Get()->Index(1)->ValueAs<f32>(), 42.09375f);
@@ -474,7 +476,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, QuantizeToF16_OutOfRange) {
auto* a = constants.Get(f32(75250.f));
- auto result = eval.quantizeToF16(create<type::U32>(), Vector{a}, {});
+ auto result = eval.quantizeToF16(create<core::type::U32>(), Vector{a}, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<u32>(), 0);
EXPECT_EQ(error(), R"(warning: value 75250.0 cannot be represented as 'f16')");
@@ -500,7 +502,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Bitcast_Infinity) {
auto* a = constants.Get(u32(0x7F800000));
- auto result = eval.Bitcast(create<type::F32>(), a, {});
+ auto result = eval.Bitcast(create<core::type::F32>(), a, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: value inf cannot be represented as 'f32')");
@@ -508,7 +510,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Bitcast_NaN) {
auto* a = constants.Get(u32(0x7FC00000));
- auto result = eval.Bitcast(create<type::F32>(), a, {});
+ auto result = eval.Bitcast(create<core::type::F32>(), a, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), 0.f);
EXPECT_EQ(error(), R"(warning: value nan cannot be represented as 'f32')");
@@ -516,7 +518,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Convert_F32_TooHigh) {
auto* a = constants.Get(AFloat::Highest());
- auto result = eval.Convert(create<type::F32>(), a, {});
+ auto result = eval.Convert(create<core::type::F32>(), a, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), f32::kHighestValue);
EXPECT_EQ(
@@ -526,7 +528,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Convert_F32_TooLow) {
auto* a = constants.Get(AFloat::Lowest());
- auto result = eval.Convert(create<type::F32>(), a, {});
+ auto result = eval.Convert(create<core::type::F32>(), a, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), f32::kLowestValue);
EXPECT_EQ(
@@ -536,7 +538,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Convert_F16_TooHigh) {
auto* a = constants.Get(f32(1000000.0));
- auto result = eval.Convert(create<type::F16>(), a, {});
+ auto result = eval.Convert(create<core::type::F16>(), a, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), f16::kHighestValue);
EXPECT_EQ(error(), R"(warning: value 1000000.0 cannot be represented as 'f16')");
@@ -544,7 +546,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Convert_F16_TooLow) {
auto* a = constants.Get(f32(-1000000.0));
- auto result = eval.Convert(create<type::F16>(), a, {});
+ auto result = eval.Convert(create<core::type::F16>(), a, {});
ASSERT_TRUE(result);
EXPECT_EQ(result.Get()->ValueAs<f32>(), f16::kLowestValue);
EXPECT_EQ(error(), R"(warning: value -1000000.0 cannot be represented as 'f16')");
@@ -552,7 +554,7 @@
TEST_F(ConstEvalRuntimeSemanticsTest, Vec_Overflow_SingleComponent) {
// Test that overflow for an element-wise vector operation only affects a single component.
- auto* vec4f = create<type::Vector>(create<type::F32>(), 4u);
+ auto* vec4f = create<core::type::Vector>(create<core::type::F32>(), 4u);
auto* a = eval.VecInitS(vec4f,
Vector{
constants.Get(f32(1)),
diff --git a/src/tint/lang/core/constant/eval_test.h b/src/tint/lang/core/constant/eval_test.h
index 0752b23..b874287 100644
--- a/src/tint/lang/core/constant/eval_test.h
+++ b/src/tint/lang/core/constant/eval_test.h
@@ -53,13 +53,13 @@
inline void CollectScalars(const constant::Value* c, Vector<builder::Scalar, N>& scalars) {
Switch(
c->Type(), //
- [&](const type::AbstractInt*) { scalars.Push(c->ValueAs<AInt>()); },
- [&](const type::AbstractFloat*) { scalars.Push(c->ValueAs<AFloat>()); },
- [&](const type::Bool*) { scalars.Push(c->ValueAs<bool>()); },
- [&](const type::I32*) { scalars.Push(c->ValueAs<i32>()); },
- [&](const type::U32*) { scalars.Push(c->ValueAs<u32>()); },
- [&](const type::F32*) { scalars.Push(c->ValueAs<f32>()); },
- [&](const type::F16*) { scalars.Push(c->ValueAs<f16>()); },
+ [&](const core::type::AbstractInt*) { scalars.Push(c->ValueAs<AInt>()); },
+ [&](const core::type::AbstractFloat*) { scalars.Push(c->ValueAs<AFloat>()); },
+ [&](const core::type::Bool*) { scalars.Push(c->ValueAs<bool>()); },
+ [&](const core::type::I32*) { scalars.Push(c->ValueAs<i32>()); },
+ [&](const core::type::U32*) { scalars.Push(c->ValueAs<u32>()); },
+ [&](const core::type::F32*) { scalars.Push(c->ValueAs<f32>()); },
+ [&](const core::type::F16*) { scalars.Push(c->ValueAs<f16>()); },
[&](Default) {
size_t i = 0;
while (auto* child = c->Index(i++)) {
diff --git a/src/tint/lang/core/constant/manager.cc b/src/tint/lang/core/constant/manager.cc
index 19d0b01..0a23ab4 100644
--- a/src/tint/lang/core/constant/manager.cc
+++ b/src/tint/lang/core/constant/manager.cc
@@ -37,7 +37,7 @@
Manager::~Manager() = default;
-const constant::Value* Manager::Composite(const type::Type* type,
+const constant::Value* Manager::Composite(const core::type::Type* type,
VectorRef<const constant::Value*> elements) {
if (elements.IsEmpty()) {
return nullptr;
@@ -68,7 +68,7 @@
return Get<constant::Composite>(type, std::move(elements), all_zero, any_zero);
}
-const constant::Splat* Manager::Splat(const type::Type* type,
+const constant::Splat* Manager::Splat(const core::type::Type* type,
const constant::Value* element,
size_t n) {
return Get<constant::Splat>(type, element, n);
diff --git a/src/tint/lang/core/constant/manager.h b/src/tint/lang/core/constant/manager.h
index 1ce7188..3cc27be 100644
--- a/src/tint/lang/core/constant/manager.h
+++ b/src/tint/lang/core/constant/manager.h
@@ -63,7 +63,7 @@
static Manager Wrap(const Manager& inner) {
Manager out;
out.values_.Wrap(inner.values_);
- out.types = type::Manager::Wrap(inner.types);
+ out.types = core::type::Manager::Wrap(inner.types);
return out;
}
@@ -89,7 +89,7 @@
/// @param type the composite type
/// @param elements the composite elements
/// @returns the value pointer
- const constant::Value* Composite(const type::Type* type,
+ const constant::Value* Composite(const core::type::Type* type,
VectorRef<const constant::Value*> elements);
/// Constructs a splat constant.
@@ -97,7 +97,9 @@
/// @param element the splat element
/// @param n the number of elements
/// @returns the value pointer
- const constant::Splat* Splat(const type::Type* type, const constant::Value* element, size_t n);
+ const constant::Splat* Splat(const core::type::Type* type,
+ const constant::Value* element,
+ size_t n);
/// @param value the constant value
/// @return a Scalar holding the i32 value @p value
@@ -128,7 +130,7 @@
const Scalar<AInt>* Get(AInt value);
/// The type manager
- type::Manager types;
+ core::type::Manager types;
private:
/// A specialization of Hasher for constant::Value
diff --git a/src/tint/lang/core/constant/manager_test.cc b/src/tint/lang/core/constant/manager_test.cc
index 6116644..f01a612 100644
--- a/src/tint/lang/core/constant/manager_test.cc
+++ b/src/tint/lang/core/constant/manager_test.cc
@@ -95,7 +95,7 @@
auto* c = cm.Get(1_i);
static_assert(std::is_same_v<const Scalar<i32>*, decltype(c)>);
- ASSERT_TRUE(Is<type::I32>(c->Type()));
+ ASSERT_TRUE(Is<core::type::I32>(c->Type()));
EXPECT_EQ(c->value, 1_i);
}
@@ -104,7 +104,7 @@
auto* c = cm.Get(1_u);
static_assert(std::is_same_v<const Scalar<u32>*, decltype(c)>);
- ASSERT_TRUE(Is<type::U32>(c->Type()));
+ ASSERT_TRUE(Is<core::type::U32>(c->Type()));
EXPECT_EQ(c->value, 1_u);
}
@@ -113,7 +113,7 @@
auto* c = cm.Get(1_f);
static_assert(std::is_same_v<const Scalar<f32>*, decltype(c)>);
- ASSERT_TRUE(Is<type::F32>(c->Type()));
+ ASSERT_TRUE(Is<core::type::F32>(c->Type()));
EXPECT_EQ(c->value, 1_f);
}
@@ -122,7 +122,7 @@
auto* c = cm.Get(1_h);
static_assert(std::is_same_v<const Scalar<f16>*, decltype(c)>);
- ASSERT_TRUE(Is<type::F16>(c->Type()));
+ ASSERT_TRUE(Is<core::type::F16>(c->Type()));
EXPECT_EQ(c->value, 1_h);
}
@@ -131,7 +131,7 @@
auto* c = cm.Get(true);
static_assert(std::is_same_v<const Scalar<bool>*, decltype(c)>);
- ASSERT_TRUE(Is<type::Bool>(c->Type()));
+ ASSERT_TRUE(Is<core::type::Bool>(c->Type()));
EXPECT_EQ(c->value, true);
}
@@ -140,7 +140,7 @@
auto* c = cm.Get(1._a);
static_assert(std::is_same_v<const Scalar<AFloat>*, decltype(c)>);
- ASSERT_TRUE(Is<type::AbstractFloat>(c->Type()));
+ ASSERT_TRUE(Is<core::type::AbstractFloat>(c->Type()));
EXPECT_EQ(c->value, 1._a);
}
@@ -149,7 +149,7 @@
auto* c = cm.Get(1_a);
static_assert(std::is_same_v<const Scalar<AInt>*, decltype(c)>);
- ASSERT_TRUE(Is<type::AbstractInt>(c->Type()));
+ ASSERT_TRUE(Is<core::type::AbstractInt>(c->Type()));
EXPECT_EQ(c->value, 1_a);
}
@@ -172,12 +172,12 @@
Manager inner;
Manager outer = Manager::Wrap(inner);
- inner.types.Get<type::I32>();
+ inner.types.Get<core::type::I32>();
EXPECT_EQ(count(inner.types), 1u);
EXPECT_EQ(count(outer.types), 0u);
- outer.types.Get<type::U32>();
+ outer.types.Get<core::type::U32>();
EXPECT_EQ(count(inner.types), 1u);
EXPECT_EQ(count(outer.types), 1u);
diff --git a/src/tint/lang/core/constant/scalar.h b/src/tint/lang/core/constant/scalar.h
index 4db63dc..2389d44 100644
--- a/src/tint/lang/core/constant/scalar.h
+++ b/src/tint/lang/core/constant/scalar.h
@@ -41,7 +41,7 @@
/// Constructor
/// @param t the scalar type
/// @param v the scalar value
- Scalar(const type::Type* t, T v) : type(t), value(v) {
+ Scalar(const core::type::Type* t, T v) : type(t), value(v) {
if constexpr (IsFloatingPoint<T>) {
TINT_ASSERT(std::isfinite(v.value));
}
@@ -49,7 +49,7 @@
~Scalar() override = default;
/// @copydoc Value::Type()
- const type::Type* Type() const override { return type; }
+ const core::type::Type* Type() const override { return type; }
/// @return nullptr, as Scalar does not hold any elements.
const Value* Index(size_t) const override { return nullptr; }
@@ -91,7 +91,7 @@
}
/// The scalar type
- type::Type const* const type;
+ core::type::Type const* const type;
/// The scalar value
const T value;
diff --git a/src/tint/lang/core/constant/scalar_test.cc b/src/tint/lang/core/constant/scalar_test.cc
index 8b991d4..e4651de 100644
--- a/src/tint/lang/core/constant/scalar_test.cc
+++ b/src/tint/lang/core/constant/scalar_test.cc
@@ -167,11 +167,11 @@
auto* val = constants.Get(12_i);
constant::Manager mgr;
- constant::CloneContext ctx{type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
+ constant::CloneContext ctx{core::type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
auto* r = val->Clone(ctx);
ASSERT_NE(r, nullptr);
- EXPECT_TRUE(r->type->Is<type::I32>());
+ EXPECT_TRUE(r->type->Is<core::type::I32>());
EXPECT_EQ(r->value, 12);
}
diff --git a/src/tint/lang/core/constant/splat.cc b/src/tint/lang/core/constant/splat.cc
index 097010b..66e3ce9 100644
--- a/src/tint/lang/core/constant/splat.cc
+++ b/src/tint/lang/core/constant/splat.cc
@@ -20,7 +20,8 @@
namespace tint::core::constant {
-Splat::Splat(const type::Type* t, const constant::Value* e, size_t n) : type(t), el(e), count(n) {}
+Splat::Splat(const core::type::Type* t, const constant::Value* e, size_t n)
+ : type(t), el(e), count(n) {}
Splat::~Splat() = default;
diff --git a/src/tint/lang/core/constant/splat.h b/src/tint/lang/core/constant/splat.h
index 3ba3e13..9ea51ec 100644
--- a/src/tint/lang/core/constant/splat.h
+++ b/src/tint/lang/core/constant/splat.h
@@ -32,11 +32,11 @@
/// @param t the splat type
/// @param e the splat element
/// @param n the number of items in the splat
- Splat(const type::Type* t, const Value* e, size_t n);
+ Splat(const core::type::Type* t, const Value* e, size_t n);
~Splat() override;
/// @returns the type of the splat
- const type::Type* Type() const override { return type; }
+ const core::type::Type* Type() const override { return type; }
/// Retrieve item at index @p i
/// @param i the index to retrieve
@@ -60,7 +60,7 @@
const Splat* Clone(CloneContext& ctx) const override;
/// The type of the splat element
- type::Type const* const type;
+ core::type::Type const* const type;
/// The element stored in the splat
const Value* el;
/// The number of items in the splat
diff --git a/src/tint/lang/core/constant/splat_test.cc b/src/tint/lang/core/constant/splat_test.cc
index 796ab5f..8e3fa47 100644
--- a/src/tint/lang/core/constant/splat_test.cc
+++ b/src/tint/lang/core/constant/splat_test.cc
@@ -25,7 +25,7 @@
using ConstantTest_Splat = TestHelper;
TEST_F(ConstantTest_Splat, AllZero) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* fPos0 = constants.Get(0_f);
auto* fNeg0 = constants.Get(-0_f);
@@ -41,7 +41,7 @@
}
TEST_F(ConstantTest_Splat, AnyZero) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* fPos0 = constants.Get(0_f);
auto* fNeg0 = constants.Get(-0_f);
@@ -57,7 +57,7 @@
}
TEST_F(ConstantTest_Splat, Index) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* f1 = constants.Get(1_f);
auto* sp = constants.Splat(vec3f, f1, 2);
@@ -71,16 +71,16 @@
}
TEST_F(ConstantTest_Splat, Clone) {
- auto* vec3i = create<type::Vector>(create<type::I32>(), 3u);
+ auto* vec3i = create<core::type::Vector>(create<core::type::I32>(), 3u);
auto* val = constants.Get(12_i);
auto* sp = constants.Splat(vec3i, val, 2);
constant::Manager mgr;
- constant::CloneContext ctx{type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
+ constant::CloneContext ctx{core::type::CloneContext{{nullptr}, {nullptr, &mgr.types}}, mgr};
auto* r = sp->Clone(ctx);
ASSERT_NE(r, nullptr);
- EXPECT_TRUE(r->type->Is<type::Vector>());
+ EXPECT_TRUE(r->type->Is<core::type::Vector>());
EXPECT_TRUE(r->el->Is<Scalar<tint::i32>>());
EXPECT_EQ(r->count, 2u);
}
diff --git a/src/tint/lang/core/constant/value.cc b/src/tint/lang/core/constant/value.cc
index c078af4..22806f7 100644
--- a/src/tint/lang/core/constant/value.cc
+++ b/src/tint/lang/core/constant/value.cc
@@ -84,10 +84,10 @@
return Switch(
Type(), //
- [&](const type::Vector* vec) { return elements_equal(vec->Width()); },
- [&](const type::Matrix* mat) { return elements_equal(mat->columns()); },
- [&](const type::Struct* str) { return elements_equal(str->Members().Length()); },
- [&](const type::Array* arr) {
+ [&](const core::type::Vector* vec) { return elements_equal(vec->Width()); },
+ [&](const core::type::Matrix* mat) { return elements_equal(mat->columns()); },
+ [&](const core::type::Struct* str) { return elements_equal(str->Members().Length()); },
+ [&](const core::type::Array* arr) {
if (auto n = arr->ConstantCount()) {
return elements_equal(*n);
}
diff --git a/src/tint/lang/core/constant/value.h b/src/tint/lang/core/constant/value.h
index 0e55b0c..b1bf5b3 100644
--- a/src/tint/lang/core/constant/value.h
+++ b/src/tint/lang/core/constant/value.h
@@ -35,7 +35,7 @@
~Value() override;
/// @returns the type of the value
- virtual const type::Type* Type() const = 0;
+ virtual const core::type::Type* Type() const = 0;
/// @param i the index of the element
/// @returns the child element with the given index, or nullptr if there are no children, or
diff --git a/src/tint/lang/core/constant/value_test.cc b/src/tint/lang/core/constant/value_test.cc
index 2fcc934..a8f9308 100644
--- a/src/tint/lang/core/constant/value_test.cc
+++ b/src/tint/lang/core/constant/value_test.cc
@@ -39,7 +39,7 @@
}
TEST_F(ConstantTest_Value, Equal_Splat_Splat) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* vec3f_1_1_1 = constants.Splat(vec3f, constants.Get(1_f), 3);
auto* vec3f_2_2_2 = constants.Splat(vec3f, constants.Get(2_f), 3);
@@ -50,7 +50,7 @@
}
TEST_F(ConstantTest_Value, Equal_Composite_Composite) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* vec3f_1_1_2 = constants.Composite(
vec3f, Vector{constants.Get(1_f), constants.Get(1_f), constants.Get(2_f)});
@@ -63,7 +63,7 @@
}
TEST_F(ConstantTest_Value, Equal_Splat_Composite) {
- auto* vec3f = create<type::Vector>(create<type::F32>(), 3u);
+ auto* vec3f = create<core::type::Vector>(create<core::type::F32>(), 3u);
auto* vec3f_1_1_1 = constants.Splat(vec3f, constants.Get(1_f), 3);
auto* vec3f_1_2_1 = constants.Composite(
diff --git a/src/tint/lang/core/intrinsic/table.cc b/src/tint/lang/core/intrinsic/table.cc
index 65443b0..9c29b12 100644
--- a/src/tint/lang/core/intrinsic/table.cc
+++ b/src/tint/lang/core/intrinsic/table.cc
@@ -35,10 +35,10 @@
const Number Number::any{Number::kAny};
const Number Number::invalid{Number::kInvalid};
-Any::Any() : Base(0u, type::Flags{}) {}
+Any::Any() : Base(0u, core::type::Flags{}) {}
Any::~Any() = default;
-bool Any::Equals(const type::UniqueNode&) const {
+bool Any::Equals(const core::type::UniqueNode&) const {
return false;
}
@@ -46,7 +46,7 @@
return "<any>";
}
-type::Type* Any::Clone(type::CloneContext&) const {
+core::type::Type* Any::Clone(core::type::CloneContext&) const {
return nullptr;
}
@@ -61,28 +61,28 @@
/// Impl is the private implementation of the Table interface.
class Impl : public Table {
public:
- Impl(const TableData& td, type::Manager& tys, SymbolTable& syms, diag::List& d);
+ Impl(const TableData& td, core::type::Manager& tys, SymbolTable& syms, diag::List& d);
Result<Overload> Lookup(core::Function builtin_type,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const Source& source) override;
Result<Overload> Lookup(core::UnaryOp op,
- const type::Type* arg,
+ const core::type::Type* arg,
EvaluationStage earliest_eval_stage,
const Source& source) override;
Result<Overload> Lookup(core::BinaryOp op,
- const type::Type* lhs,
- const type::Type* rhs,
+ const core::type::Type* lhs,
+ const core::type::Type* rhs,
EvaluationStage earliest_eval_stage,
const Source& source,
bool is_compound) override;
Result<Overload> Lookup(CtorConv type,
- const type::Type* template_arg,
- VectorRef<const type::Type*> args,
+ const core::type::Type* template_arg,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const Source& source) override;
@@ -126,7 +126,7 @@
/// @returns the matched intrinsic
Result<Table::Overload> MatchIntrinsic(const IntrinsicInfo& intrinsic,
const char* intrinsic_name,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
TemplateState templates,
const OnNoMatch& on_no_match) const;
@@ -139,7 +139,7 @@
/// template as `f32`.
/// @returns the evaluated Candidate information.
Candidate ScoreOverload(const OverloadInfo& overload,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const TemplateState& templates) const;
@@ -155,7 +155,7 @@
/// @returns the resolved Candidate.
Candidate ResolveCandidate(Candidates&& candidates,
const char* intrinsic_name,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
TemplateState templates) const;
/// Match constructs a new MatchState
@@ -181,12 +181,12 @@
/// Raises an error when no overload is a clear winner of overload resolution
void ErrAmbiguousOverload(const char* intrinsic_name,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
TemplateState templates,
VectorRef<Candidate> candidates) const;
const TableData& data;
- type::Manager& types;
+ core::type::Manager& types;
SymbolTable& symbols;
diag::List& diags;
};
@@ -194,8 +194,8 @@
/// @return a string representing a call to a builtin with the given argument
/// types.
std::string CallSignature(const char* intrinsic_name,
- VectorRef<const type::Type*> args,
- const type::Type* template_arg = nullptr) {
+ VectorRef<const core::type::Type*> args,
+ const core::type::Type* template_arg = nullptr) {
StringStream ss;
ss << intrinsic_name;
if (template_arg) {
@@ -217,11 +217,11 @@
return ss.str();
}
-Impl::Impl(const TableData& td, type::Manager& tys, SymbolTable& syms, diag::List& d)
+Impl::Impl(const TableData& td, core::type::Manager& tys, SymbolTable& syms, diag::List& d)
: data(td), types(tys), symbols(syms), diags(d) {}
Result<Table::Overload> Impl::Lookup(core::Function builtin_type,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const Source& source) {
const char* intrinsic_name = core::str(builtin_type);
@@ -245,7 +245,7 @@
}
Result<Table::Overload> Impl::Lookup(core::UnaryOp op,
- const type::Type* arg,
+ const core::type::Type* arg,
EvaluationStage earliest_eval_stage,
const Source& source) {
const IntrinsicInfo* intrinsic_info = nullptr;
@@ -289,8 +289,8 @@
}
Result<Table::Overload> Impl::Lookup(core::BinaryOp op,
- const type::Type* lhs,
- const type::Type* rhs,
+ const core::type::Type* lhs,
+ const core::type::Type* rhs,
EvaluationStage earliest_eval_stage,
const Source& source,
bool is_compound) {
@@ -392,8 +392,8 @@
}
Result<Table::Overload> Impl::Lookup(CtorConv type,
- const type::Type* template_arg,
- VectorRef<const type::Type*> args,
+ const core::type::Type* template_arg,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const Source& source) {
auto name = str(type);
@@ -439,7 +439,7 @@
Result<Table::Overload> Impl::MatchIntrinsic(const IntrinsicInfo& intrinsic,
const char* intrinsic_name,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
TemplateState templates,
const OnNoMatch& on_no_match) const {
@@ -479,7 +479,7 @@
}
// Build the return type
- const type::Type* return_type = nullptr;
+ const core::type::Type* return_type = nullptr;
if (auto* type_indices = data[match.overload->return_type_matcher_indices]) {
auto* number_indices = data[match.overload->return_number_matcher_indices];
Any any;
@@ -499,7 +499,7 @@
}
Impl::Candidate Impl::ScoreOverload(const OverloadInfo& overload,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const TemplateState& in_templates) const {
// Penalty weights for overload mismatching.
@@ -617,7 +617,7 @@
Impl::Candidate Impl::ResolveCandidate(Impl::Candidates&& candidates,
const char* intrinsic_name,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
TemplateState templates) const {
Vector<uint32_t, kNumFixedParams> best_ranks;
best_ranks.Resize(args.Length(), 0xffffffff);
@@ -630,7 +630,7 @@
bool some_won = false; // An argument ranked less than the 'best' overload's argument
bool some_lost = false; // An argument ranked more than the 'best' overload's argument
for (size_t i = 0; i < args.Length(); i++) {
- auto rank = type::Type::ConversionRank(args[i], candidate.parameters[i].type);
+ auto rank = core::type::Type::ConversionRank(args[i], candidate.parameters[i].type);
if (best_ranks[i] > rank) {
best_ranks[i] = rank;
some_won = true;
@@ -784,7 +784,7 @@
}
void Impl::ErrAmbiguousOverload(const char* intrinsic_name,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
TemplateState templates,
VectorRef<Candidate> candidates) const {
StringStream ss;
@@ -822,7 +822,7 @@
} // namespace
std::unique_ptr<Table> Table::Create(const TableData& data,
- type::Manager& types,
+ core::type::Manager& types,
SymbolTable& symbols,
diag::List& diags) {
return std::make_unique<Impl>(data, types, symbols, diags);
diff --git a/src/tint/lang/core/intrinsic/table.h b/src/tint/lang/core/intrinsic/table.h
index 91bdbbe..faae544 100644
--- a/src/tint/lang/core/intrinsic/table.h
+++ b/src/tint/lang/core/intrinsic/table.h
@@ -45,7 +45,7 @@
/// @param diags the diagnostic list to append errors to
/// @return a pointer to a newly created Table
static std::unique_ptr<Table> Create(const TableData& data,
- type::Manager& types,
+ core::type::Manager& types,
SymbolTable& symbols,
diag::List& diags);
@@ -57,7 +57,7 @@
/// Parameter describes a single parameter
struct Parameter {
/// Parameter type
- const type::Type* const type;
+ const core::type::Type* const type;
/// Parameter usage
core::ParameterUsage const usage = core::ParameterUsage::kNone;
@@ -78,7 +78,7 @@
const OverloadInfo* info = nullptr;
/// The resolved overload return type
- type::Type const* return_type = nullptr;
+ core::type::Type const* return_type = nullptr;
/// The resolved overload parameters
Vector<Parameter, 8> parameters;
@@ -113,7 +113,7 @@
/// @param source the source of the builtin call
/// @return the resolved builtin function overload
virtual Result<Overload> Lookup(core::Function type,
- VectorRef<const type::Type*> args,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const Source& source) = 0;
@@ -130,7 +130,7 @@
/// @param source the source of the operator call
/// @return the resolved unary operator overload
virtual Result<Overload> Lookup(core::UnaryOp op,
- const type::Type* arg,
+ const core::type::Type* arg,
EvaluationStage earliest_eval_stage,
const Source& source) = 0;
@@ -149,8 +149,8 @@
/// @param is_compound true if the binary operator is being used as a compound assignment
/// @return the resolved binary operator overload
virtual Result<Overload> Lookup(core::BinaryOp op,
- const type::Type* lhs,
- const type::Type* rhs,
+ const core::type::Type* lhs,
+ const core::type::Type* rhs,
EvaluationStage earliest_eval_stage,
const Source& source,
bool is_compound) = 0;
@@ -168,8 +168,8 @@
/// @param source the source of the call
/// @return the resolved type constructor or conversion function overload
virtual Result<Overload> Lookup(CtorConv type,
- const type::Type* template_arg,
- VectorRef<const type::Type*> args,
+ const core::type::Type* template_arg,
+ VectorRef<const core::type::Type*> args,
EvaluationStage earliest_eval_stage,
const Source& source) = 0;
};
diff --git a/src/tint/lang/core/intrinsic/table_data.h b/src/tint/lang/core/intrinsic/table_data.h
index 34c8083..baea171 100644
--- a/src/tint/lang/core/intrinsic/table_data.h
+++ b/src/tint/lang/core/intrinsic/table_data.h
@@ -256,17 +256,17 @@
};
/// A special type that matches all TypeMatchers
-class Any final : public Castable<Any, type::Type> {
+class Any final : public Castable<Any, core::type::Type> {
public:
Any();
~Any() override;
- /// @copydoc type::UniqueNode::Equals
- bool Equals(const type::UniqueNode& other) const override;
- /// @copydoc type::Type::FriendlyName
+ /// @copydoc core::type::UniqueNode::Equals
+ bool Equals(const core::type::UniqueNode& other) const override;
+ /// @copydoc core::type::Type::FriendlyName
std::string FriendlyName() const override;
- /// @copydoc type::Type::Clone
- type::Type* Clone(type::CloneContext& ctx) const override;
+ /// @copydoc core::type::Type::Clone
+ core::type::Type* Clone(core::type::CloneContext& ctx) const override;
};
/// TemplateState holds the state of the template numbers and types.
@@ -282,7 +282,7 @@
/// @param idx the index of the template type
/// @param ty the type
/// @returns true on match or newly defined
- const type::Type* Type(size_t idx, const type::Type* ty) {
+ const core::type::Type* Type(size_t idx, const core::type::Type* ty) {
if (idx >= types_.Length()) {
types_.Resize(idx + 1);
}
@@ -291,7 +291,7 @@
t = ty;
return ty;
}
- ty = type::Type::Common(Vector{t, ty});
+ ty = core::type::Type::Common(Vector{t, ty});
if (ty) {
t = ty;
}
@@ -319,7 +319,7 @@
/// @param idx the index of the template type
/// @returns the template type with index @p idx, or nullptr if the type was not
/// defined.
- const type::Type* Type(size_t idx) const {
+ const core::type::Type* Type(size_t idx) const {
if (idx >= types_.Length()) {
return nullptr;
}
@@ -329,7 +329,7 @@
/// SetType replaces the template type with index @p idx with type @p ty.
/// @param idx the index of the template type
/// @param ty the new type for the template
- void SetType(size_t idx, const type::Type* ty) {
+ void SetType(size_t idx, const core::type::Type* ty) {
if (idx >= types_.Length()) {
types_.Resize(idx + 1);
}
@@ -349,7 +349,7 @@
size_t Count() const { return types_.Length() + numbers_.Length(); }
private:
- Vector<const type::Type*, 4> types_;
+ Vector<const core::type::Type*, 4> types_;
Vector<Number, 2> numbers_;
};
@@ -366,7 +366,7 @@
/// @param type_matcher_indices the remaining type matcher indices
/// @param number_matcher_indices the remaining number matcher indices
/// @param s the required evaluation stage of the overload
- MatchState(type::Manager& ty_mgr,
+ MatchState(core::type::Manager& ty_mgr,
SymbolTable& syms,
TemplateState& t,
const TableData& d,
@@ -384,7 +384,7 @@
number_matcher_indices_(number_matcher_indices) {}
/// The type manager
- type::Manager& types;
+ core::type::Manager& types;
/// The symbol manager
SymbolTable& symbols;
@@ -405,7 +405,7 @@
/// @param ty the type to try matching
/// @returns the canonical expected type if the type matches, otherwise nullptr.
/// @note: The matcher indices are progressed on calling.
- inline const type::Type* Type(const type::Type* ty);
+ inline const core::type::Type* Type(const core::type::Type* ty);
/// Num uses the next NumMatcher from the matcher indices to match @p number.
/// @param number the number to try matching
@@ -435,7 +435,7 @@
/// Match may define and refine the template types and numbers in state.
/// The parameter `type` is the type to match
/// Returns the canonicalized type on match, otherwise nullptr
- using MatchFn = const type::Type*(MatchState& state, const type::Type* type);
+ using MatchFn = const core::type::Type*(MatchState& state, const core::type::Type* type);
/// @see #MatchFn
MatchFn* const match;
@@ -604,7 +604,7 @@
const IntrinsicInfo& unary_minus;
};
-const type::Type* MatchState::Type(const type::Type* ty) {
+const core::type::Type* MatchState::Type(const core::type::Type* ty) {
TypeMatcherIndex matcher_index{(*type_matcher_indices_++).value};
auto& matcher = data[matcher_index];
return matcher.match(*this, ty);
@@ -637,7 +637,7 @@
/// The TypeMatcher for the template type with the index `INDEX`
static constexpr TypeMatcher matcher{
/* match */
- [](MatchState& state, const type::Type* type) -> const type::Type* {
+ [](MatchState& state, const core::type::Type* type) -> const core::type::Type* {
if (type->Is<Any>()) {
return state.templates.Type(INDEX);
}
diff --git a/src/tint/lang/core/intrinsic/table_test.cc b/src/tint/lang/core/intrinsic/table_test.cc
index 3a63789..62aff6e 100644
--- a/src/tint/lang/core/intrinsic/table_test.cc
+++ b/src/tint/lang/core/intrinsic/table_test.cc
@@ -55,7 +55,7 @@
};
TEST_F(IntrinsicTableTest, MatchF32) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result =
table->Lookup(core::Function::kCos, Vector{f32}, EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -66,7 +66,7 @@
}
TEST_F(IntrinsicTableTest, MismatchF32) {
- auto* i32 = create<type::I32>();
+ auto* i32 = create<core::type::I32>();
auto result =
table->Lookup(core::Function::kCos, Vector{i32}, EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -74,9 +74,9 @@
}
TEST_F(IntrinsicTableTest, MatchU32) {
- auto* f32 = create<type::F32>();
- auto* u32 = create<type::U32>();
- auto* vec2_f32 = create<type::Vector>(f32, 2u);
+ auto* f32 = create<core::type::F32>();
+ auto* u32 = create<core::type::U32>();
+ auto* vec2_f32 = create<core::type::Vector>(f32, 2u);
auto result = table->Lookup(core::Function::kUnpack2X16Float, Vector{u32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -87,7 +87,7 @@
}
TEST_F(IntrinsicTableTest, MismatchU32) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(core::Function::kUnpack2X16Float, Vector{f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -95,10 +95,10 @@
}
TEST_F(IntrinsicTableTest, MatchI32) {
- auto* f32 = create<type::F32>();
- auto* i32 = create<type::I32>();
- auto* vec4_f32 = create<type::Vector>(f32, 4u);
- auto* tex = create<type::SampledTexture>(type::TextureDimension::k1d, f32);
+ auto* f32 = create<core::type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* vec4_f32 = create<core::type::Vector>(f32, 4u);
+ auto* tex = create<core::type::SampledTexture>(core::type::TextureDimension::k1d, f32);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, i32, i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -114,8 +114,8 @@
}
TEST_F(IntrinsicTableTest, MismatchI32) {
- auto* f32 = create<type::F32>();
- auto* tex = create<type::SampledTexture>(type::TextureDimension::k1d, f32);
+ auto* f32 = create<core::type::F32>();
+ auto* tex = create<core::type::SampledTexture>(core::type::TextureDimension::k1d, f32);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -123,7 +123,7 @@
}
TEST_F(IntrinsicTableTest, MatchIU32AsI32) {
- auto* i32 = create<type::I32>();
+ auto* i32 = create<core::type::I32>();
auto result = table->Lookup(core::Function::kCountOneBits, Vector{i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -134,7 +134,7 @@
}
TEST_F(IntrinsicTableTest, MatchIU32AsU32) {
- auto* u32 = create<type::U32>();
+ auto* u32 = create<core::type::U32>();
auto result = table->Lookup(core::Function::kCountOneBits, Vector{u32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -145,7 +145,7 @@
}
TEST_F(IntrinsicTableTest, MismatchIU32) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(core::Function::kCountOneBits, Vector{f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -153,7 +153,7 @@
}
TEST_F(IntrinsicTableTest, MatchFIU32AsI32) {
- auto* i32 = create<type::I32>();
+ auto* i32 = create<core::type::I32>();
auto result = table->Lookup(core::Function::kClamp, Vector{i32, i32, i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -166,7 +166,7 @@
}
TEST_F(IntrinsicTableTest, MatchFIU32AsU32) {
- auto* u32 = create<type::U32>();
+ auto* u32 = create<core::type::U32>();
auto result = table->Lookup(core::Function::kClamp, Vector{u32, u32, u32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -179,7 +179,7 @@
}
TEST_F(IntrinsicTableTest, MatchFIU32AsF32) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(core::Function::kClamp, Vector{f32, f32, f32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -192,7 +192,7 @@
}
TEST_F(IntrinsicTableTest, MismatchFIU32) {
- auto* bool_ = create<type::Bool>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::Function::kClamp, Vector{bool_, bool_, bool_},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -200,8 +200,8 @@
}
TEST_F(IntrinsicTableTest, MatchBool) {
- auto* f32 = create<type::F32>();
- auto* bool_ = create<type::Bool>();
+ auto* f32 = create<core::type::F32>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::Function::kSelect, Vector{f32, f32, bool_},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -214,7 +214,7 @@
}
TEST_F(IntrinsicTableTest, MismatchBool) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(core::Function::kSelect, Vector{f32, f32, f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -222,10 +222,10 @@
}
TEST_F(IntrinsicTableTest, MatchPointer) {
- auto* i32 = create<type::I32>();
- auto* atomicI32 = create<type::Atomic>(i32);
- auto* ptr =
- create<type::Pointer>(core::AddressSpace::kWorkgroup, atomicI32, core::Access::kReadWrite);
+ auto* i32 = create<core::type::I32>();
+ auto* atomicI32 = create<core::type::Atomic>(i32);
+ auto* ptr = create<core::type::Pointer>(core::AddressSpace::kWorkgroup, atomicI32,
+ core::Access::kReadWrite);
auto result = table->Lookup(core::Function::kAtomicLoad, Vector{ptr},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -236,8 +236,8 @@
}
TEST_F(IntrinsicTableTest, MismatchPointer) {
- auto* i32 = create<type::I32>();
- auto* atomicI32 = create<type::Atomic>(i32);
+ auto* i32 = create<core::type::I32>();
+ auto* atomicI32 = create<core::type::Atomic>(i32);
auto result = table->Lookup(core::Function::kAtomicLoad, Vector{atomicI32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -245,23 +245,23 @@
}
TEST_F(IntrinsicTableTest, MatchArray) {
- auto* arr =
- create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
+ auto* arr = create<core::type::Array>(create<core::type::U32>(),
+ create<core::type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
auto* arr_ptr =
- create<type::Pointer>(core::AddressSpace::kStorage, arr, core::Access::kReadWrite);
+ create<core::type::Pointer>(core::AddressSpace::kStorage, arr, core::Access::kReadWrite);
auto result = table->Lookup(core::Function::kArrayLength, Vector{arr_ptr},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
- EXPECT_TRUE(result->return_type->Is<type::U32>());
+ EXPECT_TRUE(result->return_type->Is<core::type::U32>());
ASSERT_EQ(result->parameters.Length(), 1u);
auto* param_type = result->parameters[0].type;
- ASSERT_TRUE(param_type->Is<type::Pointer>());
- EXPECT_TRUE(param_type->As<type::Pointer>()->StoreType()->Is<type::Array>());
+ ASSERT_TRUE(param_type->Is<core::type::Pointer>());
+ EXPECT_TRUE(param_type->As<core::type::Pointer>()->StoreType()->Is<core::type::Array>());
}
TEST_F(IntrinsicTableTest, MismatchArray) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(core::Function::kArrayLength, Vector{f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -269,11 +269,11 @@
}
TEST_F(IntrinsicTableTest, MatchSampler) {
- auto* f32 = create<type::F32>();
- auto* vec2_f32 = create<type::Vector>(f32, 2u);
- auto* vec4_f32 = create<type::Vector>(f32, 4u);
- auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
- auto* sampler = create<type::Sampler>(type::SamplerKind::kSampler);
+ auto* f32 = create<core::type::F32>();
+ auto* vec2_f32 = create<core::type::Vector>(f32, 2u);
+ auto* vec4_f32 = create<core::type::Vector>(f32, 4u);
+ auto* tex = create<core::type::SampledTexture>(core::type::TextureDimension::k2d, f32);
+ auto* sampler = create<core::type::Sampler>(core::type::SamplerKind::kSampler);
auto result = table->Lookup(core::Function::kTextureSample, Vector{tex, sampler, vec2_f32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -289,9 +289,9 @@
}
TEST_F(IntrinsicTableTest, MismatchSampler) {
- auto* f32 = create<type::F32>();
- auto* vec2_f32 = create<type::Vector>(f32, 2u);
- auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
+ auto* f32 = create<core::type::F32>();
+ auto* vec2_f32 = create<core::type::Vector>(f32, 2u);
+ auto* tex = create<core::type::SampledTexture>(core::type::TextureDimension::k2d, f32);
auto result = table->Lookup(core::Function::kTextureSample, Vector{tex, f32, vec2_f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -299,11 +299,11 @@
}
TEST_F(IntrinsicTableTest, MatchSampledTexture) {
- auto* i32 = create<type::I32>();
- auto* f32 = create<type::F32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto* vec4_f32 = create<type::Vector>(f32, 4u);
- auto* tex = create<type::SampledTexture>(type::TextureDimension::k2d, f32);
+ auto* i32 = create<core::type::I32>();
+ auto* f32 = create<core::type::F32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
+ auto* vec4_f32 = create<core::type::Vector>(f32, 4u);
+ auto* tex = create<core::type::SampledTexture>(core::type::TextureDimension::k2d, f32);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -319,11 +319,11 @@
}
TEST_F(IntrinsicTableTest, MatchMultisampledTexture) {
- auto* i32 = create<type::I32>();
- auto* f32 = create<type::F32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto* vec4_f32 = create<type::Vector>(f32, 4u);
- auto* tex = create<type::MultisampledTexture>(type::TextureDimension::k2d, f32);
+ auto* i32 = create<core::type::I32>();
+ auto* f32 = create<core::type::F32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
+ auto* vec4_f32 = create<core::type::Vector>(f32, 4u);
+ auto* tex = create<core::type::MultisampledTexture>(core::type::TextureDimension::k2d, f32);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -339,10 +339,10 @@
}
TEST_F(IntrinsicTableTest, MatchDepthTexture) {
- auto* f32 = create<type::F32>();
- auto* i32 = create<type::I32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto* tex = create<type::DepthTexture>(type::TextureDimension::k2d);
+ auto* f32 = create<core::type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
+ auto* tex = create<core::type::DepthTexture>(core::type::TextureDimension::k2d);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -358,10 +358,10 @@
}
TEST_F(IntrinsicTableTest, MatchDepthMultisampledTexture) {
- auto* f32 = create<type::F32>();
- auto* i32 = create<type::I32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto* tex = create<type::DepthMultisampledTexture>(type::TextureDimension::k2d);
+ auto* f32 = create<core::type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
+ auto* tex = create<core::type::DepthMultisampledTexture>(core::type::TextureDimension::k2d);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, vec2_i32, i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -377,11 +377,11 @@
}
TEST_F(IntrinsicTableTest, MatchExternalTexture) {
- auto* f32 = create<type::F32>();
- auto* i32 = create<type::I32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto* vec4_f32 = create<type::Vector>(f32, 4u);
- auto* tex = create<type::ExternalTexture>();
+ auto* f32 = create<core::type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
+ auto* vec4_f32 = create<core::type::Vector>(f32, 4u);
+ auto* tex = create<core::type::ExternalTexture>();
auto result = table->Lookup(core::Function::kTextureLoad, Vector{tex, vec2_i32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -395,13 +395,14 @@
}
TEST_F(IntrinsicTableTest, MatchWOStorageTexture) {
- auto* f32 = create<type::F32>();
- auto* i32 = create<type::I32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
- auto* vec4_f32 = create<type::Vector>(f32, 4u);
- auto* subtype = type::StorageTexture::SubtypeFor(core::TexelFormat::kR32Float, Types());
- auto* tex = create<type::StorageTexture>(
- type::TextureDimension::k2d, core::TexelFormat::kR32Float, core::Access::kWrite, subtype);
+ auto* f32 = create<core::type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
+ auto* vec4_f32 = create<core::type::Vector>(f32, 4u);
+ auto* subtype = core::type::StorageTexture::SubtypeFor(core::TexelFormat::kR32Float, Types());
+ auto* tex = create<core::type::StorageTexture>(core::type::TextureDimension::k2d,
+ core::TexelFormat::kR32Float,
+ core::Access::kWrite, subtype);
auto result = table->Lookup(core::Function::kTextureStore, Vector{tex, vec2_i32, vec4_f32},
EvaluationStage::kConstant, Source{});
@@ -418,9 +419,9 @@
}
TEST_F(IntrinsicTableTest, MismatchTexture) {
- auto* f32 = create<type::F32>();
- auto* i32 = create<type::I32>();
- auto* vec2_i32 = create<type::Vector>(i32, 2u);
+ auto* f32 = create<core::type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* vec2_i32 = create<core::type::Vector>(i32, 2u);
auto result = table->Lookup(core::Function::kTextureLoad, Vector{f32, vec2_i32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -428,13 +429,13 @@
}
TEST_F(IntrinsicTableTest, ImplicitLoadOnReference) {
- auto* f32 = create<type::F32>();
- auto result = table->Lookup(
- core::Function::kCos,
- Vector{
- create<type::Reference>(core::AddressSpace::kFunction, f32, core::Access::kReadWrite),
- },
- EvaluationStage::kConstant, Source{});
+ auto* f32 = create<core::type::F32>();
+ auto result = table->Lookup(core::Function::kCos,
+ Vector{
+ create<core::type::Reference>(core::AddressSpace::kFunction,
+ f32, core::Access::kReadWrite),
+ },
+ EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
EXPECT_EQ(result->return_type, f32);
@@ -443,7 +444,7 @@
}
TEST_F(IntrinsicTableTest, MatchTemplateType) {
- auto* f32 = create<type::F32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(core::Function::kClamp, Vector{f32, f32, f32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -455,8 +456,8 @@
}
TEST_F(IntrinsicTableTest, MismatchTemplateType) {
- auto* f32 = create<type::F32>();
- auto* u32 = create<type::U32>();
+ auto* f32 = create<core::type::F32>();
+ auto* u32 = create<core::type::U32>();
auto result = table->Lookup(core::Function::kClamp, Vector{f32, u32, f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -464,8 +465,8 @@
}
TEST_F(IntrinsicTableTest, MatchOpenSizeVector) {
- auto* f32 = create<type::F32>();
- auto* vec2_f32 = create<type::Vector>(f32, 2u);
+ auto* f32 = create<core::type::F32>();
+ auto* vec2_f32 = create<core::type::Vector>(f32, 2u);
auto result = table->Lookup(core::Function::kClamp, Vector{vec2_f32, vec2_f32, vec2_f32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -478,9 +479,9 @@
}
TEST_F(IntrinsicTableTest, MismatchOpenSizeVector) {
- auto* f32 = create<type::F32>();
- auto* u32 = create<type::U32>();
- auto* vec2_f32 = create<type::Vector>(f32, 2u);
+ auto* f32 = create<core::type::F32>();
+ auto* u32 = create<core::type::U32>();
+ auto* vec2_f32 = create<core::type::Vector>(f32, 2u);
auto result = table->Lookup(core::Function::kClamp, Vector{vec2_f32, u32, vec2_f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -488,9 +489,9 @@
}
TEST_F(IntrinsicTableTest, MatchOpenSizeMatrix) {
- auto* f32 = create<type::F32>();
- auto* vec3_f32 = create<type::Vector>(f32, 3u);
- auto* mat3_f32 = create<type::Matrix>(vec3_f32, 3u);
+ auto* f32 = create<core::type::F32>();
+ auto* vec3_f32 = create<core::type::Vector>(f32, 3u);
+ auto* mat3_f32 = create<core::type::Matrix>(vec3_f32, 3u);
auto result = table->Lookup(core::Function::kDeterminant, Vector{mat3_f32},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -501,9 +502,9 @@
}
TEST_F(IntrinsicTableTest, MismatchOpenSizeMatrix) {
- auto* f32 = create<type::F32>();
- auto* vec2_f32 = create<type::Vector>(f32, 2u);
- auto* mat3x2_f32 = create<type::Matrix>(vec2_f32, 3u);
+ auto* f32 = create<core::type::F32>();
+ auto* vec2_f32 = create<core::type::Vector>(f32, 2u);
+ auto* mat3x2_f32 = create<core::type::Matrix>(vec2_f32, 3u);
auto result = table->Lookup(core::Function::kDeterminant, Vector{mat3x2_f32},
EvaluationStage::kConstant, Source{});
ASSERT_FALSE(result);
@@ -511,8 +512,8 @@
}
TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_Builtin_ConstantEval) {
- auto* af = create<type::AbstractFloat>();
- auto* bool_ = create<type::Bool>();
+ auto* af = create<core::type::AbstractFloat>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::Function::kSelect, Vector{af, af, bool_},
EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -526,24 +527,24 @@
}
TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_Builtin_RuntimeEval) {
- auto* af = create<type::AbstractFloat>();
- auto* bool_ref = create<type::Reference>(core::AddressSpace::kFunction, create<type::Bool>(),
- core::Access::kReadWrite);
+ auto* af = create<core::type::AbstractFloat>();
+ auto* bool_ref = create<core::type::Reference>(
+ core::AddressSpace::kFunction, create<core::type::Bool>(), core::Access::kReadWrite);
auto result = table->Lookup(core::Function::kSelect, Vector{af, af, bool_ref},
EvaluationStage::kRuntime, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
EXPECT_NE(result->const_eval_fn, nullptr);
- EXPECT_TRUE(result->return_type->Is<type::F32>());
+ EXPECT_TRUE(result->return_type->Is<core::type::F32>());
ASSERT_EQ(result->parameters.Length(), 3u);
- EXPECT_TRUE(result->parameters[0].type->Is<type::F32>());
- EXPECT_TRUE(result->parameters[1].type->Is<type::F32>());
- EXPECT_TRUE(result->parameters[2].type->Is<type::Bool>());
+ EXPECT_TRUE(result->parameters[0].type->Is<core::type::F32>());
+ EXPECT_TRUE(result->parameters[1].type->Is<core::type::F32>());
+ EXPECT_TRUE(result->parameters[2].type->Is<core::type::Bool>());
}
TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_Binary_ConstantEval) {
- auto* ai = create<type::AbstractInt>();
- auto* u32 = create<type::U32>();
+ auto* ai = create<core::type::AbstractInt>();
+ auto* u32 = create<core::type::U32>();
auto result = table->Lookup(core::BinaryOp::kShiftLeft, ai, u32, EvaluationStage::kConstant,
Source{}, false);
ASSERT_TRUE(result) << Diagnostics().str();
@@ -555,22 +556,22 @@
}
TEST_F(IntrinsicTableTest, MatchDifferentArgsElementType_Binary_RuntimeEval) {
- auto* ai = create<type::AbstractInt>();
- auto* u32 = create<type::U32>();
+ auto* ai = create<core::type::AbstractInt>();
+ auto* u32 = create<core::type::U32>();
auto result = table->Lookup(core::BinaryOp::kShiftLeft, ai, u32, EvaluationStage::kRuntime,
Source{}, false);
ASSERT_TRUE(result) << Diagnostics().str();
ASSERT_NE(result->const_eval_fn, nullptr) << Diagnostics().str();
ASSERT_EQ(Diagnostics().str(), "");
- EXPECT_TRUE(result->return_type->Is<type::I32>());
- EXPECT_TRUE(result->parameters[0].type->Is<type::I32>());
- EXPECT_TRUE(result->parameters[1].type->Is<type::U32>());
+ EXPECT_TRUE(result->return_type->Is<core::type::I32>());
+ EXPECT_TRUE(result->parameters[0].type->Is<core::type::I32>());
+ EXPECT_TRUE(result->parameters[1].type->Is<core::type::U32>());
}
TEST_F(IntrinsicTableTest, OverloadOrderByNumberOfParameters) {
// None of the arguments match, so expect the overloads with 2 parameters to
// come first
- auto* bool_ = create<type::Bool>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::Function::kTextureDimensions, Vector{bool_, bool_},
EvaluationStage::kConstant, Source{});
EXPECT_FALSE(result);
@@ -609,8 +610,8 @@
}
TEST_F(IntrinsicTableTest, OverloadOrderByMatchingParameter) {
- auto* tex = create<type::DepthTexture>(type::TextureDimension::k2d);
- auto* bool_ = create<type::Bool>();
+ auto* tex = create<core::type::DepthTexture>(core::type::TextureDimension::k2d);
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::Function::kTextureDimensions, Vector{tex, bool_},
EvaluationStage::kConstant, Source{});
EXPECT_FALSE(result);
@@ -649,8 +650,8 @@
}
TEST_F(IntrinsicTableTest, MatchUnaryOp) {
- auto* i32 = create<type::I32>();
- auto* vec3_i32 = create<type::Vector>(i32, 3u);
+ auto* i32 = create<core::type::I32>();
+ auto* vec3_i32 = create<core::type::Vector>(i32, 3u);
auto result = table->Lookup(core::UnaryOp::kNegation, vec3_i32, EvaluationStage::kConstant,
Source{{12, 34}});
EXPECT_EQ(result->return_type, vec3_i32);
@@ -658,7 +659,7 @@
}
TEST_F(IntrinsicTableTest, MismatchUnaryOp) {
- auto* bool_ = create<type::Bool>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::UnaryOp::kNegation, bool_, EvaluationStage::kConstant,
Source{{12, 34}});
ASSERT_FALSE(result);
@@ -671,7 +672,7 @@
}
TEST_F(IntrinsicTableTest, MatchUnaryOp_Constant) {
- auto* ai = create<type::AbstractInt>();
+ auto* ai = create<core::type::AbstractInt>();
auto result =
table->Lookup(core::UnaryOp::kNegation, ai, EvaluationStage::kConstant, Source{{12, 34}});
EXPECT_EQ(result->return_type, ai);
@@ -679,17 +680,17 @@
}
TEST_F(IntrinsicTableTest, MatchUnaryOp_Runtime) {
- auto* ai = create<type::AbstractInt>();
+ auto* ai = create<core::type::AbstractInt>();
auto result =
table->Lookup(core::UnaryOp::kNegation, ai, EvaluationStage::kRuntime, Source{{12, 34}});
EXPECT_NE(result->return_type, ai);
- EXPECT_TRUE(result->return_type->Is<type::I32>());
+ EXPECT_TRUE(result->return_type->Is<core::type::I32>());
EXPECT_EQ(Diagnostics().str(), "");
}
TEST_F(IntrinsicTableTest, MatchBinaryOp) {
- auto* i32 = create<type::I32>();
- auto* vec3_i32 = create<type::Vector>(i32, 3u);
+ auto* i32 = create<core::type::I32>();
+ auto* vec3_i32 = create<core::type::Vector>(i32, 3u);
auto result = table->Lookup(core::BinaryOp::kMultiply, i32, vec3_i32,
EvaluationStage::kConstant, Source{{12, 34}},
/* is_compound */ false);
@@ -700,8 +701,8 @@
}
TEST_F(IntrinsicTableTest, MismatchBinaryOp) {
- auto* f32 = create<type::F32>();
- auto* bool_ = create<type::Bool>();
+ auto* f32 = create<core::type::F32>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::BinaryOp::kMultiply, f32, bool_, EvaluationStage::kConstant,
Source{{12, 34}},
/* is_compound */ false);
@@ -722,8 +723,8 @@
}
TEST_F(IntrinsicTableTest, MatchCompoundOp) {
- auto* i32 = create<type::I32>();
- auto* vec3_i32 = create<type::Vector>(i32, 3u);
+ auto* i32 = create<core::type::I32>();
+ auto* vec3_i32 = create<core::type::Vector>(i32, 3u);
auto result = table->Lookup(core::BinaryOp::kMultiply, i32, vec3_i32,
EvaluationStage::kConstant, Source{{12, 34}},
/* is_compound */ true);
@@ -734,8 +735,8 @@
}
TEST_F(IntrinsicTableTest, MismatchCompoundOp) {
- auto* f32 = create<type::F32>();
- auto* bool_ = create<type::Bool>();
+ auto* f32 = create<core::type::F32>();
+ auto* bool_ = create<core::type::Bool>();
auto result = table->Lookup(core::BinaryOp::kMultiply, f32, bool_, EvaluationStage::kConstant,
Source{{12, 34}},
/* is_compound */ true);
@@ -756,8 +757,8 @@
}
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicit) {
- auto* i32 = create<type::I32>();
- auto* vec3_i32 = create<type::Vector>(i32, 3u);
+ auto* i32 = create<core::type::I32>();
+ auto* vec3_i32 = create<core::type::Vector>(i32, 3u);
auto result = table->Lookup(CtorConv::kVec3, nullptr, Vector{i32, i32, i32},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -771,8 +772,8 @@
}
TEST_F(IntrinsicTableTest, MatchTypeInitializerExplicit) {
- auto* i32 = create<type::I32>();
- auto* vec3_i32 = create<type::Vector>(i32, 3u);
+ auto* i32 = create<core::type::I32>();
+ auto* vec3_i32 = create<core::type::Vector>(i32, 3u);
auto result = table->Lookup(CtorConv::kVec3, i32, Vector{i32, i32, i32},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -786,8 +787,8 @@
}
TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
- auto* i32 = create<type::I32>();
- auto* f32 = create<type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(CtorConv::kVec3, nullptr, Vector{i32, f32, i32},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_FALSE(result);
@@ -813,8 +814,8 @@
}
TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
- auto* i32 = create<type::I32>();
- auto* f32 = create<type::F32>();
+ auto* i32 = create<core::type::I32>();
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(CtorConv::kVec3, i32, Vector{i32, f32, i32},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_FALSE(result);
@@ -840,8 +841,8 @@
}
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitVecFromVecAbstract) {
- auto* ai = create<type::AbstractInt>();
- auto* vec3_ai = create<type::Vector>(ai, 3u);
+ auto* ai = create<core::type::AbstractInt>();
+ auto* vec3_ai = create<core::type::Vector>(ai, 3u);
auto result = table->Lookup(CtorConv::kVec3, nullptr, Vector{vec3_ai},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -853,10 +854,10 @@
}
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitMatFromVec) {
- auto* af = create<type::AbstractFloat>();
- auto* vec2_ai = create<type::Vector>(create<type::AbstractInt>(), 2u);
- auto* vec2_af = create<type::Vector>(af, 2u);
- auto* mat2x2_af = create<type::Matrix>(vec2_af, 2u);
+ auto* af = create<core::type::AbstractFloat>();
+ auto* vec2_ai = create<core::type::Vector>(create<core::type::AbstractInt>(), 2u);
+ auto* vec2_af = create<core::type::Vector>(af, 2u);
+ auto* mat2x2_af = create<core::type::Matrix>(vec2_af, 2u);
auto result = table->Lookup(CtorConv::kMat2x2, nullptr, Vector{vec2_ai, vec2_ai},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -869,8 +870,8 @@
}
TEST_F(IntrinsicTableTest, MatchTypeInitializer_ConstantEval) {
- auto* ai = create<type::AbstractInt>();
- auto* vec3_ai = create<type::Vector>(ai, 3u);
+ auto* ai = create<core::type::AbstractInt>();
+ auto* vec3_ai = create<core::type::Vector>(ai, 3u);
auto result = table->Lookup(CtorConv::kVec3, nullptr, Vector{ai, ai, ai},
EvaluationStage::kConstant, Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -885,7 +886,7 @@
}
TEST_F(IntrinsicTableTest, MatchTypeInitializer_RuntimeEval) {
- auto* ai = create<type::AbstractInt>();
+ auto* ai = create<core::type::AbstractInt>();
auto result = table->Lookup(CtorConv::kVec3, nullptr, Vector{ai, ai, ai},
EvaluationStage::kRuntime, Source{{12, 34}});
auto* i32 = create<type::I32>();
@@ -902,10 +903,10 @@
}
TEST_F(IntrinsicTableTest, MatchTypeConversion) {
- auto* i32 = create<type::I32>();
- auto* vec3_i32 = create<type::Vector>(i32, 3u);
- auto* f32 = create<type::F32>();
- auto* vec3_f32 = create<type::Vector>(f32, 3u);
+ auto* i32 = create<core::type::I32>();
+ auto* vec3_i32 = create<core::type::Vector>(i32, 3u);
+ auto* f32 = create<core::type::F32>();
+ auto* vec3_f32 = create<core::type::Vector>(f32, 3u);
auto result = table->Lookup(CtorConv::kVec3, i32, Vector{vec3_f32}, EvaluationStage::kConstant,
Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -916,9 +917,9 @@
}
TEST_F(IntrinsicTableTest, MismatchTypeConversion) {
- auto* arr =
- create<type::Array>(create<type::U32>(), create<type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
- auto* f32 = create<type::F32>();
+ auto* arr = create<core::type::Array>(create<core::type::U32>(),
+ create<core::type::RuntimeArrayCount>(), 4u, 4u, 4u, 4u);
+ auto* f32 = create<core::type::F32>();
auto result = table->Lookup(CtorConv::kVec3, f32, Vector{arr}, EvaluationStage::kConstant,
Source{{12, 34}});
ASSERT_FALSE(result);
@@ -944,11 +945,11 @@
}
TEST_F(IntrinsicTableTest, MatchTypeConversion_ConstantEval) {
- auto* ai = create<type::AbstractInt>();
- auto* af = create<type::AbstractFloat>();
- auto* vec3_ai = create<type::Vector>(ai, 3u);
- auto* f32 = create<type::F32>();
- auto* vec3_f32 = create<type::Vector>(f32, 3u);
+ auto* ai = create<core::type::AbstractInt>();
+ auto* af = create<core::type::AbstractFloat>();
+ auto* vec3_ai = create<core::type::Vector>(ai, 3u);
+ auto* f32 = create<core::type::F32>();
+ auto* vec3_f32 = create<core::type::Vector>(f32, 3u);
auto result = table->Lookup(CtorConv::kVec3, af, Vector{vec3_ai}, EvaluationStage::kConstant,
Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -961,11 +962,11 @@
}
TEST_F(IntrinsicTableTest, MatchTypeConversion_RuntimeEval) {
- auto* ai = create<type::AbstractInt>();
- auto* af = create<type::AbstractFloat>();
- auto* vec3_ai = create<type::Vector>(ai, 3u);
- auto* vec3_f32 = create<type::Vector>(create<type::F32>(), 3u);
- auto* vec3_i32 = create<type::Vector>(create<type::I32>(), 3u);
+ auto* ai = create<core::type::AbstractInt>();
+ auto* af = create<core::type::AbstractFloat>();
+ auto* vec3_ai = create<core::type::Vector>(ai, 3u);
+ auto* vec3_f32 = create<core::type::Vector>(create<core::type::F32>(), 3u);
+ auto* vec3_i32 = create<core::type::Vector>(create<core::type::I32>(), 3u);
auto result = table->Lookup(CtorConv::kVec3, af, Vector{vec3_ai}, EvaluationStage::kRuntime,
Source{{12, 34}});
ASSERT_TRUE(result) << Diagnostics().str();
@@ -977,8 +978,8 @@
}
TEST_F(IntrinsicTableTest, Err257Arguments) { // crbug.com/1323605
- auto* f32 = create<type::F32>();
- Vector<const type::Type*, 0> arg_tys;
+ auto* f32 = create<core::type::F32>();
+ Vector<const core::type::Type*, 0> arg_tys;
arg_tys.Resize(257, f32);
auto result = table->Lookup(core::Function::kAbs, std::move(arg_tys),
EvaluationStage::kConstant, Source{});
@@ -991,8 +992,8 @@
// ctor i32(i32) -> i32
// conv i32<T: scalar_no_i32>(T) -> i32
// The first should win overload resolution.
- auto* ai = create<type::AbstractInt>();
- auto* i32 = create<type::I32>();
+ auto* ai = create<core::type::AbstractInt>();
+ auto* i32 = create<core::type::I32>();
auto result =
table->Lookup(CtorConv::kI32, nullptr, Vector{ai}, EvaluationStage::kConstant, Source{});
ASSERT_TRUE(result) << Diagnostics().str();
diff --git a/src/tint/lang/core/intrinsic_data.cc b/src/tint/lang/core/intrinsic_data.cc
index 7329072..40a1655 100644
--- a/src/tint/lang/core/intrinsic_data.cc
+++ b/src/tint/lang/core/intrinsic_data.cc
@@ -48,7 +48,7 @@
using TemplateNumberInfo = tint::core::intrinsic::TemplateNumberInfo;
using TemplateTypeIndex = tint::core::intrinsic::TemplateTypeIndex;
using TemplateTypeInfo = tint::core::intrinsic::TemplateTypeInfo;
-using Type = tint::type::Type;
+using Type = tint::core::type::Type;
using TypeMatcher = tint::core::intrinsic::TypeMatcher;
using TypeMatcherIndex = tint::core::intrinsic::TypeMatcherIndex;
using TypeMatcherIndicesIndex = tint::core::intrinsic::TypeMatcherIndicesIndex;
diff --git a/src/tint/lang/core/intrinsic_type_matchers.h b/src/tint/lang/core/intrinsic_type_matchers.h
index 97d9904..2175958 100644
--- a/src/tint/lang/core/intrinsic_type_matchers.h
+++ b/src/tint/lang/core/intrinsic_type_matchers.h
@@ -42,75 +42,75 @@
namespace tint::core {
-inline bool match_bool(intrinsic::MatchState&, const type::Type* ty) {
- return ty->IsAnyOf<intrinsic::Any, type::Bool>();
+inline bool match_bool(intrinsic::MatchState&, const core::type::Type* ty) {
+ return ty->IsAnyOf<intrinsic::Any, core::type::Bool>();
}
-inline const type::AbstractFloat* build_fa(intrinsic::MatchState& state) {
+inline const core::type::AbstractFloat* build_fa(intrinsic::MatchState& state) {
return state.types.AFloat();
}
-inline bool match_fa(intrinsic::MatchState& state, const type::Type* ty) {
+inline bool match_fa(intrinsic::MatchState& state, const core::type::Type* ty) {
return (state.earliest_eval_stage <= EvaluationStage::kConstant) &&
- ty->IsAnyOf<intrinsic::Any, type::AbstractNumeric>();
+ ty->IsAnyOf<intrinsic::Any, core::type::AbstractNumeric>();
}
-inline const type::AbstractInt* build_ia(intrinsic::MatchState& state) {
+inline const core::type::AbstractInt* build_ia(intrinsic::MatchState& state) {
return state.types.AInt();
}
-inline bool match_ia(intrinsic::MatchState& state, const type::Type* ty) {
+inline bool match_ia(intrinsic::MatchState& state, const core::type::Type* ty) {
return (state.earliest_eval_stage <= EvaluationStage::kConstant) &&
- ty->IsAnyOf<intrinsic::Any, type::AbstractInt>();
+ ty->IsAnyOf<intrinsic::Any, core::type::AbstractInt>();
}
-inline const type::Bool* build_bool(intrinsic::MatchState& state) {
+inline const core::type::Bool* build_bool(intrinsic::MatchState& state) {
return state.types.bool_();
}
-inline const type::F16* build_f16(intrinsic::MatchState& state) {
+inline const core::type::F16* build_f16(intrinsic::MatchState& state) {
return state.types.f16();
}
-inline bool match_f16(intrinsic::MatchState&, const type::Type* ty) {
- return ty->IsAnyOf<intrinsic::Any, type::F16, type::AbstractNumeric>();
+inline bool match_f16(intrinsic::MatchState&, const core::type::Type* ty) {
+ return ty->IsAnyOf<intrinsic::Any, core::type::F16, core::type::AbstractNumeric>();
}
-inline const type::F32* build_f32(intrinsic::MatchState& state) {
+inline const core::type::F32* build_f32(intrinsic::MatchState& state) {
return state.types.f32();
}
-inline bool match_f32(intrinsic::MatchState&, const type::Type* ty) {
- return ty->IsAnyOf<intrinsic::Any, type::F32, type::AbstractNumeric>();
+inline bool match_f32(intrinsic::MatchState&, const core::type::Type* ty) {
+ return ty->IsAnyOf<intrinsic::Any, core::type::F32, core::type::AbstractNumeric>();
}
-inline const type::I32* build_i32(intrinsic::MatchState& state) {
+inline const core::type::I32* build_i32(intrinsic::MatchState& state) {
return state.types.i32();
}
-inline bool match_i32(intrinsic::MatchState&, const type::Type* ty) {
- return ty->IsAnyOf<intrinsic::Any, type::I32, type::AbstractInt>();
+inline bool match_i32(intrinsic::MatchState&, const core::type::Type* ty) {
+ return ty->IsAnyOf<intrinsic::Any, core::type::I32, core::type::AbstractInt>();
}
-inline const type::U32* build_u32(intrinsic::MatchState& state) {
+inline const core::type::U32* build_u32(intrinsic::MatchState& state) {
return state.types.u32();
}
-inline bool match_u32(intrinsic::MatchState&, const type::Type* ty) {
- return ty->IsAnyOf<intrinsic::Any, type::U32, type::AbstractInt>();
+inline bool match_u32(intrinsic::MatchState&, const core::type::Type* ty) {
+ return ty->IsAnyOf<intrinsic::Any, core::type::U32, core::type::AbstractInt>();
}
inline bool match_vec(intrinsic::MatchState&,
- const type::Type* ty,
+ const core::type::Type* ty,
intrinsic::Number& N,
- const type::Type*& T) {
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
N = intrinsic::Number::any;
T = ty;
return true;
}
- if (auto* v = ty->As<type::Vector>()) {
+ if (auto* v = ty->As<core::type::Vector>()) {
N = v->Width();
T = v->type();
return true;
@@ -119,13 +119,15 @@
}
template <uint32_t N>
-inline bool match_vec(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_vec(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* v = ty->As<type::Vector>()) {
+ if (auto* v = ty->As<core::type::Vector>()) {
if (v->Width() == N) {
T = v->type();
return true;
@@ -134,14 +136,15 @@
return false;
}
-inline const type::Vector* build_vec(intrinsic::MatchState& state,
- intrinsic::Number N,
- const type::Type* el) {
+inline const core::type::Vector* build_vec(intrinsic::MatchState& state,
+ intrinsic::Number N,
+ const core::type::Type* el) {
return state.types.vec(el, N.Value());
}
template <uint32_t N>
-inline const type::Vector* build_vec(intrinsic::MatchState& state, const type::Type* el) {
+inline const core::type::Vector* build_vec(intrinsic::MatchState& state,
+ const core::type::Type* el) {
return state.types.vec(el, N);
}
@@ -153,13 +156,15 @@
constexpr auto build_vec3 = build_vec<3>;
constexpr auto build_vec4 = build_vec<4>;
-inline bool match_packedVec3(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_packedVec3(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* v = ty->As<type::Vector>()) {
+ if (auto* v = ty->As<core::type::Vector>()) {
if (v->Packed()) {
T = v->type();
return true;
@@ -168,22 +173,23 @@
return false;
}
-inline const type::Vector* build_packedVec3(intrinsic::MatchState& state, const type::Type* el) {
- return state.types.Get<type::Vector>(el, 3u, /* packed */ true);
+inline const core::type::Vector* build_packedVec3(intrinsic::MatchState& state,
+ const core::type::Type* el) {
+ return state.types.Get<core::type::Vector>(el, 3u, /* packed */ true);
}
inline bool match_mat(intrinsic::MatchState&,
- const type::Type* ty,
+ const core::type::Type* ty,
intrinsic::Number& M,
intrinsic::Number& N,
- const type::Type*& T) {
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
M = intrinsic::Number::any;
N = intrinsic::Number::any;
T = ty;
return true;
}
- if (auto* m = ty->As<type::Matrix>()) {
+ if (auto* m = ty->As<core::type::Matrix>()) {
M = m->columns();
N = m->ColumnType()->Width();
T = m->type();
@@ -193,12 +199,14 @@
}
template <uint32_t C, uint32_t R>
-inline bool match_mat(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_mat(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* m = ty->As<type::Matrix>()) {
+ if (auto* m = ty->As<core::type::Matrix>()) {
if (m->columns() == C && m->rows() == R) {
T = m->type();
return true;
@@ -207,16 +215,17 @@
return false;
}
-inline const type::Matrix* build_mat(intrinsic::MatchState& state,
- intrinsic::Number C,
- intrinsic::Number R,
- const type::Type* T) {
+inline const core::type::Matrix* build_mat(intrinsic::MatchState& state,
+ intrinsic::Number C,
+ intrinsic::Number R,
+ const core::type::Type* T) {
auto* column_type = state.types.vec(T, R.Value());
return state.types.mat(column_type, C.Value());
}
template <uint32_t C, uint32_t R>
-inline const type::Matrix* build_mat(intrinsic::MatchState& state, const type::Type* T) {
+inline const core::type::Matrix* build_mat(intrinsic::MatchState& state,
+ const core::type::Type* T) {
auto* column_type = state.types.vec(T, R);
return state.types.mat(column_type, C);
}
@@ -241,14 +250,16 @@
constexpr auto match_mat4x3 = match_mat<4, 3>;
constexpr auto match_mat4x4 = match_mat<4, 4>;
-inline bool match_array(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_array(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* a = ty->As<type::Array>()) {
- if (a->Count()->Is<type::RuntimeArrayCount>()) {
+ if (auto* a = ty->As<core::type::Array>()) {
+ if (a->Count()->Is<core::type::RuntimeArrayCount>()) {
T = a->ElemType();
return true;
}
@@ -256,19 +267,21 @@
return false;
}
-inline const type::Array* build_array(intrinsic::MatchState& state, const type::Type* el) {
- return state.types.Get<type::Array>(el,
- /* count */ state.types.Get<type::RuntimeArrayCount>(),
- /* align */ 0u,
- /* size */ 0u,
- /* stride */ 0u,
- /* stride_implicit */ 0u);
+inline const core::type::Array* build_array(intrinsic::MatchState& state,
+ const core::type::Type* el) {
+ return state.types.Get<core::type::Array>(
+ el,
+ /* count */ state.types.Get<core::type::RuntimeArrayCount>(),
+ /* align */ 0u,
+ /* size */ 0u,
+ /* stride */ 0u,
+ /* stride_implicit */ 0u);
}
inline bool match_ptr(intrinsic::MatchState&,
- const type::Type* ty,
+ const core::type::Type* ty,
intrinsic::Number& S,
- const type::Type*& T,
+ const core::type::Type*& T,
intrinsic::Number& A) {
if (ty->Is<intrinsic::Any>()) {
S = intrinsic::Number::any;
@@ -277,7 +290,7 @@
return true;
}
- if (auto* p = ty->As<type::Pointer>()) {
+ if (auto* p = ty->As<core::type::Pointer>()) {
S = intrinsic::Number(static_cast<uint32_t>(p->AddressSpace()));
T = p->StoreType();
A = intrinsic::Number(static_cast<uint32_t>(p->Access()));
@@ -286,63 +299,69 @@
return false;
}
-inline const type::Pointer* build_ptr(intrinsic::MatchState& state,
- intrinsic::Number S,
- const type::Type* T,
- intrinsic::Number& A) {
+inline const core::type::Pointer* build_ptr(intrinsic::MatchState& state,
+ intrinsic::Number S,
+ const core::type::Type* T,
+ intrinsic::Number& A) {
return state.types.ptr(static_cast<core::AddressSpace>(S.Value()), T,
static_cast<core::Access>(A.Value()));
}
-inline bool match_atomic(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_atomic(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* a = ty->As<type::Atomic>()) {
+ if (auto* a = ty->As<core::type::Atomic>()) {
T = a->Type();
return true;
}
return false;
}
-inline const type::Atomic* build_atomic(intrinsic::MatchState& state, const type::Type* T) {
+inline const core::type::Atomic* build_atomic(intrinsic::MatchState& state,
+ const core::type::Type* T) {
return state.types.atomic(T);
}
-inline bool match_sampler(intrinsic::MatchState&, const type::Type* ty) {
+inline bool match_sampler(intrinsic::MatchState&, const core::type::Type* ty) {
if (ty->Is<intrinsic::Any>()) {
return true;
}
- return ty->Is([](const type::Sampler* s) { return s->kind() == type::SamplerKind::kSampler; });
+ return ty->Is([](const core::type::Sampler* s) {
+ return s->kind() == core::type::SamplerKind::kSampler;
+ });
}
-inline const type::Sampler* build_sampler(intrinsic::MatchState& state) {
+inline const core::type::Sampler* build_sampler(intrinsic::MatchState& state) {
return state.types.sampler();
}
-inline bool match_sampler_comparison(intrinsic::MatchState&, const type::Type* ty) {
+inline bool match_sampler_comparison(intrinsic::MatchState&, const core::type::Type* ty) {
if (ty->Is<intrinsic::Any>()) {
return true;
}
- return ty->Is(
- [](const type::Sampler* s) { return s->kind() == type::SamplerKind::kComparisonSampler; });
+ return ty->Is([](const core::type::Sampler* s) {
+ return s->kind() == core::type::SamplerKind::kComparisonSampler;
+ });
}
-inline const type::Sampler* build_sampler_comparison(intrinsic::MatchState& state) {
+inline const core::type::Sampler* build_sampler_comparison(intrinsic::MatchState& state) {
return state.types.comparison_sampler();
}
inline bool match_texture(intrinsic::MatchState&,
- const type::Type* ty,
- type::TextureDimension dim,
- const type::Type*& T) {
+ const core::type::Type* ty,
+ core::type::TextureDimension dim,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* v = ty->As<type::SampledTexture>()) {
+ if (auto* v = ty->As<core::type::SampledTexture>()) {
if (v->dim() == dim) {
T = v->type();
return true;
@@ -353,33 +372,33 @@
#define JOIN(a, b) a##b
-#define DECLARE_SAMPLED_TEXTURE(suffix, dim) \
- inline bool JOIN(match_texture_, suffix)(intrinsic::MatchState & state, const type::Type* ty, \
- const type::Type*& T) { \
- return match_texture(state, ty, dim, T); \
- } \
- inline const type::SampledTexture* JOIN(build_texture_, suffix)(intrinsic::MatchState & state, \
- const type::Type* T) { \
- return state.types.Get<type::SampledTexture>(dim, T); \
+#define DECLARE_SAMPLED_TEXTURE(suffix, dim) \
+ inline bool JOIN(match_texture_, suffix)( \
+ intrinsic::MatchState & state, const core::type::Type* ty, const core::type::Type*& T) { \
+ return match_texture(state, ty, dim, T); \
+ } \
+ inline const core::type::SampledTexture* JOIN(build_texture_, suffix)( \
+ intrinsic::MatchState & state, const core::type::Type* T) { \
+ return state.types.Get<core::type::SampledTexture>(dim, T); \
}
-DECLARE_SAMPLED_TEXTURE(1d, type::TextureDimension::k1d)
-DECLARE_SAMPLED_TEXTURE(2d, type::TextureDimension::k2d)
-DECLARE_SAMPLED_TEXTURE(2d_array, type::TextureDimension::k2dArray)
-DECLARE_SAMPLED_TEXTURE(3d, type::TextureDimension::k3d)
-DECLARE_SAMPLED_TEXTURE(cube, type::TextureDimension::kCube)
-DECLARE_SAMPLED_TEXTURE(cube_array, type::TextureDimension::kCubeArray)
+DECLARE_SAMPLED_TEXTURE(1d, core::type::TextureDimension::k1d)
+DECLARE_SAMPLED_TEXTURE(2d, core::type::TextureDimension::k2d)
+DECLARE_SAMPLED_TEXTURE(2d_array, core::type::TextureDimension::k2dArray)
+DECLARE_SAMPLED_TEXTURE(3d, core::type::TextureDimension::k3d)
+DECLARE_SAMPLED_TEXTURE(cube, core::type::TextureDimension::kCube)
+DECLARE_SAMPLED_TEXTURE(cube_array, core::type::TextureDimension::kCubeArray)
#undef DECLARE_SAMPLED_TEXTURE
inline bool match_texture_multisampled(intrinsic::MatchState&,
- const type::Type* ty,
- type::TextureDimension dim,
- const type::Type*& T) {
+ const core::type::Type* ty,
+ core::type::TextureDimension dim,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
}
- if (auto* v = ty->As<type::MultisampledTexture>()) {
+ if (auto* v = ty->As<core::type::MultisampledTexture>()) {
if (v->dim() == dim) {
T = v->type();
return true;
@@ -388,61 +407,62 @@
return false;
}
-#define DECLARE_MULTISAMPLED_TEXTURE(suffix, dim) \
- inline bool JOIN(match_texture_multisampled_, suffix)( \
- intrinsic::MatchState & state, const type::Type* ty, const type::Type*& T) { \
- return match_texture_multisampled(state, ty, dim, T); \
- } \
- inline const type::MultisampledTexture* JOIN(build_texture_multisampled_, suffix)( \
- intrinsic::MatchState & state, const type::Type* T) { \
- return state.types.Get<type::MultisampledTexture>(dim, T); \
+#define DECLARE_MULTISAMPLED_TEXTURE(suffix, dim) \
+ inline bool JOIN(match_texture_multisampled_, suffix)( \
+ intrinsic::MatchState & state, const core::type::Type* ty, const core::type::Type*& T) { \
+ return match_texture_multisampled(state, ty, dim, T); \
+ } \
+ inline const core::type::MultisampledTexture* JOIN(build_texture_multisampled_, suffix)( \
+ intrinsic::MatchState & state, const core::type::Type* T) { \
+ return state.types.Get<core::type::MultisampledTexture>(dim, T); \
}
-DECLARE_MULTISAMPLED_TEXTURE(2d, type::TextureDimension::k2d)
+DECLARE_MULTISAMPLED_TEXTURE(2d, core::type::TextureDimension::k2d)
#undef DECLARE_MULTISAMPLED_TEXTURE
inline bool match_texture_depth(intrinsic::MatchState&,
- const type::Type* ty,
- type::TextureDimension dim) {
+ const core::type::Type* ty,
+ core::type::TextureDimension dim) {
if (ty->Is<intrinsic::Any>()) {
return true;
}
- return ty->Is([&](const type::DepthTexture* t) { return t->dim() == dim; });
+ return ty->Is([&](const core::type::DepthTexture* t) { return t->dim() == dim; });
}
-#define DECLARE_DEPTH_TEXTURE(suffix, dim) \
- inline bool JOIN(match_texture_depth_, suffix)(intrinsic::MatchState & state, \
- const type::Type* ty) { \
- return match_texture_depth(state, ty, dim); \
- } \
- inline const type::DepthTexture* JOIN(build_texture_depth_, \
- suffix)(intrinsic::MatchState & state) { \
- return state.types.Get<type::DepthTexture>(dim); \
+#define DECLARE_DEPTH_TEXTURE(suffix, dim) \
+ inline bool JOIN(match_texture_depth_, suffix)(intrinsic::MatchState & state, \
+ const core::type::Type* ty) { \
+ return match_texture_depth(state, ty, dim); \
+ } \
+ inline const core::type::DepthTexture* JOIN(build_texture_depth_, \
+ suffix)(intrinsic::MatchState & state) { \
+ return state.types.Get<core::type::DepthTexture>(dim); \
}
-DECLARE_DEPTH_TEXTURE(2d, type::TextureDimension::k2d)
-DECLARE_DEPTH_TEXTURE(2d_array, type::TextureDimension::k2dArray)
-DECLARE_DEPTH_TEXTURE(cube, type::TextureDimension::kCube)
-DECLARE_DEPTH_TEXTURE(cube_array, type::TextureDimension::kCubeArray)
+DECLARE_DEPTH_TEXTURE(2d, core::type::TextureDimension::k2d)
+DECLARE_DEPTH_TEXTURE(2d_array, core::type::TextureDimension::k2dArray)
+DECLARE_DEPTH_TEXTURE(cube, core::type::TextureDimension::kCube)
+DECLARE_DEPTH_TEXTURE(cube_array, core::type::TextureDimension::kCubeArray)
#undef DECLARE_DEPTH_TEXTURE
-inline bool match_texture_depth_multisampled_2d(intrinsic::MatchState&, const type::Type* ty) {
+inline bool match_texture_depth_multisampled_2d(intrinsic::MatchState&,
+ const core::type::Type* ty) {
if (ty->Is<intrinsic::Any>()) {
return true;
}
- return ty->Is([&](const type::DepthMultisampledTexture* t) {
- return t->dim() == type::TextureDimension::k2d;
+ return ty->Is([&](const core::type::DepthMultisampledTexture* t) {
+ return t->dim() == core::type::TextureDimension::k2d;
});
}
-inline type::DepthMultisampledTexture* build_texture_depth_multisampled_2d(
+inline core::type::DepthMultisampledTexture* build_texture_depth_multisampled_2d(
intrinsic::MatchState& state) {
- return state.types.Get<type::DepthMultisampledTexture>(type::TextureDimension::k2d);
+ return state.types.Get<core::type::DepthMultisampledTexture>(core::type::TextureDimension::k2d);
}
inline bool match_texture_storage(intrinsic::MatchState&,
- const type::Type* ty,
- type::TextureDimension dim,
+ const core::type::Type* ty,
+ core::type::TextureDimension dim,
intrinsic::Number& F,
intrinsic::Number& A) {
if (ty->Is<intrinsic::Any>()) {
@@ -450,7 +470,7 @@
A = intrinsic::Number::any;
return true;
}
- if (auto* v = ty->As<type::StorageTexture>()) {
+ if (auto* v = ty->As<core::type::StorageTexture>()) {
if (v->dim() == dim) {
F = intrinsic::Number(static_cast<uint32_t>(v->texel_format()));
A = intrinsic::Number(static_cast<uint32_t>(v->access()));
@@ -460,38 +480,40 @@
return false;
}
-#define DECLARE_STORAGE_TEXTURE(suffix, dim) \
- inline bool JOIN(match_texture_storage_, suffix)(intrinsic::MatchState & state, \
- const type::Type* ty, intrinsic::Number& F, \
- intrinsic::Number& A) { \
- return match_texture_storage(state, ty, dim, F, A); \
- } \
- inline const type::StorageTexture* JOIN(build_texture_storage_, suffix)( \
- intrinsic::MatchState & state, intrinsic::Number F, intrinsic::Number A) { \
- auto format = static_cast<TexelFormat>(F.Value()); \
- auto access = static_cast<Access>(A.Value()); \
- auto* T = type::StorageTexture::SubtypeFor(format, state.types); \
- return state.types.Get<type::StorageTexture>(dim, format, access, T); \
+#define DECLARE_STORAGE_TEXTURE(suffix, dim) \
+ inline bool JOIN(match_texture_storage_, suffix)(intrinsic::MatchState & state, \
+ const core::type::Type* ty, \
+ intrinsic::Number& F, intrinsic::Number& A) { \
+ return match_texture_storage(state, ty, dim, F, A); \
+ } \
+ inline const core::type::StorageTexture* JOIN(build_texture_storage_, suffix)( \
+ intrinsic::MatchState & state, intrinsic::Number F, intrinsic::Number A) { \
+ auto format = static_cast<TexelFormat>(F.Value()); \
+ auto access = static_cast<Access>(A.Value()); \
+ auto* T = core::type::StorageTexture::SubtypeFor(format, state.types); \
+ return state.types.Get<core::type::StorageTexture>(dim, format, access, T); \
}
-DECLARE_STORAGE_TEXTURE(1d, type::TextureDimension::k1d)
-DECLARE_STORAGE_TEXTURE(2d, type::TextureDimension::k2d)
-DECLARE_STORAGE_TEXTURE(2d_array, type::TextureDimension::k2dArray)
-DECLARE_STORAGE_TEXTURE(3d, type::TextureDimension::k3d)
+DECLARE_STORAGE_TEXTURE(1d, core::type::TextureDimension::k1d)
+DECLARE_STORAGE_TEXTURE(2d, core::type::TextureDimension::k2d)
+DECLARE_STORAGE_TEXTURE(2d_array, core::type::TextureDimension::k2dArray)
+DECLARE_STORAGE_TEXTURE(3d, core::type::TextureDimension::k3d)
#undef DECLARE_STORAGE_TEXTURE
-inline bool match_texture_external(intrinsic::MatchState&, const type::Type* ty) {
- return ty->IsAnyOf<intrinsic::Any, type::ExternalTexture>();
+inline bool match_texture_external(intrinsic::MatchState&, const core::type::Type* ty) {
+ return ty->IsAnyOf<intrinsic::Any, core::type::ExternalTexture>();
}
-inline const type::ExternalTexture* build_texture_external(intrinsic::MatchState& state) {
- return state.types.Get<type::ExternalTexture>();
+inline const core::type::ExternalTexture* build_texture_external(intrinsic::MatchState& state) {
+ return state.types.Get<core::type::ExternalTexture>();
}
// Builtin types starting with a _ prefix cannot be declared in WGSL, so they
// can only be used as return types. Because of this, they must only match Any,
// which is used as the return type matcher.
-inline bool match_modf_result(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_modf_result(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (!ty->Is<intrinsic::Any>()) {
return false;
}
@@ -499,9 +521,9 @@
return true;
}
inline bool match_modf_result_vec(intrinsic::MatchState&,
- const type::Type* ty,
+ const core::type::Type* ty,
intrinsic::Number& N,
- const type::Type*& T) {
+ const core::type::Type*& T) {
if (!ty->Is<intrinsic::Any>()) {
return false;
}
@@ -509,7 +531,9 @@
T = ty;
return true;
}
-inline bool match_frexp_result(intrinsic::MatchState&, const type::Type* ty, const type::Type*& T) {
+inline bool match_frexp_result(intrinsic::MatchState&,
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (!ty->Is<intrinsic::Any>()) {
return false;
}
@@ -517,9 +541,9 @@
return true;
}
inline bool match_frexp_result_vec(intrinsic::MatchState&,
- const type::Type* ty,
+ const core::type::Type* ty,
intrinsic::Number& N,
- const type::Type*& T) {
+ const core::type::Type*& T) {
if (!ty->Is<intrinsic::Any>()) {
return false;
}
@@ -529,8 +553,8 @@
}
inline bool match_atomic_compare_exchange_result(intrinsic::MatchState&,
- const type::Type* ty,
- const type::Type*& T) {
+ const core::type::Type* ty,
+ const core::type::Type*& T) {
if (ty->Is<intrinsic::Any>()) {
T = ty;
return true;
@@ -538,31 +562,33 @@
return false;
}
-inline const type::Struct* build_modf_result(intrinsic::MatchState& state, const type::Type* el) {
- return type::CreateModfResult(state.types, state.symbols, el);
+inline const core::type::Struct* build_modf_result(intrinsic::MatchState& state,
+ const core::type::Type* el) {
+ return core::type::CreateModfResult(state.types, state.symbols, el);
}
-inline const type::Struct* build_modf_result_vec(intrinsic::MatchState& state,
- intrinsic::Number& n,
- const type::Type* el) {
+inline const core::type::Struct* build_modf_result_vec(intrinsic::MatchState& state,
+ intrinsic::Number& n,
+ const core::type::Type* el) {
auto* vec = state.types.vec(el, n.Value());
- return type::CreateModfResult(state.types, state.symbols, vec);
+ return core::type::CreateModfResult(state.types, state.symbols, vec);
}
-inline const type::Struct* build_frexp_result(intrinsic::MatchState& state, const type::Type* el) {
- return type::CreateFrexpResult(state.types, state.symbols, el);
+inline const core::type::Struct* build_frexp_result(intrinsic::MatchState& state,
+ const core::type::Type* el) {
+ return core::type::CreateFrexpResult(state.types, state.symbols, el);
}
-inline const type::Struct* build_frexp_result_vec(intrinsic::MatchState& state,
- intrinsic::Number& n,
- const type::Type* el) {
+inline const core::type::Struct* build_frexp_result_vec(intrinsic::MatchState& state,
+ intrinsic::Number& n,
+ const core::type::Type* el) {
auto* vec = state.types.vec(el, n.Value());
- return type::CreateFrexpResult(state.types, state.symbols, vec);
+ return core::type::CreateFrexpResult(state.types, state.symbols, vec);
}
-inline const type::Struct* build_atomic_compare_exchange_result(intrinsic::MatchState& state,
- const type::Type* ty) {
- return type::CreateAtomicCompareExchangeResult(state.types, state.symbols, ty);
+inline const core::type::Struct* build_atomic_compare_exchange_result(intrinsic::MatchState& state,
+ const core::type::Type* ty) {
+ return core::type::CreateAtomicCompareExchangeResult(state.types, state.symbols, ty);
}
} // namespace tint::core
diff --git a/src/tint/lang/core/ir/block_param.cc b/src/tint/lang/core/ir/block_param.cc
index 46a4070..4f031c4 100644
--- a/src/tint/lang/core/ir/block_param.cc
+++ b/src/tint/lang/core/ir/block_param.cc
@@ -19,7 +19,7 @@
namespace tint::ir {
-BlockParam::BlockParam(const type::Type* ty) : type_(ty) {
+BlockParam::BlockParam(const core::type::Type* ty) : type_(ty) {
TINT_ASSERT(type_ != nullptr);
}
diff --git a/src/tint/lang/core/ir/block_param.h b/src/tint/lang/core/ir/block_param.h
index e694540..73e7853 100644
--- a/src/tint/lang/core/ir/block_param.h
+++ b/src/tint/lang/core/ir/block_param.h
@@ -25,15 +25,15 @@
public:
/// Constructor
/// @param type the type of the var
- explicit BlockParam(const type::Type* type);
+ explicit BlockParam(const core::type::Type* type);
~BlockParam() override;
/// @returns the type of the var
- const type::Type* Type() override { return type_; }
+ const core::type::Type* Type() override { return type_; }
private:
/// the result type of the instruction
- const type::Type* type_ = nullptr;
+ const core::type::Type* type_ = nullptr;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/builder.cc b/src/tint/lang/core/ir/builder.cc
index 6a4dc8d..0cfc9d1 100644
--- a/src/tint/lang/core/ir/builder.cc
+++ b/src/tint/lang/core/ir/builder.cc
@@ -45,7 +45,7 @@
}
Function* Builder::Function(std::string_view name,
- const type::Type* return_type,
+ const core::type::Type* return_type,
Function::PipelineStage stage,
std::optional<std::array<uint32_t, 3>> wg_size) {
auto* ir_func = ir.values.Create<ir::Function>(return_type, stage, wg_size);
@@ -74,31 +74,31 @@
return Append(ir.instructions.Create<ir::Discard>());
}
-ir::Var* Builder::Var(const type::Pointer* type) {
+ir::Var* Builder::Var(const core::type::Pointer* type) {
return Append(ir.instructions.Create<ir::Var>(InstructionResult(type)));
}
-ir::Var* Builder::Var(std::string_view name, const type::Pointer* type) {
+ir::Var* Builder::Var(std::string_view name, const core::type::Pointer* type) {
auto* var = Var(type);
ir.SetName(var, name);
return var;
}
-ir::BlockParam* Builder::BlockParam(const type::Type* type) {
+ir::BlockParam* Builder::BlockParam(const core::type::Type* type) {
return ir.values.Create<ir::BlockParam>(type);
}
-ir::BlockParam* Builder::BlockParam(std::string_view name, const type::Type* type) {
+ir::BlockParam* Builder::BlockParam(std::string_view name, const core::type::Type* type) {
auto* param = ir.values.Create<ir::BlockParam>(type);
ir.SetName(param, name);
return param;
}
-ir::FunctionParam* Builder::FunctionParam(const type::Type* type) {
+ir::FunctionParam* Builder::FunctionParam(const core::type::Type* type) {
return ir.values.Create<ir::FunctionParam>(type);
}
-ir::FunctionParam* Builder::FunctionParam(std::string_view name, const type::Type* type) {
+ir::FunctionParam* Builder::FunctionParam(std::string_view name, const core::type::Type* type) {
auto* param = ir.values.Create<ir::FunctionParam>(type);
ir.SetName(param, name);
return param;
@@ -112,11 +112,11 @@
return Append(ir.instructions.Create<ir::Unreachable>());
}
-const type::Type* Builder::VectorPtrElementType(const type::Type* type) {
- auto* vec_ptr_ty = type->As<type::Pointer>();
+const core::type::Type* Builder::VectorPtrElementType(const core::type::Type* type) {
+ auto* vec_ptr_ty = type->As<core::type::Pointer>();
TINT_ASSERT(vec_ptr_ty);
if (TINT_LIKELY(vec_ptr_ty)) {
- auto* vec_ty = vec_ptr_ty->StoreType()->As<type::Vector>();
+ auto* vec_ty = vec_ptr_ty->StoreType()->As<core::type::Vector>();
TINT_ASSERT(vec_ty);
if (TINT_LIKELY(vec_ty)) {
return vec_ty->type();
diff --git a/src/tint/lang/core/ir/builder.h b/src/tint/lang/core/ir/builder.h
index 3510eec..b67303e 100644
--- a/src/tint/lang/core/ir/builder.h
+++ b/src/tint/lang/core/ir/builder.h
@@ -173,7 +173,7 @@
/// @param wg_size the workgroup_size
/// @returns the instruction
ir::Function* Function(std::string_view name,
- const type::Type* return_type,
+ const core::type::Type* return_type,
Function::PipelineStage stage = Function::PipelineStage::kUndefined,
std::optional<std::array<uint32_t, 3>> wg_size = {});
@@ -285,7 +285,7 @@
/// @param size the number of items
/// @returns the new constant
template <typename ARG>
- ir::Constant* Splat(const type::Type* ty, ARG&& value, size_t size) {
+ ir::Constant* Splat(const core::type::Type* ty, ARG&& value, size_t size) {
return Constant(
ir.constant_values.Splat(ty, ConstantValue(std::forward<ARG>(value)), size));
}
@@ -295,7 +295,7 @@
/// @param values the composite values
/// @returns the new constant
template <typename... ARGS, typename = DisableIfVectorLike<ARGS...>>
- ir::Constant* Composite(const type::Type* ty, ARGS&&... values) {
+ ir::Constant* Composite(const core::type::Type* ty, ARGS&&... values) {
return Constant(
ir.constant_values.Composite(ty, Vector{ConstantValue(std::forward<ARGS>(values))...}));
}
@@ -362,7 +362,7 @@
/// @param rhs the right-hand-side of the operation
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Binary(enum Binary::Kind kind, const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Binary(enum Binary::Kind kind, const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
CheckForNonDeterministicEvaluation<LHS, RHS>();
auto* lhs_val = Value(std::forward<LHS>(lhs));
auto* rhs_val = Value(std::forward<RHS>(rhs));
@@ -376,7 +376,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* And(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* And(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kAnd, type, std::forward<LHS>(lhs), std::forward<RHS>(rhs));
}
@@ -386,7 +386,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Or(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Or(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kOr, type, std::forward<LHS>(lhs), std::forward<RHS>(rhs));
}
@@ -396,7 +396,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Xor(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Xor(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kXor, type, std::forward<LHS>(lhs), std::forward<RHS>(rhs));
}
@@ -406,7 +406,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Equal(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Equal(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kEqual, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -417,7 +417,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* NotEqual(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* NotEqual(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kNotEqual, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -428,7 +428,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* LessThan(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* LessThan(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kLessThan, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -439,7 +439,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* GreaterThan(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* GreaterThan(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kGreaterThan, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -450,7 +450,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* LessThanEqual(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* LessThanEqual(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kLessThanEqual, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -461,7 +461,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* GreaterThanEqual(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* GreaterThanEqual(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kGreaterThanEqual, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -472,7 +472,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* ShiftLeft(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* ShiftLeft(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kShiftLeft, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -483,7 +483,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* ShiftRight(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* ShiftRight(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kShiftRight, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -494,7 +494,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Add(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Add(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kAdd, type, std::forward<LHS>(lhs), std::forward<RHS>(rhs));
}
@@ -504,7 +504,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Subtract(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Subtract(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kSubtract, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -515,7 +515,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Multiply(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Multiply(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kMultiply, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -526,7 +526,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Divide(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Divide(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kDivide, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -537,7 +537,7 @@
/// @param rhs the rhs of the add
/// @returns the operation
template <typename LHS, typename RHS>
- ir::Binary* Modulo(const type::Type* type, LHS&& lhs, RHS&& rhs) {
+ ir::Binary* Modulo(const core::type::Type* type, LHS&& lhs, RHS&& rhs) {
return Binary(ir::Binary::Kind::kModulo, type, std::forward<LHS>(lhs),
std::forward<RHS>(rhs));
}
@@ -548,7 +548,7 @@
/// @param val the value of the operation
/// @returns the operation
template <typename VAL>
- ir::Unary* Unary(enum Unary::Kind kind, const type::Type* type, VAL&& val) {
+ ir::Unary* Unary(enum Unary::Kind kind, const core::type::Type* type, VAL&& val) {
auto* value = Value(std::forward<VAL>(val));
return Append(ir.instructions.Create<ir::Unary>(InstructionResult(type), kind, value));
}
@@ -558,7 +558,7 @@
/// @param val the value
/// @returns the operation
template <typename VAL>
- ir::Unary* Complement(const type::Type* type, VAL&& val) {
+ ir::Unary* Complement(const core::type::Type* type, VAL&& val) {
return Unary(ir::Unary::Kind::kComplement, type, std::forward<VAL>(val));
}
@@ -567,7 +567,7 @@
/// @param val the value
/// @returns the operation
template <typename VAL>
- ir::Unary* Negation(const type::Type* type, VAL&& val) {
+ ir::Unary* Negation(const core::type::Type* type, VAL&& val) {
return Unary(ir::Unary::Kind::kNegation, type, std::forward<VAL>(val));
}
@@ -576,8 +576,8 @@
/// @param val the value
/// @returns the operation
template <typename VAL>
- ir::Binary* Not(const type::Type* type, VAL&& val) {
- if (auto* vec = type->As<type::Vector>()) {
+ ir::Binary* Not(const core::type::Type* type, VAL&& val) {
+ if (auto* vec = type->As<core::type::Vector>()) {
return Equal(type, std::forward<VAL>(val), Splat(vec, false, vec->Width()));
} else {
return Equal(type, std::forward<VAL>(val), Constant(false));
@@ -589,7 +589,7 @@
/// @param val the value being bitcast
/// @returns the instruction
template <typename VAL>
- ir::Bitcast* Bitcast(const type::Type* type, VAL&& val) {
+ ir::Bitcast* Bitcast(const core::type::Type* type, VAL&& val) {
auto* value = Value(std::forward<VAL>(val));
return Append(ir.instructions.Create<ir::Bitcast>(InstructionResult(type), value));
}
@@ -604,7 +604,7 @@
/// @param args the call arguments
/// @returns the instruction
template <typename... ARGS>
- ir::UserCall* Call(const type::Type* type, ir::Function* func, ARGS&&... args) {
+ ir::UserCall* Call(const core::type::Type* type, ir::Function* func, ARGS&&... args) {
return Append(ir.instructions.Create<ir::UserCall>(InstructionResult(type), func,
Values(std::forward<ARGS>(args)...)));
}
@@ -615,7 +615,7 @@
/// @param args the call arguments
/// @returns the instruction
template <typename... ARGS>
- ir::CoreBuiltinCall* Call(const type::Type* type, core::Function func, ARGS&&... args) {
+ ir::CoreBuiltinCall* Call(const core::type::Type* type, core::Function func, ARGS&&... args) {
return Append(ir.instructions.Create<ir::CoreBuiltinCall>(
InstructionResult(type), func, Values(std::forward<ARGS>(args)...)));
}
@@ -626,7 +626,9 @@
/// @param args the call arguments
/// @returns the intrinsic call instruction
template <typename... ARGS>
- ir::IntrinsicCall* Call(const type::Type* type, enum IntrinsicCall::Kind kind, ARGS&&... args) {
+ ir::IntrinsicCall* Call(const core::type::Type* type,
+ enum IntrinsicCall::Kind kind,
+ ARGS&&... args) {
return Append(ir.instructions.Create<ir::IntrinsicCall>(
InstructionResult(type), kind, Values(std::forward<ARGS>(args)...)));
}
@@ -636,7 +638,7 @@
/// @param val the value to be converted
/// @returns the instruction
template <typename VAL>
- ir::Convert* Convert(const type::Type* to, VAL&& val) {
+ ir::Convert* Convert(const core::type::Type* to, VAL&& val) {
return Append(ir.instructions.Create<ir::Convert>(InstructionResult(to),
Value(std::forward<VAL>(val))));
}
@@ -646,7 +648,7 @@
/// @param args the arguments to the constructor
/// @returns the instruction
template <typename... ARGS>
- ir::Construct* Construct(const type::Type* type, ARGS&&... args) {
+ ir::Construct* Construct(const core::type::Type* type, ARGS&&... args) {
return Append(ir.instructions.Create<ir::Construct>(InstructionResult(type),
Values(std::forward<ARGS>(args)...)));
}
@@ -703,13 +705,13 @@
/// Creates a new `var` declaration
/// @param type the var type
/// @returns the instruction
- ir::Var* Var(const type::Pointer* type);
+ ir::Var* Var(const core::type::Pointer* type);
/// Creates a new `var` declaration with a name
/// @param name the var name
/// @param type the var type
/// @returns the instruction
- ir::Var* Var(std::string_view name, const type::Pointer* type);
+ ir::Var* Var(std::string_view name, const core::type::Pointer* type);
/// Creates a new `let` declaration
/// @param name the let name
@@ -828,24 +830,24 @@
/// Creates a new `BlockParam`
/// @param type the parameter type
/// @returns the value
- ir::BlockParam* BlockParam(const type::Type* type);
+ ir::BlockParam* BlockParam(const core::type::Type* type);
/// Creates a new `BlockParam` with a name.
/// @param name the parameter name
/// @param type the parameter type
/// @returns the value
- ir::BlockParam* BlockParam(std::string_view name, const type::Type* type);
+ ir::BlockParam* BlockParam(std::string_view name, const core::type::Type* type);
/// Creates a new `FunctionParam`
/// @param type the parameter type
/// @returns the value
- ir::FunctionParam* FunctionParam(const type::Type* type);
+ ir::FunctionParam* FunctionParam(const core::type::Type* type);
/// Creates a new `FunctionParam` with a name.
/// @param name the parameter name
/// @param type the parameter type
/// @returns the value
- ir::FunctionParam* FunctionParam(std::string_view name, const type::Type* type);
+ ir::FunctionParam* FunctionParam(std::string_view name, const core::type::Type* type);
/// Creates a new `Access`
/// @param type the return type
@@ -853,7 +855,7 @@
/// @param indices the access indices
/// @returns the instruction
template <typename OBJ, typename... ARGS>
- ir::Access* Access(const type::Type* type, OBJ&& object, ARGS&&... indices) {
+ ir::Access* Access(const core::type::Type* type, OBJ&& object, ARGS&&... indices) {
CheckForNonDeterministicEvaluation<OBJ, ARGS...>();
auto* obj_val = Value(std::forward<OBJ>(object));
return Append(ir.instructions.Create<ir::Access>(InstructionResult(type), obj_val,
@@ -866,7 +868,7 @@
/// @param indices the swizzle indices
/// @returns the instruction
template <typename OBJ>
- ir::Swizzle* Swizzle(const type::Type* type, OBJ&& object, VectorRef<uint32_t> indices) {
+ ir::Swizzle* Swizzle(const core::type::Type* type, OBJ&& object, VectorRef<uint32_t> indices) {
auto* obj_val = Value(std::forward<OBJ>(object));
return Append(ir.instructions.Create<ir::Swizzle>(InstructionResult(type), obj_val,
std::move(indices)));
@@ -878,7 +880,7 @@
/// @param indices the swizzle indices
/// @returns the instruction
template <typename OBJ>
- ir::Swizzle* Swizzle(const type::Type* type,
+ ir::Swizzle* Swizzle(const core::type::Type* type,
OBJ&& object,
std::initializer_list<uint32_t> indices) {
auto* obj_val = Value(std::forward<OBJ>(object));
@@ -901,7 +903,7 @@
/// Creates a new runtime value
/// @param type the return type
/// @returns the value
- ir::InstructionResult* InstructionResult(const type::Type* type) {
+ ir::InstructionResult* InstructionResult(const core::type::Type* type) {
return ir.values.Create<ir::InstructionResult>(type);
}
@@ -912,7 +914,7 @@
/// @param step the loop index step amount
/// @param cb the callback to call for the loop body
template <typename START, typename END, typename STEP, typename FUNCTION>
- void LoopRange(type::Manager& ty, START&& start, END&& end, STEP&& step, FUNCTION&& cb) {
+ void LoopRange(core::type::Manager& ty, START&& start, END&& end, STEP&& step, FUNCTION&& cb) {
auto* start_value = Value(std::forward<START>(start));
auto* end_value = Value(std::forward<END>(end));
auto* step_value = Value(std::forward<STEP>(step));
@@ -948,7 +950,7 @@
private:
/// @returns the element type of the vector-pointer type
/// Asserts and return i32 if @p type is not a pointer to a vector
- const type::Type* VectorPtrElementType(const type::Type* type);
+ const core::type::Type* VectorPtrElementType(const core::type::Type* type);
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/constant.h b/src/tint/lang/core/ir/constant.h
index 3dde430..6a75e91 100644
--- a/src/tint/lang/core/ir/constant.h
+++ b/src/tint/lang/core/ir/constant.h
@@ -32,7 +32,7 @@
const core::constant::Value* Value() { return value_; }
/// @returns the type of the constant
- const type::Type* Type() override { return value_->Type(); }
+ const core::type::Type* Type() override { return value_->Type(); }
private:
const core::constant::Value* const value_ = nullptr;
diff --git a/src/tint/lang/core/ir/disassembler.cc b/src/tint/lang/core/ir/disassembler.cc
index c5a339d..71bd370 100644
--- a/src/tint/lang/core/ir/disassembler.cc
+++ b/src/tint/lang/core/ir/disassembler.cc
@@ -145,7 +145,7 @@
std::string Disassembler::Disassemble() {
for (auto* ty : mod_.Types()) {
- if (auto* str = ty->As<type::Struct>()) {
+ if (auto* str = ty->As<core::type::Struct>()) {
EmitStructDecl(str);
}
}
@@ -894,9 +894,9 @@
sm.Store(u);
}
-void Disassembler::EmitStructDecl(const type::Struct* str) {
+void Disassembler::EmitStructDecl(const core::type::Struct* str) {
out_ << str->Name().Name() << " = struct @align(" << str->Align() << ")";
- if (str->StructFlags().Contains(type::StructFlag::kBlock)) {
+ if (str->StructFlags().Contains(core::type::StructFlag::kBlock)) {
out_ << ", @block";
}
out_ << " {";
diff --git a/src/tint/lang/core/ir/disassembler.h b/src/tint/lang/core/ir/disassembler.h
index 27c8518..39ca61d 100644
--- a/src/tint/lang/core/ir/disassembler.h
+++ b/src/tint/lang/core/ir/disassembler.h
@@ -30,7 +30,7 @@
#include "src/tint/utils/text/string_stream.h"
// Forward declarations.
-namespace tint::type {
+namespace tint::core::type {
class Struct;
}
@@ -140,7 +140,7 @@
void EmitSwitch(Switch* s);
void EmitLoop(Loop* l);
void EmitIf(If* i);
- void EmitStructDecl(const type::Struct* str);
+ void EmitStructDecl(const core::type::Struct* str);
void EmitLine();
void EmitOperand(Instruction* inst, size_t index);
void EmitOperandList(Instruction* inst, size_t start_index = 0);
diff --git a/src/tint/lang/core/ir/function.cc b/src/tint/lang/core/ir/function.cc
index dbee758..b5bf71b 100644
--- a/src/tint/lang/core/ir/function.cc
+++ b/src/tint/lang/core/ir/function.cc
@@ -21,7 +21,7 @@
namespace tint::ir {
-Function::Function(const type::Type* rt,
+Function::Function(const core::type::Type* rt,
PipelineStage stage,
std::optional<std::array<uint32_t, 3>> wg_size)
: pipeline_stage_(stage), workgroup_size_(wg_size) {
diff --git a/src/tint/lang/core/ir/function.h b/src/tint/lang/core/ir/function.h
index 624e763..135abea 100644
--- a/src/tint/lang/core/ir/function.h
+++ b/src/tint/lang/core/ir/function.h
@@ -62,7 +62,7 @@
/// @param rt the function return type
/// @param stage the function stage
/// @param wg_size the workgroup_size
- Function(const type::Type* rt,
+ Function(const core::type::Type* rt,
PipelineStage stage = PipelineStage::kUndefined,
std::optional<std::array<uint32_t, 3>> wg_size = {});
~Function() override;
@@ -87,7 +87,7 @@
std::optional<std::array<uint32_t, 3>> WorkgroupSize() { return workgroup_size_; }
/// @returns the return type for the function
- const type::Type* ReturnType() { return return_.type; }
+ const core::type::Type* ReturnType() { return return_.type; }
/// Sets the return attributes
/// @param builtin the builtin to set
@@ -142,7 +142,7 @@
std::optional<std::array<uint32_t, 3>> workgroup_size_;
struct {
- const type::Type* type = nullptr;
+ const core::type::Type* type = nullptr;
std::optional<enum ReturnBuiltin> builtin;
std::optional<Location> location;
bool invariant = false;
diff --git a/src/tint/lang/core/ir/function_param.cc b/src/tint/lang/core/ir/function_param.cc
index 5d9dbbe..a016342 100644
--- a/src/tint/lang/core/ir/function_param.cc
+++ b/src/tint/lang/core/ir/function_param.cc
@@ -20,7 +20,7 @@
namespace tint::ir {
-FunctionParam::FunctionParam(const type::Type* ty) : type_(ty) {
+FunctionParam::FunctionParam(const core::type::Type* ty) : type_(ty) {
TINT_ASSERT(ty != nullptr);
}
diff --git a/src/tint/lang/core/ir/function_param.h b/src/tint/lang/core/ir/function_param.h
index 8a4e589..0484dca 100644
--- a/src/tint/lang/core/ir/function_param.h
+++ b/src/tint/lang/core/ir/function_param.h
@@ -57,11 +57,11 @@
/// Constructor
/// @param type the type of the var
- explicit FunctionParam(const type::Type* type);
+ explicit FunctionParam(const core::type::Type* type);
~FunctionParam() override;
/// @returns the type of the var
- const type::Type* Type() override { return type_; }
+ const core::type::Type* Type() override { return type_; }
/// Sets the builtin information. Note, it is currently an error if the builtin is already set.
/// @param val the builtin to set
@@ -99,7 +99,7 @@
std::optional<struct BindingPoint>& BindingPoint() { return binding_point_; }
private:
- const type::Type* type_ = nullptr;
+ const core::type::Type* type_ = nullptr;
std::optional<enum FunctionParam::Builtin> builtin_;
std::optional<struct Location> location_;
std::optional<struct BindingPoint> binding_point_;
diff --git a/src/tint/lang/core/ir/instruction_result.cc b/src/tint/lang/core/ir/instruction_result.cc
index 300eca3..531f716 100644
--- a/src/tint/lang/core/ir/instruction_result.cc
+++ b/src/tint/lang/core/ir/instruction_result.cc
@@ -22,7 +22,7 @@
namespace tint::ir {
-InstructionResult::InstructionResult(const type::Type* type) : type_(type) {
+InstructionResult::InstructionResult(const core::type::Type* type) : type_(type) {
TINT_ASSERT(type_ != nullptr);
}
diff --git a/src/tint/lang/core/ir/instruction_result.h b/src/tint/lang/core/ir/instruction_result.h
index f2bdd9c..1b7d21a 100644
--- a/src/tint/lang/core/ir/instruction_result.h
+++ b/src/tint/lang/core/ir/instruction_result.h
@@ -25,7 +25,7 @@
public:
/// Constructor
/// @param type the type of the value
- explicit InstructionResult(const type::Type* type);
+ explicit InstructionResult(const core::type::Type* type);
/// Destructor
~InstructionResult() override;
@@ -34,11 +34,11 @@
void Destroy() override;
/// @returns the type of the value
- const type::Type* Type() override { return type_; }
+ const core::type::Type* Type() override { return type_; }
/// Sets the type of the value to @p type
/// @param type the new type of the value
- void SetType(const type::Type* type) { type_ = type; }
+ void SetType(const core::type::Type* type) { type_ = type; }
/// Sets the source instruction for this value
/// @param inst the instruction to set
@@ -49,7 +49,7 @@
private:
Instruction* source_ = nullptr;
- const type::Type* type_ = nullptr;
+ const core::type::Type* type_ = nullptr;
};
} // namespace tint::ir
diff --git a/src/tint/lang/core/ir/ir_helper_test.h b/src/tint/lang/core/ir/ir_helper_test.h
index bb62518..bdb2b6c 100644
--- a/src/tint/lang/core/ir/ir_helper_test.h
+++ b/src/tint/lang/core/ir/ir_helper_test.h
@@ -33,7 +33,7 @@
/// The IR builder
Builder b{mod};
/// The type manager
- type::Manager& ty{mod.Types()};
+ core::type::Manager& ty{mod.Types()};
};
using IRTestHelper = IRTestHelperBase<testing::Test>;
diff --git a/src/tint/lang/core/ir/load.cc b/src/tint/lang/core/ir/load.cc
index 3ed33f1..b4cbd78 100644
--- a/src/tint/lang/core/ir/load.cc
+++ b/src/tint/lang/core/ir/load.cc
@@ -24,7 +24,7 @@
Load::Load(InstructionResult* result, Value* from) {
flags_.Add(Flag::kSequenced);
- TINT_ASSERT(from->Type()->Is<type::Pointer>());
+ TINT_ASSERT(from->Type()->Is<core::type::Pointer>());
TINT_ASSERT(from && from->Type()->UnwrapPtr() == result->Type());
AddOperand(Load::kFromOperandOffset, from);
diff --git a/src/tint/lang/core/ir/module.h b/src/tint/lang/core/ir/module.h
index 8466f24..f5b638d 100644
--- a/src/tint/lang/core/ir/module.h
+++ b/src/tint/lang/core/ir/module.h
@@ -79,7 +79,7 @@
void SetName(Value* value, Symbol name);
/// @return the type manager for the module
- type::Manager& Types() { return constant_values.types; }
+ core::type::Manager& Types() { return constant_values.types; }
/// The block allocator
BlockAllocator<Block> blocks;
diff --git a/src/tint/lang/core/ir/transform/bgra8unorm_polyfill.cc b/src/tint/lang/core/ir/transform/bgra8unorm_polyfill.cc
index 2652c80..96c6ed5 100644
--- a/src/tint/lang/core/ir/transform/bgra8unorm_polyfill.cc
+++ b/src/tint/lang/core/ir/transform/bgra8unorm_polyfill.cc
@@ -38,7 +38,7 @@
Builder b{*ir};
/// The type manager.
- type::Manager& ty{ir->Types()};
+ core::type::Manager& ty{ir->Types()};
/// Process the module.
void Process() {
@@ -50,11 +50,11 @@
if (!var) {
continue;
}
- auto* ptr = var->Result()->Type()->As<type::Pointer>();
+ auto* ptr = var->Result()->Type()->As<core::type::Pointer>();
if (!ptr) {
continue;
}
- auto* storage_texture = ptr->StoreType()->As<type::StorageTexture>();
+ auto* storage_texture = ptr->StoreType()->As<core::type::StorageTexture>();
if (storage_texture &&
storage_texture->texel_format() == core::TexelFormat::kBgra8Unorm) {
ReplaceVar(var, storage_texture);
@@ -70,7 +70,7 @@
for (auto* func : ir->functions) {
for (uint32_t index = 0; index < func->Params().Length(); index++) {
auto* param = func->Params()[index];
- auto* storage_texture = param->Type()->As<type::StorageTexture>();
+ auto* storage_texture = param->Type()->As<core::type::StorageTexture>();
if (storage_texture &&
storage_texture->texel_format() == core::TexelFormat::kBgra8Unorm) {
ReplaceParameter(func, param, index, storage_texture);
@@ -82,10 +82,10 @@
/// Replace a variable declaration with one that uses rgba8unorm instead of bgra8unorm.
/// @param old_var the variable declaration to replace
/// @param bgra8 the bgra8unorm texture type
- void ReplaceVar(Var* old_var, const type::StorageTexture* bgra8) {
+ void ReplaceVar(Var* old_var, const core::type::StorageTexture* bgra8) {
// Redeclare the variable with a rgba8unorm texel format.
- auto* rgba8 = ty.Get<type::StorageTexture>(bgra8->dim(), core::TexelFormat::kRgba8Unorm,
- bgra8->access(), bgra8->type());
+ auto* rgba8 = ty.Get<core::type::StorageTexture>(
+ bgra8->dim(), core::TexelFormat::kRgba8Unorm, bgra8->access(), bgra8->type());
auto* new_var = b.Var(ty.ptr(handle, rgba8));
auto bp = old_var->BindingPoint();
new_var->SetBindingPoint(bp->group, bp->binding);
@@ -106,10 +106,10 @@
void ReplaceParameter(Function* func,
FunctionParam* old_param,
uint32_t index,
- const type::StorageTexture* bgra8) {
+ const core::type::StorageTexture* bgra8) {
// Redeclare the parameter with a rgba8unorm texel format.
- auto* rgba8 = ty.Get<type::StorageTexture>(bgra8->dim(), core::TexelFormat::kRgba8Unorm,
- bgra8->access(), bgra8->type());
+ auto* rgba8 = ty.Get<core::type::StorageTexture>(
+ bgra8->dim(), core::TexelFormat::kRgba8Unorm, bgra8->access(), bgra8->type());
auto* new_param = b.FunctionParam(rgba8);
if (auto name = ir->NameOf(old_param)) {
ir->SetName(new_param, name.NameView());
@@ -142,8 +142,8 @@
call->SetOperand(use.operand_index, new_value);
if (call->Func() == core::Function::kTextureStore) {
// Swizzle the value argument of a `textureStore()` builtin.
- auto* tex = old_value->Type()->As<type::StorageTexture>();
- auto index = type::IsTextureArray(tex->dim()) ? 3u : 2u;
+ auto* tex = old_value->Type()->As<core::type::StorageTexture>();
+ auto index = core::type::IsTextureArray(tex->dim()) ? 3u : 2u;
auto* value = call->Args()[index];
auto* swizzle = b.Swizzle(value->Type(), value, Vector{2u, 1u, 0u, 3u});
swizzle->InsertBefore(call);
diff --git a/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc b/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc
index 2c229f4..4cf15d0 100644
--- a/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc
+++ b/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc
@@ -46,8 +46,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, NoModify_ModuleScopeVariable_Rgba) {
auto format = core::TexelFormat::kRgba8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var = b.Var("texture", ty.ptr(handle, texture_ty));
var->SetBindingPoint(1, 2);
@@ -86,8 +87,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, NoModify_UserFunctionParameter_Rgba) {
auto format = core::TexelFormat::kRgba8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* func = b.Function("foo", ty.void_());
auto* texture = b.FunctionParam("texture", texture_ty);
@@ -117,8 +119,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, ModuleScopeVariable) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var = b.Var("texture", ty.ptr(handle, texture_ty));
var->SetBindingPoint(1, 2);
@@ -170,8 +173,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, UserFunctionParameter) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* func = b.Function("foo", ty.void_());
auto* texture = b.FunctionParam("texture", texture_ty);
@@ -209,8 +213,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, ModuleScopePassedToUserFunction) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var = b.Var("texture", ty.ptr(handle, texture_ty));
var->SetBindingPoint(1, 2);
@@ -288,8 +293,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, ModuleScopePassedToUserFunction_MultipleTextures) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var_a = b.Var("texture_a", ty.ptr(handle, texture_ty));
auto* var_b = b.Var("texture_b", ty.ptr(handle, texture_ty));
@@ -393,8 +399,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, MutipleUsesOfOneTexture) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var_a = b.Var("texture", ty.ptr(handle, texture_ty));
var_a->SetBindingPoint(1, 2);
@@ -493,8 +500,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, ArrayedImage) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2dArray, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2dArray, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var = b.Var("texture", ty.ptr(handle, texture_ty));
var->SetBindingPoint(1, 2);
@@ -547,8 +555,9 @@
TEST_F(IR_Bgra8UnormPolyfillTest, TextureDimensions) {
auto format = core::TexelFormat::kBgra8Unorm;
- auto* texture_ty = ty.Get<type::StorageTexture>(type::TextureDimension::k2d, format, write,
- type::StorageTexture::SubtypeFor(format, ty));
+ auto* texture_ty =
+ ty.Get<core::type::StorageTexture>(core::type::TextureDimension::k2d, format, write,
+ core::type::StorageTexture::SubtypeFor(format, ty));
auto* var = b.Var("texture", ty.ptr(handle, texture_ty));
var->SetBindingPoint(1, 2);
diff --git a/src/tint/lang/core/ir/transform/block_decorated_structs.cc b/src/tint/lang/core/ir/transform/block_decorated_structs.cc
index 72a232a..befbbde 100644
--- a/src/tint/lang/core/ir/transform/block_decorated_structs.cc
+++ b/src/tint/lang/core/ir/transform/block_decorated_structs.cc
@@ -42,7 +42,7 @@
if (!var) {
continue;
}
- auto* ptr = var->Result()->Type()->As<type::Pointer>();
+ auto* ptr = var->Result()->Type()->As<core::type::Pointer>();
if (!ptr || !core::IsHostShareable(ptr->AddressSpace())) {
continue;
}
@@ -51,14 +51,14 @@
// Now process the buffer variables.
for (auto* var : buffer_variables) {
- auto* ptr = var->Result()->Type()->As<type::Pointer>();
+ auto* ptr = var->Result()->Type()->As<core::type::Pointer>();
auto* store_ty = ptr->StoreType();
bool wrapped = false;
- Vector<const type::StructMember*, 4> members;
+ Vector<const core::type::StructMember*, 4> members;
// Build the member list for the block-decorated structure.
- if (auto* str = store_ty->As<type::Struct>(); str && !str->HasFixedFootprint()) {
+ if (auto* str = store_ty->As<core::type::Struct>(); str && !str->HasFixedFootprint()) {
// We know the original struct will only ever be used as the store type of a buffer, so
// just redeclare it as a block-decorated struct.
for (auto* member : str->Members()) {
@@ -67,25 +67,25 @@
} else {
// The original struct might be used in other places, so create a new block-decorated
// struct that wraps the original struct.
- members.Push(ir->Types().Get<type::StructMember>(
+ members.Push(ir->Types().Get<core::type::StructMember>(
/* name */ ir->symbols.New(),
/* type */ store_ty,
/* index */ 0u,
/* offset */ 0u,
/* align */ store_ty->Align(),
/* size */ store_ty->Size(),
- /* attributes */ type::StructMemberAttributes{}));
+ /* attributes */ core::type::StructMemberAttributes{}));
wrapped = true;
}
// Create the block-decorated struct.
- auto* block_struct = ir->Types().Get<type::Struct>(
+ auto* block_struct = ir->Types().Get<core::type::Struct>(
/* name */ ir->symbols.New(),
/* members */ members,
/* align */ store_ty->Align(),
/* size */ tint::RoundUp(store_ty->Align(), store_ty->Size()),
/* size_no_padding */ store_ty->Size());
- block_struct->SetStructFlag(type::StructFlag::kBlock);
+ block_struct->SetStructFlag(core::type::StructFlag::kBlock);
// Replace the old variable declaration with one that uses the block-decorated struct type.
auto* new_var =
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill.cc b/src/tint/lang/core/ir/transform/builtin_polyfill.cc
index f20cf06..57e94e6 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill.cc
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill.cc
@@ -40,7 +40,7 @@
Builder b{*ir};
/// The type manager.
- type::Manager& ty{ir->Types()};
+ core::type::Manager& ty{ir->Types()};
/// The symbol table.
SymbolTable& sym{ir->symbols};
@@ -82,9 +82,10 @@
break;
case core::Function::kTextureSampleBaseClampToEdge:
if (config.texture_sample_base_clamp_to_edge_2d_f32) {
- auto* tex = builtin->Args()[0]->Type()->As<type::SampledTexture>();
- if (tex && tex->dim() == type::TextureDimension::k2d &&
- tex->type()->Is<type::F32>()) {
+ auto* tex =
+ builtin->Args()[0]->Type()->As<core::type::SampledTexture>();
+ if (tex && tex->dim() == core::type::TextureDimension::k2d &&
+ tex->type()->Is<core::type::F32>()) {
worklist.Push(builtin);
}
}
@@ -136,8 +137,9 @@
/// @param el_ty the type to extend
/// @param match the type to match the component count of
/// @returns a type with the same number of vector components as @p match
- const type::Type* MatchWidth(const type::Type* el_ty, const type::Type* match) {
- if (auto* vec = match->As<type::Vector>()) {
+ const core::type::Type* MatchWidth(const core::type::Type* el_ty,
+ const core::type::Type* match) {
+ if (auto* vec = match->As<core::type::Vector>()) {
return ty.vec(el_ty, vec->Width());
}
return el_ty;
@@ -148,8 +150,8 @@
/// @param element the value to extend
/// @param match the type to match the component count of
/// @returns a value with the same number of vector components as @p match
- ir::Constant* MatchWidth(ir::Constant* element, const type::Type* match) {
- if (auto* vec = match->As<type::Vector>()) {
+ ir::Constant* MatchWidth(ir::Constant* element, const core::type::Type* match) {
+ if (auto* vec = match->As<core::type::Vector>()) {
return b.Splat(MatchWidth(element->Type(), match), element, vec->Width());
}
return element;
@@ -412,10 +414,10 @@
auto* type = call->Result()->Type();
ir::Constant* zero = nullptr;
ir::Constant* one = nullptr;
- if (type->DeepestElement()->Is<type::F32>()) {
+ if (type->DeepestElement()->Is<core::type::F32>()) {
zero = MatchWidth(b.Constant(0_f), type);
one = MatchWidth(b.Constant(1_f), type);
- } else if (type->DeepestElement()->Is<type::F16>()) {
+ } else if (type->DeepestElement()->Is<core::type::F16>()) {
zero = MatchWidth(b.Constant(0_h), type);
one = MatchWidth(b.Constant(1_h), type);
}
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc b/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
index eb23968..3c57235 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
@@ -32,8 +32,8 @@
/// @param result_ty the result type of the builtin call
/// @param arg_types the arguments types for the builtin call
void Build(core::Function builtin,
- const type::Type* result_ty,
- VectorRef<const type::Type*> arg_types) {
+ const core::type::Type* result_ty,
+ VectorRef<const core::type::Type*> arg_types) {
Vector<FunctionParam*, 4> args;
for (auto* arg_ty : arg_types) {
args.Push(b.FunctionParam("arg", arg_ty));
@@ -1059,7 +1059,8 @@
}
TEST_F(IR_BuiltinPolyfillTest, TextureSampleBaseClampToEdge_2d_f32_NoPolyfill) {
- auto* texture_ty = ty.Get<type::SampledTexture>(type::TextureDimension::k2d, ty.f32());
+ auto* texture_ty =
+ ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2d, ty.f32());
Build(core::Function::kTextureSampleBaseClampToEdge, ty.vec4<f32>(),
Vector{texture_ty, ty.sampler(), ty.vec2<f32>()});
auto* src = R"(
@@ -1081,7 +1082,8 @@
}
TEST_F(IR_BuiltinPolyfillTest, TextureSampleBaseClampToEdge_2d_f32) {
- auto* texture_ty = ty.Get<type::SampledTexture>(type::TextureDimension::k2d, ty.f32());
+ auto* texture_ty =
+ ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2d, ty.f32());
Build(core::Function::kTextureSampleBaseClampToEdge, ty.vec4<f32>(),
Vector{texture_ty, ty.sampler(), ty.vec2<f32>()});
auto* src = R"(
diff --git a/src/tint/lang/core/ir/transform/demote_to_helper.cc b/src/tint/lang/core/ir/transform/demote_to_helper.cc
index e60b3a6..d07ee4a 100644
--- a/src/tint/lang/core/ir/transform/demote_to_helper.cc
+++ b/src/tint/lang/core/ir/transform/demote_to_helper.cc
@@ -37,7 +37,7 @@
Builder b{*ir};
/// The type manager.
- type::Manager& ty{ir->Types()};
+ core::type::Manager& ty{ir->Types()};
/// The global "has not discarded" flag.
Var* continue_execution = nullptr;
@@ -139,7 +139,7 @@
auto* result = ifelse->True()->Append(inst);
TINT_ASSERT(!inst->HasMultiResults());
- if (inst->HasResults() && !inst->Result()->Type()->Is<type::Void>()) {
+ if (inst->HasResults() && !inst->Result()->Type()->Is<core::type::Void>()) {
// The original instruction had a result, so return it from the if instruction.
ifelse->SetResults(Vector{b.InstructionResult(inst->Result()->Type())});
inst->Result()->ReplaceAllUsesWith(ifelse->Result());
@@ -169,7 +169,7 @@
},
[&](Store* store) {
// Conditionalize stores to host-visible address spaces.
- auto* ptr = store->To()->Type()->As<type::Pointer>();
+ auto* ptr = store->To()->Type()->As<core::type::Pointer>();
if (ptr && ptr->AddressSpace() == core::AddressSpace::kStorage) {
conditionalize(store);
}
diff --git a/src/tint/lang/core/ir/transform/demote_to_helper_test.cc b/src/tint/lang/core/ir/transform/demote_to_helper_test.cc
index 4b56bd7..721a983 100644
--- a/src/tint/lang/core/ir/transform/demote_to_helper_test.cc
+++ b/src/tint/lang/core/ir/transform/demote_to_helper_test.cc
@@ -517,9 +517,9 @@
auto format = core::TexelFormat::kR32Float;
auto* texture =
b.Var("texture", ty.ptr(core::AddressSpace::kHandle,
- ty.Get<type::StorageTexture>(
- type::TextureDimension::k2d, format, core::Access::kWrite,
- type::StorageTexture::SubtypeFor(format, ty))));
+ ty.Get<core::type::StorageTexture>(
+ core::type::TextureDimension::k2d, format, core::Access::kWrite,
+ core::type::StorageTexture::SubtypeFor(format, ty))));
texture->SetBindingPoint(0, 0);
b.RootBlock()->Append(texture);
@@ -777,8 +777,9 @@
b.Discard();
b.ExitIf(ifelse);
});
- auto* result = b.Call(type::CreateAtomicCompareExchangeResult(ty, mod.symbols, ty.i32()),
- core::Function::kAtomicCompareExchangeWeak, buffer, 0_i, 42_i);
+ auto* result =
+ b.Call(core::type::CreateAtomicCompareExchangeResult(ty, mod.symbols, ty.i32()),
+ core::Function::kAtomicCompareExchangeWeak, buffer, 0_i, 42_i);
b.Add(ty.i32(), b.Access(ty.i32(), result, 0_i), 1_i);
b.Return(ep, 0.5_f);
});
diff --git a/src/tint/lang/core/ir/transform/helper_test.h b/src/tint/lang/core/ir/transform/helper_test.h
index 32d2919..10552c5 100644
--- a/src/tint/lang/core/ir/transform/helper_test.h
+++ b/src/tint/lang/core/ir/transform/helper_test.h
@@ -60,7 +60,7 @@
/// The test IR builder.
ir::Builder b{mod};
/// The type manager.
- type::Manager& ty{mod.Types()};
+ core::type::Manager& ty{mod.Types()};
};
using TransformTest = TransformTestBase<testing::Test>;
diff --git a/src/tint/lang/core/ir/transform/shader_io.cc b/src/tint/lang/core/ir/transform/shader_io.cc
index 51e8e615..1858a39 100644
--- a/src/tint/lang/core/ir/transform/shader_io.cc
+++ b/src/tint/lang/core/ir/transform/shader_io.cc
@@ -75,9 +75,9 @@
/// The IR builder.
Builder b{*ir};
/// The type manager.
- type::Manager& ty{ir->Types()};
+ core::type::Manager& ty{ir->Types()};
/// The set of struct members that need to have their IO attributes stripped.
- Hashset<const type::StructMember*, 8> members_to_strip;
+ Hashset<const core::type::StructMember*, 8> members_to_strip;
/// The entry point currently being processed.
Function* func = nullptr;
@@ -132,7 +132,7 @@
/// Gather the shader inputs.
void GatherInputs() {
for (auto* param : func->Params()) {
- if (auto* str = param->Type()->As<type::Struct>()) {
+ if (auto* str = param->Type()->As<core::type::Struct>()) {
for (auto* member : str->Members()) {
auto name = str->Name().Name() + "_" + member->Name().Name();
backend->AddInput(ir->symbols.Register(name), member->Type(),
@@ -141,7 +141,7 @@
}
} else {
// Pull out the IO attributes and remove them from the parameter.
- type::StructMemberAttributes attributes;
+ core::type::StructMemberAttributes attributes;
if (auto loc = param->Location()) {
attributes.location = loc->value;
if (loc->interpolation) {
@@ -163,11 +163,11 @@
/// Gather the shader outputs.
void GatherOutput() {
- if (func->ReturnType()->Is<type::Void>()) {
+ if (func->ReturnType()->Is<core::type::Void>()) {
return;
}
- if (auto* str = func->ReturnType()->As<type::Struct>()) {
+ if (auto* str = func->ReturnType()->As<core::type::Struct>()) {
for (auto* member : str->Members()) {
auto name = str->Name().Name() + "_" + member->Name().Name();
backend->AddOutput(ir->symbols.Register(name), member->Type(),
@@ -176,7 +176,7 @@
}
} else {
// Pull out the IO attributes and remove them from the original function.
- type::StructMemberAttributes attributes;
+ core::type::StructMemberAttributes attributes;
if (auto loc = func->ReturnLocation()) {
attributes.location = loc->value;
func->ClearReturnLocation();
@@ -198,7 +198,7 @@
uint32_t input_idx = 0;
Vector<Value*, 4> args;
for (auto* param : func->Params()) {
- if (auto* str = param->Type()->As<type::Struct>()) {
+ if (auto* str = param->Type()->As<core::type::Struct>()) {
Vector<Value*, 4> construct_args;
for (uint32_t i = 0; i < str->Members().Length(); i++) {
construct_args.Push(backend->GetInput(builder, input_idx++));
@@ -216,13 +216,13 @@
/// @param builder the IR builder for new instructions
/// @param inner_result the return value from calling the original entry point function
void SetOutputs(Builder& builder, Value* inner_result) {
- if (auto* str = inner_result->Type()->As<type::Struct>()) {
+ if (auto* str = inner_result->Type()->As<core::type::Struct>()) {
for (auto* member : str->Members()) {
Value* from =
builder.Access(member->Type(), inner_result, u32(member->Index()))->Result();
backend->SetOutput(builder, member->Index(), from);
}
- } else if (!inner_result->Type()->Is<type::Void>()) {
+ } else if (!inner_result->Type()->Is<core::type::Void>()) {
backend->SetOutput(builder, 0u, inner_result);
}
}
@@ -232,7 +232,7 @@
// Remove IO attributes from all structure members that had them prior to this transform.
for (auto* member : members_to_strip) {
// TODO(crbug.com/tint/745): Remove the const_cast.
- const_cast<type::StructMember*>(member)->SetAttributes({});
+ const_cast<core::type::StructMember*>(member)->SetAttributes({});
}
}
};
@@ -248,7 +248,7 @@
}
// Skip entry points with no inputs or outputs.
- if (func->Params().IsEmpty() && func->ReturnType()->Is<type::Void>()) {
+ if (func->Params().IsEmpty() && func->ReturnType()->Is<core::type::Void>()) {
continue;
}
diff --git a/src/tint/lang/core/ir/transform/shader_io.h b/src/tint/lang/core/ir/transform/shader_io.h
index e5b865f..23c20b5 100644
--- a/src/tint/lang/core/ir/transform/shader_io.h
+++ b/src/tint/lang/core/ir/transform/shader_io.h
@@ -38,8 +38,8 @@
/// @param type the type of the input
/// @param attributes the IO attributes
virtual void AddInput(Symbol name,
- const type::Type* type,
- type::StructMemberAttributes attributes) {
+ const core::type::Type* type,
+ core::type::StructMemberAttributes attributes) {
inputs.Push({name, type, std::move(attributes)});
}
@@ -48,8 +48,8 @@
/// @param type the type of the output
/// @param attributes the IO attributes
virtual void AddOutput(Symbol name,
- const type::Type* type,
- type::StructMemberAttributes attributes) {
+ const core::type::Type* type,
+ core::type::StructMemberAttributes attributes) {
outputs.Push({name, type, std::move(attributes)});
}
@@ -81,16 +81,16 @@
Builder b{*ir};
/// The type manager.
- type::Manager& ty{ir->Types()};
+ core::type::Manager& ty{ir->Types()};
/// The original entry point function.
Function* func = nullptr;
/// The list of shader inputs.
- Vector<type::Manager::StructMemberDesc, 4> inputs;
+ Vector<core::type::Manager::StructMemberDesc, 4> inputs;
/// The list of shader outputs.
- Vector<type::Manager::StructMemberDesc, 4> outputs;
+ Vector<core::type::Manager::StructMemberDesc, 4> outputs;
};
/// The signature for a function that creates a backend state object.
diff --git a/src/tint/lang/core/ir/transform/std140.cc b/src/tint/lang/core/ir/transform/std140.cc
index 47c1562..3a1430b 100644
--- a/src/tint/lang/core/ir/transform/std140.cc
+++ b/src/tint/lang/core/ir/transform/std140.cc
@@ -39,19 +39,19 @@
Builder b{*ir};
/// The type manager.
- type::Manager& ty{ir->Types()};
+ core::type::Manager& ty{ir->Types()};
/// The symbol table.
SymbolTable& sym{ir->symbols};
/// Map from original type to a new type with decomposed matrices.
- Hashmap<const type::Type*, const type::Type*, 4> rewritten_types{};
+ Hashmap<const core::type::Type*, const core::type::Type*, 4> rewritten_types{};
/// Map from struct member to its new index.
- Hashmap<const type::StructMember*, uint32_t, 4> member_index_map{};
+ Hashmap<const core::type::StructMember*, uint32_t, 4> member_index_map{};
/// Map from a type to a helper function that will convert its rewritten form back to it.
- Hashmap<const type::Struct*, Function*, 4> convert_helpers{};
+ Hashmap<const core::type::Struct*, Function*, 4> convert_helpers{};
/// Process the module.
void Process() {
@@ -66,7 +66,7 @@
if (!var || !var->Alive()) {
continue;
}
- auto* ptr = var->Result()->Type()->As<type::Pointer>();
+ auto* ptr = var->Result()->Type()->As<core::type::Pointer>();
if (!ptr || ptr->AddressSpace() != core::AddressSpace::kUniform) {
continue;
}
@@ -80,7 +80,7 @@
for (auto* var : buffer_variables) {
// Create a new variable with the modified store type.
const auto& bp = var->BindingPoint();
- auto* store_type = var->Result()->Type()->As<type::Pointer>()->StoreType();
+ auto* store_type = var->Result()->Type()->As<core::type::Pointer>()->StoreType();
auto* new_var = b.Var(ty.ptr(uniform, RewriteType(store_type)));
new_var->SetBindingPoint(bp->group, bp->binding);
if (auto name = ir->NameOf(var)) {
@@ -99,25 +99,25 @@
/// @param mat the matrix type to check
/// @returns true if @p mat needs to be decomposed
- static bool NeedsDecomposing(const type::Matrix* mat) { return mat->ColumnStride() & 15; }
+ static bool NeedsDecomposing(const core::type::Matrix* mat) { return mat->ColumnStride() & 15; }
/// Rewrite a type if necessary, decomposing contained matrices.
/// @param type the type to rewrite
/// @returns the new type
- const type::Type* RewriteType(const type::Type* type) {
- return rewritten_types.GetOrCreate(type, [&]() -> const type::Type* {
+ const core::type::Type* RewriteType(const core::type::Type* type) {
+ return rewritten_types.GetOrCreate(type, [&]() -> const core::type::Type* {
return tint::Switch(
type,
- [&](const type::Array* arr) -> const type::Type* {
+ [&](const core::type::Array* arr) -> const core::type::Type* {
// Create a new array with element type potentially rewritten.
return ty.array(RewriteType(arr->ElemType()), arr->ConstantCount().value());
},
- [&](const type::Struct* str) -> const type::Type* {
+ [&](const core::type::Struct* str) -> const core::type::Type* {
bool needs_rewrite = false;
uint32_t member_index = 0;
- Vector<const type::StructMember*, 4> new_members;
+ Vector<const core::type::StructMember*, 4> new_members;
for (auto* member : str->Members()) {
- auto* mat = member->Type()->As<type::Matrix>();
+ auto* mat = member->Type()->As<core::type::Matrix>();
if (mat && NeedsDecomposing(mat)) {
// Decompose these matrices into a separate member for each column.
member_index_map.Add(member, member_index);
@@ -126,9 +126,9 @@
for (uint32_t i = 0; i < mat->columns(); i++) {
StringStream ss;
ss << member->Name().Name() << "_col" << std::to_string(i);
- new_members.Push(ty.Get<type::StructMember>(
+ new_members.Push(ty.Get<core::type::StructMember>(
sym.New(ss.str()), col, member_index, offset, col->Align(),
- col->Size(), type::StructMemberAttributes{}));
+ col->Size(), core::type::StructMemberAttributes{}));
offset += col->Align();
member_index++;
}
@@ -136,9 +136,10 @@
} else {
// For all other types, recursively rewrite them as necessary.
auto* new_member_ty = RewriteType(member->Type());
- new_members.Push(ty.Get<type::StructMember>(
+ new_members.Push(ty.Get<core::type::StructMember>(
member->Name(), new_member_ty, member_index, member->Offset(),
- member->Align(), member->Size(), type::StructMemberAttributes{}));
+ member->Align(), member->Size(),
+ core::type::StructMemberAttributes{}));
member_index_map.Add(member, member_index);
member_index++;
if (new_member_ty != member->Type()) {
@@ -153,9 +154,9 @@
}
// Create a new struct with the rewritten members.
- auto* new_str = ty.Get<type::Struct>(sym.New(str->Name().Name() + "_std140"),
- std::move(new_members), str->Align(),
- str->Size(), str->SizeNoPadding());
+ auto* new_str = ty.Get<core::type::Struct>(
+ sym.New(str->Name().Name() + "_std140"), std::move(new_members),
+ str->Align(), str->Size(), str->SizeNoPadding());
for (auto flag : str->StructFlags()) {
new_str->SetStructFlag(flag);
}
@@ -173,7 +174,7 @@
/// @param root the root value being accessed into
/// @param indices the access indices that get to the first column of the decomposed matrix
/// @returns the loaded matrix
- Value* LoadMatrix(const type::Matrix* mat, Value* root, Vector<Value*, 4> indices) {
+ Value* LoadMatrix(const core::type::Matrix* mat, Value* root, Vector<Value*, 4> indices) {
// Load each column vector from the struct and reconstruct the original matrix type.
Vector<Value*, 4> args;
auto first_column = indices.Back()->As<Constant>()->Value()->ValueAs<uint32_t>();
@@ -189,17 +190,17 @@
/// @param source the value to convert
/// @param orig_ty the original type to convert type
/// @returns the converted value
- Value* Convert(Value* source, const type::Type* orig_ty) {
+ Value* Convert(Value* source, const core::type::Type* orig_ty) {
if (source->Type() == orig_ty) {
// The type was not rewritten, so just return the source value.
return source;
}
return tint::Switch(
orig_ty, //
- [&](const type::Struct* str) -> Value* {
+ [&](const core::type::Struct* str) -> Value* {
// Create a helper function that converts the struct to the original type.
auto* helper = convert_helpers.GetOrCreate(str, [&] {
- auto* input_str = source->Type()->As<type::Struct>();
+ auto* input_str = source->Type()->As<core::type::Struct>();
auto* func = b.Function("convert_" + str->FriendlyName(), str);
auto* input = b.FunctionParam("input", input_str);
func->SetParams({input});
@@ -207,7 +208,7 @@
uint32_t index = 0;
Vector<Value*, 4> args;
for (auto* member : str->Members()) {
- if (auto* mat = member->Type()->As<type::Matrix>();
+ if (auto* mat = member->Type()->As<core::type::Matrix>();
mat && NeedsDecomposing(mat)) {
// Extract each decomposed column and reconstruct the matrix.
Vector<Value*, 4> columns;
@@ -235,7 +236,7 @@
// Call the helper function to convert the struct.
return b.Call(str, helper, source)->Result();
},
- [&](const type::Array* arr) -> Value* {
+ [&](const core::type::Array* arr) -> Value* {
// Create a loop that copies and converts each element of the array.
auto* el_ty = source->Type()->Elements().type;
auto* new_arr = b.Var(ty.ptr(function, arr));
@@ -262,7 +263,7 @@
auto* current_type = access->Object()->Type()->UnwrapPtr();
Vector<Value*, 4> indices;
for (auto idx : access->Indices()) {
- if (auto* str = current_type->As<type::Struct>()) {
+ if (auto* str = current_type->As<core::type::Struct>()) {
uint32_t old_index = idx->As<Constant>()->Value()->ValueAs<uint32_t>();
uint32_t new_index = *member_index_map.Get(str->Members()[old_index]);
indices.Push(b.Constant(u32(new_index)));
@@ -275,7 +276,7 @@
// If we've hit a matrix that was decomposed, load the whole matrix.
// Any additional accesses will extract columns instead of producing
// pointers.
- if (auto* mat = current_type->As<type::Matrix>();
+ if (auto* mat = current_type->As<core::type::Matrix>();
mat && NeedsDecomposing(mat)) {
replacement = LoadMatrix(mat, replacement, std::move(indices));
indices.Clear();
@@ -284,7 +285,7 @@
if (!indices.IsEmpty()) {
// Emit the access with the modified indices.
- if (replacement->Type()->Is<type::Pointer>()) {
+ if (replacement->Type()->Is<core::type::Pointer>()) {
current_type = ty.ptr(uniform, RewriteType(current_type));
}
auto* new_access = b.Access(current_type, replacement, std::move(indices));
@@ -297,7 +298,7 @@
access->Destroy();
},
[&](Load* load) {
- if (!replacement->Type()->Is<type::Pointer>()) {
+ if (!replacement->Type()->Is<core::type::Pointer>()) {
// We have already loaded to a value type, so this load just folds away.
load->Result()->ReplaceAllUsesWith(replacement);
} else {
@@ -311,7 +312,7 @@
[&](LoadVectorElement* load) {
// We should have loaded the decomposed matrix, reconstructed it, so this is now
// extracting from a value type.
- TINT_ASSERT(!replacement->Type()->Is<type::Pointer>());
+ TINT_ASSERT(!replacement->Type()->Is<core::type::Pointer>());
auto* access = b.Access(load->Result()->Type(), replacement, load->Index());
load->Result()->ReplaceAllUsesWith(access->Result());
load->Destroy();
diff --git a/src/tint/lang/core/ir/transform/std140_test.cc b/src/tint/lang/core/ir/transform/std140_test.cc
index 58cc286..c5510f1 100644
--- a/src/tint/lang/core/ir/transform/std140_test.cc
+++ b/src/tint/lang/core/ir/transform/std140_test.cc
@@ -52,7 +52,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -96,7 +96,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -140,7 +140,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(storage, structure));
buffer->SetBindingPoint(0, 0);
@@ -186,7 +186,7 @@
ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("arr"), ty.array(mat, 4u)},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -229,7 +229,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -300,7 +300,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -372,7 +372,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -445,7 +445,7 @@
auto* structure = ty.Struct(mod.symbols.New("MyStruct"), {
{mod.symbols.New("a"), mat},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -523,7 +523,7 @@
ty.Struct(mod.symbols.New("Outer"), {
{mod.symbols.New("arr"), ty.array(inner, 4u)},
});
- outer->SetStructFlag(type::kBlock);
+ outer->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, outer));
buffer->SetBindingPoint(0, 0);
@@ -643,7 +643,7 @@
auto* outer = ty.Struct(mod.symbols.New("Outer"), {
{mod.symbols.New("inner"), inner},
});
- outer->SetStructFlag(type::kBlock);
+ outer->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, outer));
buffer->SetBindingPoint(0, 0);
@@ -734,7 +734,7 @@
{mod.symbols.New("m"), ty.mat3x2<f32>()},
{mod.symbols.New("inner"), inner},
});
- outer->SetStructFlag(type::kBlock);
+ outer->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, outer));
buffer->SetBindingPoint(0, 0);
@@ -828,7 +828,7 @@
{mod.symbols.New("arr"), arr},
{mod.symbols.New("d"), ty.i32()},
});
- outer->SetStructFlag(type::kBlock);
+ outer->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, outer));
buffer->SetBindingPoint(0, 0);
@@ -998,7 +998,7 @@
{mod.symbols.New("arr"), arr},
{mod.symbols.New("d"), ty.i32()},
});
- outer->SetStructFlag(type::kBlock);
+ outer->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, outer));
buffer->SetBindingPoint(0, 0);
@@ -1173,7 +1173,7 @@
{mod.symbols.New("arr"), arr},
{mod.symbols.New("d"), ty.i32()},
});
- outer->SetStructFlag(type::kBlock);
+ outer->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, outer));
buffer->SetBindingPoint(0, 0);
@@ -1336,18 +1336,18 @@
TEST_F(IR_Std140Test, NonDefaultAlignAndSize) {
auto* mat = ty.mat4x2<f32>();
- auto* structure = ty.Get<type::Struct>(
+ auto* structure = ty.Get<core::type::Struct>(
mod.symbols.New("MyStruct"),
Vector{
- ty.Get<type::StructMember>(mod.symbols.New("a"), ty.i32(), 0u, 0u, 0u, 16u,
- type::StructMemberAttributes{}),
- ty.Get<type::StructMember>(mod.symbols.New("m"), mat, 1u, 64u, 32u, 64u,
- type::StructMemberAttributes{}),
- ty.Get<type::StructMember>(mod.symbols.New("b"), ty.i32(), 2u, 128u, 8u, 32u,
- type::StructMemberAttributes{}),
+ ty.Get<core::type::StructMember>(mod.symbols.New("a"), ty.i32(), 0u, 0u, 0u, 16u,
+ core::type::StructMemberAttributes{}),
+ ty.Get<core::type::StructMember>(mod.symbols.New("m"), mat, 1u, 64u, 32u, 64u,
+ core::type::StructMemberAttributes{}),
+ ty.Get<core::type::StructMember>(mod.symbols.New("b"), ty.i32(), 2u, 128u, 8u, 32u,
+ core::type::StructMemberAttributes{}),
},
128u, 256u, 160u);
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
@@ -1448,7 +1448,7 @@
{mod.symbols.New("c"), ty.mat4x3<f16>()},
{mod.symbols.New("d"), ty.mat4x4<f16>()},
});
- structure->SetStructFlag(type::kBlock);
+ structure->SetStructFlag(core::type::kBlock);
auto* buffer = b.Var("buffer", ty.ptr(uniform, structure));
buffer->SetBindingPoint(0, 0);
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index ca5eb5a..d9f17fa 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -321,7 +321,7 @@
}
void Validator::CheckAccess(ir::Access* a) {
- bool is_ptr = a->Object()->Type()->Is<type::Pointer>();
+ bool is_ptr = a->Object()->Type()->Is<core::type::Pointer>();
auto* ty = a->Object()->Type()->UnwrapPtr();
auto current = [&] { return is_ptr ? "ptr<" + ty->FriendlyName() + ">" : ty->FriendlyName(); };
@@ -338,7 +338,7 @@
return;
}
- if (is_ptr && ty->Is<type::Vector>()) {
+ if (is_ptr && ty->Is<core::type::Vector>()) {
err("cannot obtain address of vector element");
return;
}
@@ -379,7 +379,7 @@
}
auto* want_ty = a->Result()->Type()->UnwrapPtr();
- bool want_ptr = a->Result()->Type()->Is<type::Pointer>();
+ bool want_ptr = a->Result()->Type()->Is<core::type::Pointer>();
if (TINT_UNLIKELY(ty != want_ty || is_ptr != want_ptr)) {
std::string want =
want_ptr ? "ptr<" + want_ty->FriendlyName() + ">" : want_ty->FriendlyName();
@@ -406,7 +406,7 @@
void Validator::CheckIf(If* if_) {
CheckOperandNotNull(if_, if_->Condition(), If::kConditionOperandOffset);
- if (if_->Condition() && !if_->Condition()->Type()->Is<type::Bool>()) {
+ if (if_->Condition() && !if_->Condition()->Type()->Is<core::type::Bool>()) {
AddError(if_, If::kConditionOperandOffset,
InstError(if_, "condition must be a `bool` type"));
}
@@ -512,7 +512,7 @@
AddError(ret, InstError(ret, "undefined function"));
return;
}
- if (func->ReturnType()->Is<type::Void>()) {
+ if (func->ReturnType()->Is<core::type::Void>()) {
if (ret->Value()) {
AddError(ret, InstError(ret, "unexpected return value"));
}
@@ -604,7 +604,7 @@
}
}
-const type::Type* Validator::GetVectorPtrElementType(Instruction* inst, size_t idx) {
+const core::type::Type* Validator::GetVectorPtrElementType(Instruction* inst, size_t idx) {
auto* operand = inst->Operands()[idx];
if (TINT_UNLIKELY(!operand)) {
return nullptr;
@@ -615,9 +615,9 @@
return nullptr;
}
- auto* vec_ptr_ty = type->As<type::Pointer>();
+ auto* vec_ptr_ty = type->As<core::type::Pointer>();
if (TINT_LIKELY(vec_ptr_ty)) {
- auto* vec_ty = vec_ptr_ty->StoreType()->As<type::Vector>();
+ auto* vec_ty = vec_ptr_ty->StoreType()->As<core::type::Vector>();
if (TINT_LIKELY(vec_ty)) {
return vec_ty->type();
}
diff --git a/src/tint/lang/core/ir/validator.h b/src/tint/lang/core/ir/validator.h
index c409985..9448c7b 100644
--- a/src/tint/lang/core/ir/validator.h
+++ b/src/tint/lang/core/ir/validator.h
@@ -228,7 +228,7 @@
/// @param inst the instruction
/// @param idx the operand index
/// @returns the vector pointer type for the given instruction operand
- const type::Type* GetVectorPtrElementType(Instruction* inst, size_t idx);
+ const core::type::Type* GetVectorPtrElementType(Instruction* inst, size_t idx);
private:
Module& mod_;
diff --git a/src/tint/lang/core/ir/value.h b/src/tint/lang/core/ir/value.h
index 5871271..556f695 100644
--- a/src/tint/lang/core/ir/value.h
+++ b/src/tint/lang/core/ir/value.h
@@ -57,7 +57,7 @@
~Value() override;
/// @returns the type of the value
- virtual const type::Type* Type() { return nullptr; }
+ virtual const core::type::Type* Type() { return nullptr; }
/// Destroys the Value. Once called, the Value must not be used again.
/// The Value must not be in use by any instruction.
diff --git a/src/tint/lang/core/ir/var.cc b/src/tint/lang/core/ir/var.cc
index 3bf295c..cacf610 100644
--- a/src/tint/lang/core/ir/var.cc
+++ b/src/tint/lang/core/ir/var.cc
@@ -23,7 +23,7 @@
Var::Var(InstructionResult* result) {
if (result && result->Type()) {
- TINT_ASSERT(result->Type()->Is<type::Pointer>());
+ TINT_ASSERT(result->Type()->Is<core::type::Pointer>());
}
// Default to no initializer.
diff --git a/src/tint/lang/core/type/abstract_float.cc b/src/tint/lang/core/type/abstract_float.cc
index 89791c4..e133e94 100644
--- a/src/tint/lang/core/type/abstract_float.cc
+++ b/src/tint/lang/core/type/abstract_float.cc
@@ -17,9 +17,9 @@
#include "src/tint/lang/core/type/manager.h"
#include "src/tint/utils/math/hash.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::AbstractFloat);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::AbstractFloat);
-namespace tint::type {
+namespace tint::core::type {
AbstractFloat::AbstractFloat() : Base(Hash(tint::TypeInfo::Of<AbstractFloat>().full_hashcode)) {}
@@ -33,4 +33,4 @@
return ctx.dst.mgr->Get<AbstractFloat>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/abstract_float.h b/src/tint/lang/core/type/abstract_float.h
index 857cf5e..59da480 100644
--- a/src/tint/lang/core/type/abstract_float.h
+++ b/src/tint/lang/core/type/abstract_float.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/abstract_numeric.h"
-namespace tint::type {
+namespace tint::core::type {
/// An abstract-float type.
/// @see https://www.w3.org/TR/WGSL/#abstractFloat
@@ -39,6 +39,6 @@
AbstractFloat* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_ABSTRACT_FLOAT_H_
diff --git a/src/tint/lang/core/type/abstract_int.cc b/src/tint/lang/core/type/abstract_int.cc
index ed2abe1..837d4cb 100644
--- a/src/tint/lang/core/type/abstract_int.cc
+++ b/src/tint/lang/core/type/abstract_int.cc
@@ -17,9 +17,9 @@
#include "src/tint/lang/core/type/manager.h"
#include "src/tint/utils/math/hash.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::AbstractInt);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::AbstractInt);
-namespace tint::type {
+namespace tint::core::type {
AbstractInt::AbstractInt() : Base(Hash(tint::TypeInfo::Of<AbstractInt>().full_hashcode)) {}
@@ -33,4 +33,4 @@
return ctx.dst.mgr->Get<AbstractInt>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/abstract_int.h b/src/tint/lang/core/type/abstract_int.h
index 71da42c..69d5aa0 100644
--- a/src/tint/lang/core/type/abstract_int.h
+++ b/src/tint/lang/core/type/abstract_int.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/abstract_numeric.h"
-namespace tint::type {
+namespace tint::core::type {
/// An abstract-int type.
/// @see https://www.w3.org/TR/WGSL/#abstractint
@@ -39,6 +39,6 @@
AbstractInt* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_ABSTRACT_INT_H_
diff --git a/src/tint/lang/core/type/abstract_numeric.cc b/src/tint/lang/core/type/abstract_numeric.cc
index 14bf9a9..e6ef24b 100644
--- a/src/tint/lang/core/type/abstract_numeric.cc
+++ b/src/tint/lang/core/type/abstract_numeric.cc
@@ -14,13 +14,13 @@
#include "src/tint/lang/core/type/abstract_numeric.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::AbstractNumeric);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::AbstractNumeric);
-namespace tint::type {
+namespace tint::core::type {
AbstractNumeric::AbstractNumeric(size_t hash)
: Base(hash,
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -35,4 +35,4 @@
return 0;
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/abstract_numeric.h b/src/tint/lang/core/type/abstract_numeric.h
index 7a7670a..b76e7a7 100644
--- a/src/tint/lang/core/type/abstract_numeric.h
+++ b/src/tint/lang/core/type/abstract_numeric.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/numeric_scalar.h"
-namespace tint::type {
+namespace tint::core::type {
/// The base class for abstract-int and abstract-float types.
/// @see https://www.w3.org/TR/WGSL/#types-for-creation-time-constants
@@ -39,6 +39,6 @@
uint32_t Align() const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_ABSTRACT_NUMERIC_H_
diff --git a/src/tint/lang/core/type/array.cc b/src/tint/lang/core/type/array.cc
index 59747ae..c76ba42 100644
--- a/src/tint/lang/core/type/array.cc
+++ b/src/tint/lang/core/type/array.cc
@@ -23,14 +23,14 @@
#include "src/tint/utils/symbol/symbol_table.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Array);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Array);
-namespace tint::type {
+namespace tint::core::type {
namespace {
-type::Flags FlagsFrom(const Type* element, const ArrayCount* count) {
- type::Flags flags;
+core::type::Flags FlagsFrom(const Type* element, const ArrayCount* count) {
+ core::type::Flags flags;
// Only constant-expression sized arrays are constructible
if (count->Is<ConstantArrayCount>()) {
if (element->IsConstructible()) {
@@ -128,4 +128,4 @@
return ctx.dst.mgr->Get<Array>(elem_ty, count, align_, size_, stride_, implicit_stride_);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/array.h b/src/tint/lang/core/type/array.h
index 1eb09c9..0f97911 100644
--- a/src/tint/lang/core/type/array.h
+++ b/src/tint/lang/core/type/array.h
@@ -25,7 +25,7 @@
#include "src/tint/utils/containers/unique_vector.h"
#include "src/tint/utils/macros/compiler.h"
-namespace tint::type {
+namespace tint::core::type {
/// Array holds the type information for Array nodes.
class Array final : public Castable<Array, Type> {
@@ -117,6 +117,6 @@
const uint32_t implicit_stride_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_ARRAY_H_
diff --git a/src/tint/lang/core/type/array_count.cc b/src/tint/lang/core/type/array_count.cc
index 3d6dc76..6b3f52f 100644
--- a/src/tint/lang/core/type/array_count.cc
+++ b/src/tint/lang/core/type/array_count.cc
@@ -16,11 +16,11 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::ArrayCount);
-TINT_INSTANTIATE_TYPEINFO(tint::type::ConstantArrayCount);
-TINT_INSTANTIATE_TYPEINFO(tint::type::RuntimeArrayCount);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::ArrayCount);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::ConstantArrayCount);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::RuntimeArrayCount);
-namespace tint::type {
+namespace tint::core::type {
ArrayCount::ArrayCount(size_t hash) : Base(hash) {}
ArrayCount::~ArrayCount() = default;
@@ -61,4 +61,4 @@
return ctx.dst.mgr->Get<RuntimeArrayCount>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/array_count.h b/src/tint/lang/core/type/array_count.h
index 7ab196f..d3869c5 100644
--- a/src/tint/lang/core/type/array_count.h
+++ b/src/tint/lang/core/type/array_count.h
@@ -22,7 +22,7 @@
#include "src/tint/lang/core/type/unique_node.h"
#include "src/tint/utils/symbol/symbol_table.h"
-namespace tint::type {
+namespace tint::core::type {
/// An array count
class ArrayCount : public Castable<ArrayCount, UniqueNode> {
@@ -93,6 +93,6 @@
RuntimeArrayCount* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_ARRAY_COUNT_H_
diff --git a/src/tint/lang/core/type/array_test.cc b/src/tint/lang/core/type/array_test.cc
index d07d719..e82bebd 100644
--- a/src/tint/lang/core/type/array_test.cc
+++ b/src/tint/lang/core/type/array_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/lang/core/type/texture.h"
#include "src/tint/lang/wgsl/sem/array_count.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using ArrayTest = TestHelper;
@@ -167,8 +167,8 @@
TEST_F(ArrayTest, CloneSizedArray) {
auto* ary = create<Array>(create<U32>(), create<ConstantArrayCount>(2u), 4u, 8u, 32u, 16u);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* val = ary->Clone(ctx);
@@ -186,8 +186,8 @@
TEST_F(ArrayTest, CloneRuntimeArray) {
auto* ary = create<Array>(create<U32>(), create<RuntimeArrayCount>(), 4u, 8u, 32u, 32u);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* val = ary->Clone(ctx);
ASSERT_NE(val, nullptr);
@@ -201,4 +201,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/atomic.cc b/src/tint/lang/core/type/atomic.cc
index 4ff5607..20809f1 100644
--- a/src/tint/lang/core/type/atomic.cc
+++ b/src/tint/lang/core/type/atomic.cc
@@ -21,13 +21,13 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Atomic);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Atomic);
-namespace tint::type {
+namespace tint::core::type {
-Atomic::Atomic(const type::Type* subtype)
+Atomic::Atomic(const core::type::Type* subtype)
: Base(Hash(tint::TypeInfo::Of<Atomic>().full_hashcode, subtype),
- type::Flags{
+ core::type::Flags{
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
}),
@@ -35,7 +35,7 @@
TINT_ASSERT(!subtype->Is<Reference>());
}
-bool Atomic::Equals(const type::UniqueNode& other) const {
+bool Atomic::Equals(const core::type::UniqueNode& other) const {
if (auto* o = other.As<Atomic>()) {
return o->subtype_ == subtype_;
}
@@ -63,4 +63,4 @@
return ctx.dst.mgr->Get<Atomic>(ty);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/atomic.h b/src/tint/lang/core/type/atomic.h
index 4680b45..6ca1938 100644
--- a/src/tint/lang/core/type/atomic.h
+++ b/src/tint/lang/core/type/atomic.h
@@ -19,24 +19,24 @@
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A atomic type.
class Atomic final : public Castable<Atomic, Type> {
public:
/// Constructor
/// @param subtype the atomic type
- explicit Atomic(const type::Type* subtype);
+ explicit Atomic(const core::type::Type* subtype);
/// Destructor
~Atomic() override;
/// @param other the other node to compare against
/// @returns true if the this type is equal to @p other
- bool Equals(const type::UniqueNode& other) const override;
+ bool Equals(const core::type::UniqueNode& other) const override;
/// @returns the atomic type
- const type::Type* Type() const { return subtype_; }
+ const core::type::Type* Type() const { return subtype_; }
/// @returns the name for this type that closely resembles how it would be
/// declared in WGSL.
@@ -53,9 +53,9 @@
Atomic* Clone(CloneContext& ctx) const override;
private:
- type::Type const* const subtype_;
+ core::type::Type const* const subtype_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_ATOMIC_H_
diff --git a/src/tint/lang/core/type/atomic_test.cc b/src/tint/lang/core/type/atomic_test.cc
index 8ff9232..e3f8b9f 100644
--- a/src/tint/lang/core/type/atomic_test.cc
+++ b/src/tint/lang/core/type/atomic_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/lang/core/type/helper_test.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using AtomicTest = TestHelper;
@@ -53,12 +53,12 @@
TEST_F(AtomicTest, Clone) {
auto* atomic = create<Atomic>(create<I32>());
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* val = atomic->Clone(ctx);
EXPECT_TRUE(val->Type()->Is<I32>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/bool.cc b/src/tint/lang/core/type/bool.cc
index 0c937a4..512aa00 100644
--- a/src/tint/lang/core/type/bool.cc
+++ b/src/tint/lang/core/type/bool.cc
@@ -16,13 +16,13 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Bool);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Bool);
-namespace tint::type {
+namespace tint::core::type {
Bool::Bool()
: Base(static_cast<size_t>(tint::TypeInfo::Of<Bool>().full_hashcode),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -46,4 +46,4 @@
return ctx.dst.mgr->Get<Bool>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/bool.h b/src/tint/lang/core/type/bool.h
index 2a96db1..a0938e6 100644
--- a/src/tint/lang/core/type/bool.h
+++ b/src/tint/lang/core/type/bool.h
@@ -25,7 +25,7 @@
#undef Bool
#endif
-namespace tint::type {
+namespace tint::core::type {
/// A boolean type
class Bool final : public Castable<Bool, Scalar> {
@@ -55,6 +55,6 @@
Bool* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_BOOL_H_
diff --git a/src/tint/lang/core/type/bool_test.cc b/src/tint/lang/core/type/bool_test.cc
index 39d08a4..e3a6347 100644
--- a/src/tint/lang/core/type/bool_test.cc
+++ b/src/tint/lang/core/type/bool_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using BoolTest = TestHelper;
@@ -46,12 +46,12 @@
TEST_F(BoolTest, Clone) {
auto* a = create<Bool>();
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* b = a->Clone(ctx);
ASSERT_TRUE(b->Is<Bool>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/builtin_structs.cc b/src/tint/lang/core/type/builtin_structs.cc
index fddf2b4..3d97986 100644
--- a/src/tint/lang/core/type/builtin_structs.cc
+++ b/src/tint/lang/core/type/builtin_structs.cc
@@ -32,7 +32,7 @@
#include "src/tint/utils/symbol/symbol_table.h"
#include "src/tint/utils/text/string.h"
-namespace tint::type {
+namespace tint::core::type {
/// An array of `modf()` return type names for an argument of `vecN<f32>`.
constexpr std::array kModfVecF32Names{
@@ -187,4 +187,4 @@
});
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/builtin_structs.h b/src/tint/lang/core/type/builtin_structs.h
index c040af4..bd7fb8a 100644
--- a/src/tint/lang/core/type/builtin_structs.h
+++ b/src/tint/lang/core/type/builtin_structs.h
@@ -19,13 +19,13 @@
namespace tint {
class SymbolTable;
} // namespace tint
-namespace tint::type {
+namespace tint::core::type {
class Manager;
class Struct;
class Type;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// @param types the type manager
/// @param symbols the symbol table
@@ -45,6 +45,6 @@
/// @returns the builtin struct type for a atomic_compare_exchange() builtin call.
Struct* CreateAtomicCompareExchangeResult(Manager& types, SymbolTable& symbols, const Type* ty);
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_BUILTIN_STRUCTS_H_
diff --git a/src/tint/lang/core/type/builtin_structs_test.cc b/src/tint/lang/core/type/builtin_structs_test.cc
index 478453b..a981b0e 100644
--- a/src/tint/lang/core/type/builtin_structs_test.cc
+++ b/src/tint/lang/core/type/builtin_structs_test.cc
@@ -29,7 +29,7 @@
using namespace tint::number_suffixes; // NOLINT
-namespace tint::type {
+namespace tint::core::type {
namespace {
enum ElementType {
@@ -161,4 +161,4 @@
testing::Values(kI32, kU32));
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/clone_context.h b/src/tint/lang/core/type/clone_context.h
index c8d0ea3..8837e63 100644
--- a/src/tint/lang/core/type/clone_context.h
+++ b/src/tint/lang/core/type/clone_context.h
@@ -19,11 +19,11 @@
namespace tint {
class SymbolTable;
} // namespace tint
-namespace tint::type {
+namespace tint::core::type {
class Manager;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// Context information for cloning of types
struct CloneContext {
@@ -42,6 +42,6 @@
} dst;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_CLONE_CONTEXT_H_
diff --git a/src/tint/lang/core/type/depth_multisampled_texture.cc b/src/tint/lang/core/type/depth_multisampled_texture.cc
index 71983b9..3d30d83 100644
--- a/src/tint/lang/core/type/depth_multisampled_texture.cc
+++ b/src/tint/lang/core/type/depth_multisampled_texture.cc
@@ -21,9 +21,9 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::DepthMultisampledTexture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::DepthMultisampledTexture);
-namespace tint::type {
+namespace tint::core::type {
namespace {
bool IsValidDepthDimension(TextureDimension dim) {
@@ -56,4 +56,4 @@
return ctx.dst.mgr->Get<DepthMultisampledTexture>(dim());
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/depth_multisampled_texture.h b/src/tint/lang/core/type/depth_multisampled_texture.h
index f5e1e35..c724775 100644
--- a/src/tint/lang/core/type/depth_multisampled_texture.h
+++ b/src/tint/lang/core/type/depth_multisampled_texture.h
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
/// A multisampled depth texture type.
class DepthMultisampledTexture final : public Castable<DepthMultisampledTexture, Texture> {
@@ -45,6 +45,6 @@
DepthMultisampledTexture* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_DEPTH_MULTISAMPLED_TEXTURE_H_
diff --git a/src/tint/lang/core/type/depth_multisampled_texture_test.cc b/src/tint/lang/core/type/depth_multisampled_texture_test.cc
index 04f6a1e..007e04d 100644
--- a/src/tint/lang/core/type/depth_multisampled_texture_test.cc
+++ b/src/tint/lang/core/type/depth_multisampled_texture_test.cc
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using DepthMultisampledTextureTest = TestHelper;
@@ -61,12 +61,12 @@
TEST_F(DepthMultisampledTextureTest, Clone) {
auto* a = create<DepthMultisampledTexture>(TextureDimension::k2d);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* dt = a->Clone(ctx);
EXPECT_EQ(dt->dim(), TextureDimension::k2d);
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/depth_texture.cc b/src/tint/lang/core/type/depth_texture.cc
index 973bb56..d1ca5f5 100644
--- a/src/tint/lang/core/type/depth_texture.cc
+++ b/src/tint/lang/core/type/depth_texture.cc
@@ -21,9 +21,9 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::DepthTexture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::DepthTexture);
-namespace tint::type {
+namespace tint::core::type {
namespace {
bool IsValidDepthDimension(TextureDimension dim) {
@@ -57,4 +57,4 @@
return ctx.dst.mgr->Get<DepthTexture>(dim());
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/depth_texture.h b/src/tint/lang/core/type/depth_texture.h
index 92692ed..4536fa6 100644
--- a/src/tint/lang/core/type/depth_texture.h
+++ b/src/tint/lang/core/type/depth_texture.h
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
/// A depth texture type.
class DepthTexture final : public Castable<DepthTexture, Texture> {
@@ -45,6 +45,6 @@
DepthTexture* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_DEPTH_TEXTURE_H_
diff --git a/src/tint/lang/core/type/depth_texture_test.cc b/src/tint/lang/core/type/depth_texture_test.cc
index b82ec7b..a0392369 100644
--- a/src/tint/lang/core/type/depth_texture_test.cc
+++ b/src/tint/lang/core/type/depth_texture_test.cc
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using DepthTextureTest = TestHelper;
@@ -73,12 +73,12 @@
TEST_F(DepthTextureTest, Clone) {
auto* a = create<DepthTexture>(TextureDimension::k2d);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* dt = a->Clone(ctx);
EXPECT_EQ(dt->dim(), TextureDimension::k2d);
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/external_texture.cc b/src/tint/lang/core/type/external_texture.cc
index 13e5d44..24962ca 100644
--- a/src/tint/lang/core/type/external_texture.cc
+++ b/src/tint/lang/core/type/external_texture.cc
@@ -17,9 +17,9 @@
#include "src/tint/lang/core/type/manager.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::ExternalTexture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::ExternalTexture);
-namespace tint::type {
+namespace tint::core::type {
ExternalTexture::ExternalTexture()
: Base(static_cast<size_t>(tint::TypeInfo::Of<ExternalTexture>().full_hashcode),
@@ -39,4 +39,4 @@
return ctx.dst.mgr->Get<ExternalTexture>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/external_texture.h b/src/tint/lang/core/type/external_texture.h
index 7f35697..d5ef929 100644
--- a/src/tint/lang/core/type/external_texture.h
+++ b/src/tint/lang/core/type/external_texture.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
/// An external texture type
class ExternalTexture final : public Castable<ExternalTexture, Texture> {
@@ -43,6 +43,6 @@
ExternalTexture* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_EXTERNAL_TEXTURE_H_
diff --git a/src/tint/lang/core/type/external_texture_test.cc b/src/tint/lang/core/type/external_texture_test.cc
index c850e9b..9ca5eb7 100644
--- a/src/tint/lang/core/type/external_texture_test.cc
+++ b/src/tint/lang/core/type/external_texture_test.cc
@@ -21,7 +21,7 @@
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using ExternalTextureTest = TestHelper;
@@ -70,12 +70,12 @@
TEST_F(ExternalTextureTest, Clone) {
auto* a = create<ExternalTexture>();
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* b = a->Clone(ctx);
ASSERT_TRUE(b->Is<ExternalTexture>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/f16.cc b/src/tint/lang/core/type/f16.cc
index f14db5a..8ff15cb 100644
--- a/src/tint/lang/core/type/f16.cc
+++ b/src/tint/lang/core/type/f16.cc
@@ -16,13 +16,13 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::F16);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::F16);
-namespace tint::type {
+namespace tint::core::type {
F16::F16()
: Base(static_cast<size_t>(tint::TypeInfo::Of<F16>().full_hashcode),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -46,4 +46,4 @@
return ctx.dst.mgr->Get<F16>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/f16.h b/src/tint/lang/core/type/f16.h
index 4d310d8..bef6ead 100644
--- a/src/tint/lang/core/type/f16.h
+++ b/src/tint/lang/core/type/f16.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/numeric_scalar.h"
-namespace tint::type {
+namespace tint::core::type {
/// A float 16 type
class F16 final : public Castable<F16, NumericScalar> {
@@ -45,6 +45,6 @@
F16* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_F16_H_
diff --git a/src/tint/lang/core/type/f16_test.cc b/src/tint/lang/core/type/f16_test.cc
index f1b083e..61fa0dc 100644
--- a/src/tint/lang/core/type/f16_test.cc
+++ b/src/tint/lang/core/type/f16_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using F16Test = TestHelper;
@@ -47,12 +47,12 @@
TEST_F(F16Test, Clone) {
auto* a = create<F16>();
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* b = a->Clone(ctx);
ASSERT_TRUE(b->Is<F16>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/f32.cc b/src/tint/lang/core/type/f32.cc
index 2fb2693..1e5a676 100644
--- a/src/tint/lang/core/type/f32.cc
+++ b/src/tint/lang/core/type/f32.cc
@@ -16,13 +16,13 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::F32);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::F32);
-namespace tint::type {
+namespace tint::core::type {
F32::F32()
: Base(static_cast<size_t>(tint::TypeInfo::Of<F32>().full_hashcode),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -46,4 +46,4 @@
return ctx.dst.mgr->Get<F32>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/f32.h b/src/tint/lang/core/type/f32.h
index 3c7f730..fe5af50 100644
--- a/src/tint/lang/core/type/f32.h
+++ b/src/tint/lang/core/type/f32.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/numeric_scalar.h"
-namespace tint::type {
+namespace tint::core::type {
/// A float 32 type
class F32 final : public Castable<F32, NumericScalar> {
@@ -45,6 +45,6 @@
F32* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_F32_H_
diff --git a/src/tint/lang/core/type/f32_test.cc b/src/tint/lang/core/type/f32_test.cc
index 5acab85..05b1546 100644
--- a/src/tint/lang/core/type/f32_test.cc
+++ b/src/tint/lang/core/type/f32_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using F32Test = TestHelper;
@@ -47,12 +47,12 @@
TEST_F(F32Test, Clone) {
auto* a = create<F32>();
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* b = a->Clone(ctx);
ASSERT_TRUE(b->Is<F32>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/helper_test.h b/src/tint/lang/core/type/helper_test.h
index 34b029d..7cb71bc 100644
--- a/src/tint/lang/core/type/helper_test.h
+++ b/src/tint/lang/core/type/helper_test.h
@@ -21,7 +21,7 @@
#include "src/tint/lang/wgsl/program/program_builder.h"
#include "src/tint/lang/wgsl/resolver/resolve.h"
-namespace tint::type {
+namespace tint::core::type {
/// Helper class for testing
template <typename BASE>
@@ -44,13 +44,13 @@
template <typename T>
using TestParamHelper = TestHelperBase<testing::TestWithParam<T>>;
-} // namespace tint::type
+} // namespace tint::core::type
/// Helper macro for testing that a type was as expected
#define EXPECT_TYPE(GOT, EXPECT) \
do { \
- const type::Type* got = GOT; \
- const type::Type* expect = EXPECT; \
+ const core::type::Type* got = GOT; \
+ const core::type::Type* expect = EXPECT; \
if (got != expect) { \
ADD_FAILURE() << #GOT " != " #EXPECT "\n" \
<< " " #GOT ": " << (got ? got->FriendlyName() : "<null>") << "\n" \
diff --git a/src/tint/lang/core/type/i32.cc b/src/tint/lang/core/type/i32.cc
index ceb53de..a2e7c9c 100644
--- a/src/tint/lang/core/type/i32.cc
+++ b/src/tint/lang/core/type/i32.cc
@@ -16,13 +16,13 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::I32);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::I32);
-namespace tint::type {
+namespace tint::core::type {
I32::I32()
: Base(static_cast<size_t>(tint::TypeInfo::Of<I32>().full_hashcode),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -46,4 +46,4 @@
return ctx.dst.mgr->Get<I32>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/i32.h b/src/tint/lang/core/type/i32.h
index fae89d5..addcafa 100644
--- a/src/tint/lang/core/type/i32.h
+++ b/src/tint/lang/core/type/i32.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/numeric_scalar.h"
-namespace tint::type {
+namespace tint::core::type {
/// A signed int 32 type.
class I32 final : public Castable<I32, NumericScalar> {
@@ -45,6 +45,6 @@
I32* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_I32_H_
diff --git a/src/tint/lang/core/type/i32_test.cc b/src/tint/lang/core/type/i32_test.cc
index 5b9786c..8119a42 100644
--- a/src/tint/lang/core/type/i32_test.cc
+++ b/src/tint/lang/core/type/i32_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using I32Test = TestHelper;
@@ -47,12 +47,12 @@
TEST_F(I32Test, Clone) {
auto* a = create<I32>();
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* b = a->Clone(ctx);
ASSERT_TRUE(b->Is<I32>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/manager.cc b/src/tint/lang/core/type/manager.cc
index a1178f2..2a3436e 100644
--- a/src/tint/lang/core/type/manager.cc
+++ b/src/tint/lang/core/type/manager.cc
@@ -30,7 +30,7 @@
#include "src/tint/lang/core/type/vector.h"
#include "src/tint/lang/core/type/void.h"
-namespace tint::type {
+namespace tint::core::type {
Manager::Manager() = default;
@@ -40,128 +40,131 @@
Manager::~Manager() = default;
-const type::Void* Manager::void_() {
- return Get<type::Void>();
+const core::type::Void* Manager::void_() {
+ return Get<core::type::Void>();
}
-const type::Bool* Manager::bool_() {
- return Get<type::Bool>();
+const core::type::Bool* Manager::bool_() {
+ return Get<core::type::Bool>();
}
-const type::I32* Manager::i32() {
- return Get<type::I32>();
+const core::type::I32* Manager::i32() {
+ return Get<core::type::I32>();
}
-const type::U32* Manager::u32() {
- return Get<type::U32>();
+const core::type::U32* Manager::u32() {
+ return Get<core::type::U32>();
}
-const type::F32* Manager::f32() {
- return Get<type::F32>();
+const core::type::F32* Manager::f32() {
+ return Get<core::type::F32>();
}
-const type::F16* Manager::f16() {
- return Get<type::F16>();
+const core::type::F16* Manager::f16() {
+ return Get<core::type::F16>();
}
-const type::AbstractFloat* Manager::AFloat() {
- return Get<type::AbstractFloat>();
+const core::type::AbstractFloat* Manager::AFloat() {
+ return Get<core::type::AbstractFloat>();
}
-const type::AbstractInt* Manager::AInt() {
- return Get<type::AbstractInt>();
+const core::type::AbstractInt* Manager::AInt() {
+ return Get<core::type::AbstractInt>();
}
-const type::Atomic* Manager::atomic(const type::Type* inner) {
- return Get<type::Atomic>(inner);
+const core::type::Atomic* Manager::atomic(const core::type::Type* inner) {
+ return Get<core::type::Atomic>(inner);
}
-const type::Vector* Manager::packed_vec(const type::Type* inner, uint32_t size) {
- return Get<type::Vector>(inner, size, true);
+const core::type::Vector* Manager::packed_vec(const core::type::Type* inner, uint32_t size) {
+ return Get<core::type::Vector>(inner, size, true);
}
-const type::Vector* Manager::vec(const type::Type* inner, uint32_t size) {
- return Get<type::Vector>(inner, size);
+const core::type::Vector* Manager::vec(const core::type::Type* inner, uint32_t size) {
+ return Get<core::type::Vector>(inner, size);
}
-const type::Vector* Manager::vec2(const type::Type* inner) {
+const core::type::Vector* Manager::vec2(const core::type::Type* inner) {
return vec(inner, 2);
}
-const type::Vector* Manager::vec3(const type::Type* inner) {
+const core::type::Vector* Manager::vec3(const core::type::Type* inner) {
return vec(inner, 3);
}
-const type::Vector* Manager::vec4(const type::Type* inner) {
+const core::type::Vector* Manager::vec4(const core::type::Type* inner) {
return vec(inner, 4);
}
-const type::Matrix* Manager::mat(const type::Type* inner, uint32_t cols, uint32_t rows) {
- return Get<type::Matrix>(vec(inner, rows), cols);
+const core::type::Matrix* Manager::mat(const core::type::Type* inner,
+ uint32_t cols,
+ uint32_t rows) {
+ return Get<core::type::Matrix>(vec(inner, rows), cols);
}
-const type::Matrix* Manager::mat(const type::Vector* column_type, uint32_t cols) {
- return Get<type::Matrix>(column_type, cols);
+const core::type::Matrix* Manager::mat(const core::type::Vector* column_type, uint32_t cols) {
+ return Get<core::type::Matrix>(column_type, cols);
}
-const type::Matrix* Manager::mat2x2(const type::Type* inner) {
+const core::type::Matrix* Manager::mat2x2(const core::type::Type* inner) {
return mat(inner, 2, 2);
}
-const type::Matrix* Manager::mat2x3(const type::Type* inner) {
+const core::type::Matrix* Manager::mat2x3(const core::type::Type* inner) {
return mat(inner, 2, 3);
}
-const type::Matrix* Manager::mat2x4(const type::Type* inner) {
+const core::type::Matrix* Manager::mat2x4(const core::type::Type* inner) {
return mat(inner, 2, 4);
}
-const type::Matrix* Manager::mat3x2(const type::Type* inner) {
+const core::type::Matrix* Manager::mat3x2(const core::type::Type* inner) {
return mat(inner, 3, 2);
}
-const type::Matrix* Manager::mat3x3(const type::Type* inner) {
+const core::type::Matrix* Manager::mat3x3(const core::type::Type* inner) {
return mat(inner, 3, 3);
}
-const type::Matrix* Manager::mat3x4(const type::Type* inner) {
+const core::type::Matrix* Manager::mat3x4(const core::type::Type* inner) {
return mat(inner, 3, 4);
}
-const type::Matrix* Manager::mat4x2(const type::Type* inner) {
+const core::type::Matrix* Manager::mat4x2(const core::type::Type* inner) {
return mat(inner, 4, 2);
}
-const type::Matrix* Manager::mat4x3(const type::Type* inner) {
+const core::type::Matrix* Manager::mat4x3(const core::type::Type* inner) {
return mat(inner, 4, 3);
}
-const type::Matrix* Manager::mat4x4(const type::Type* inner) {
+const core::type::Matrix* Manager::mat4x4(const core::type::Type* inner) {
return mat(inner, 4, 4);
}
-const type::Array* Manager::array(const type::Type* elem_ty,
- uint32_t count,
- uint32_t stride /* = 0*/) {
+const core::type::Array* Manager::array(const core::type::Type* elem_ty,
+ uint32_t count,
+ uint32_t stride /* = 0*/) {
uint32_t implicit_stride = tint::RoundUp(elem_ty->Align(), elem_ty->Size());
if (stride == 0) {
stride = implicit_stride;
}
TINT_ASSERT(stride >= implicit_stride);
- return Get<type::Array>(/* element type */ elem_ty,
- /* element count */ Get<ConstantArrayCount>(count),
- /* array alignment */ elem_ty->Align(),
- /* array size */ count * stride,
- /* element stride */ stride,
- /* implicit stride */ implicit_stride);
+ return Get<core::type::Array>(/* element type */ elem_ty,
+ /* element count */ Get<ConstantArrayCount>(count),
+ /* array alignment */ elem_ty->Align(),
+ /* array size */ count * stride,
+ /* element stride */ stride,
+ /* implicit stride */ implicit_stride);
}
-const type::Array* Manager::runtime_array(const type::Type* elem_ty, uint32_t stride /* = 0 */) {
+const core::type::Array* Manager::runtime_array(const core::type::Type* elem_ty,
+ uint32_t stride /* = 0 */) {
if (stride == 0) {
stride = elem_ty->Align();
}
- return Get<type::Array>(
+ return Get<core::type::Array>(
/* element type */ elem_ty,
/* element count */ Get<RuntimeArrayCount>(),
/* array alignment */ elem_ty->Align(),
@@ -170,27 +173,27 @@
/* implicit stride */ elem_ty->Align());
}
-const type::Pointer* Manager::ptr(core::AddressSpace address_space,
- const type::Type* subtype,
- core::Access access /* = core::Access::kReadWrite */) {
- return Get<type::Pointer>(address_space, subtype, access);
+const core::type::Pointer* Manager::ptr(core::AddressSpace address_space,
+ const core::type::Type* subtype,
+ core::Access access /* = core::Access::kReadWrite */) {
+ return Get<core::type::Pointer>(address_space, subtype, access);
}
-type::Struct* Manager::Struct(Symbol name, VectorRef<StructMemberDesc> md) {
- tint::Vector<const type::StructMember*, 4> members;
+core::type::Struct* Manager::Struct(Symbol name, VectorRef<StructMemberDesc> md) {
+ tint::Vector<const core::type::StructMember*, 4> members;
uint32_t current_size = 0u;
uint32_t max_align = 0u;
for (const auto& m : md) {
uint32_t index = static_cast<uint32_t>(members.Length());
uint32_t align = std::max<uint32_t>(m.type->Align(), 1u);
uint32_t offset = tint::RoundUp(align, current_size);
- members.Push(Get<type::StructMember>(m.name, m.type, index, offset, align, m.type->Size(),
- std::move(m.attributes)));
+ members.Push(Get<core::type::StructMember>(m.name, m.type, index, offset, align,
+ m.type->Size(), std::move(m.attributes)));
current_size = offset + m.type->Size();
max_align = std::max(max_align, align);
}
- return Get<type::Struct>(name, members, max_align, tint::RoundUp(max_align, current_size),
- current_size);
+ return Get<core::type::Struct>(name, members, max_align, tint::RoundUp(max_align, current_size),
+ current_size);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/manager.h b/src/tint/lang/core/type/manager.h
index 55def97..b3597d0 100644
--- a/src/tint/lang/core/type/manager.h
+++ b/src/tint/lang/core/type/manager.h
@@ -31,7 +31,7 @@
#include "src/tint/utils/symbol/symbol.h"
// Forward declarations
-namespace tint::type {
+namespace tint::core::type {
class AbstractFloat;
class AbstractInt;
class Array;
@@ -44,9 +44,9 @@
class U32;
class Vector;
class Void;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// The type manager holds all the pointers to the known types.
class Manager final {
@@ -86,28 +86,28 @@
/// Constructs or returns an existing type, unique node or node
/// @param args the arguments used to construct the type, unique node or node.
- /// @tparam T a class deriving from type::Node, or a C-like type that's automatically translated
- /// to the equivalent type node type. For example `Get<i32>()` is equivalent to
- /// `Get<type::I32>()`
+ /// @tparam T a class deriving from core::type::Node, or a C-like type that's automatically
+ /// translated to the equivalent type node type. For example `Get<i32>()` is equivalent to
+ /// `Get<core::type::I32>()`
/// @return a pointer to an instance of `T` with the provided arguments.
/// If `T` derives from UniqueNode and an existing instance of `T` has been constructed, then
/// the same pointer is returned.
template <typename T, typename... ARGS>
auto* Get(ARGS&&... args) {
if constexpr (std::is_same_v<T, tint::AInt>) {
- return Get<type::AbstractInt>(std::forward<ARGS>(args)...);
+ return Get<core::type::AbstractInt>(std::forward<ARGS>(args)...);
} else if constexpr (std::is_same_v<T, tint::AFloat>) {
- return Get<type::AbstractFloat>(std::forward<ARGS>(args)...);
+ return Get<core::type::AbstractFloat>(std::forward<ARGS>(args)...);
} else if constexpr (std::is_same_v<T, tint::i32>) {
- return Get<type::I32>(std::forward<ARGS>(args)...);
+ return Get<core::type::I32>(std::forward<ARGS>(args)...);
} else if constexpr (std::is_same_v<T, tint::u32>) {
- return Get<type::U32>(std::forward<ARGS>(args)...);
+ return Get<core::type::U32>(std::forward<ARGS>(args)...);
} else if constexpr (std::is_same_v<T, tint::f32>) {
- return Get<type::F32>(std::forward<ARGS>(args)...);
+ return Get<core::type::F32>(std::forward<ARGS>(args)...);
} else if constexpr (std::is_same_v<T, tint::f16>) {
- return Get<type::F16>(std::forward<ARGS>(args)...);
+ return Get<core::type::F16>(std::forward<ARGS>(args)...);
} else if constexpr (std::is_same_v<T, bool>) {
- return Get<type::Bool>(std::forward<ARGS>(args)...);
+ return Get<core::type::Bool>(std::forward<ARGS>(args)...);
} else if constexpr (core::fluent_types::IsVector<T>) {
return vec<typename T::type, T::width>(std::forward<ARGS>(args)...);
} else if constexpr (core::fluent_types::IsMatrix<T>) {
@@ -136,67 +136,67 @@
}
/// @returns a void type
- const type::Void* void_();
+ const core::type::Void* void_();
/// @returns a bool type
- const type::Bool* bool_();
+ const core::type::Bool* bool_();
/// @returns an i32 type
- const type::I32* i32();
+ const core::type::I32* i32();
/// @returns a u32 type
- const type::U32* u32();
+ const core::type::U32* u32();
/// @returns an f32 type
- const type::F32* f32();
+ const core::type::F32* f32();
/// @returns an f16 type
- const type::F16* f16();
+ const core::type::F16* f16();
/// @returns a abstract-float type
- const type::AbstractFloat* AFloat();
+ const core::type::AbstractFloat* AFloat();
/// @returns a abstract-int type
- const type::AbstractInt* AInt();
+ const core::type::AbstractInt* AInt();
/// @param inner the inner type
/// @returns an atomic type with the element type @p inner
- const type::Atomic* atomic(const type::Type* inner);
+ const core::type::Atomic* atomic(const core::type::Type* inner);
/// @tparam T the element type
/// @returns the atomic type
template <typename T>
- const type::Atomic* atomic() {
+ const core::type::Atomic* atomic() {
return atomic(Get<T>());
}
/// @param inner the inner type
/// @param size the vector size
/// @returns the vector type
- const type::Vector* packed_vec(const type::Type* inner, uint32_t size);
+ const core::type::Vector* packed_vec(const core::type::Type* inner, uint32_t size);
/// @param inner the inner type
/// @param size the vector size
/// @returns the vector type
- const type::Vector* vec(const type::Type* inner, uint32_t size);
+ const core::type::Vector* vec(const core::type::Type* inner, uint32_t size);
/// @param inner the inner type
/// @returns a vec2 type with the element type @p inner
- const type::Vector* vec2(const type::Type* inner);
+ const core::type::Vector* vec2(const core::type::Type* inner);
/// @param inner the inner type
/// @returns a vec3 type with the element type @p inner
- const type::Vector* vec3(const type::Type* inner);
+ const core::type::Vector* vec3(const core::type::Type* inner);
/// @param inner the inner type
/// @returns a vec4 type with the element type @p inner
- const type::Vector* vec4(const type::Type* inner);
+ const core::type::Vector* vec4(const core::type::Type* inner);
/// @tparam T the element type
/// @tparam N the vector width
/// @returns the vector type
template <typename T, size_t N>
- const type::Vector* vec() {
+ const core::type::Vector* vec() {
TINT_BEGIN_DISABLE_WARNING(UNREACHABLE_CODE);
static_assert(N >= 2 && N <= 4);
switch (N) {
@@ -214,21 +214,21 @@
/// @tparam T the element type
/// @returns a vec2 with the element type `T`
template <typename T>
- const type::Vector* vec2() {
+ const core::type::Vector* vec2() {
return vec2(Get<T>());
}
/// @tparam T the element type
/// @returns a vec2 with the element type `T`
template <typename T>
- const type::Vector* vec3() {
+ const core::type::Vector* vec3() {
return vec3(Get<T>());
}
/// @tparam T the element type
/// @returns a vec2 with the element type `T`
template <typename T>
- const type::Vector* vec4() {
+ const core::type::Vector* vec4() {
return vec4(Get<T>());
}
@@ -236,109 +236,109 @@
/// @param cols the number of columns
/// @param rows the number of rows
/// @returns the matrix type
- const type::Matrix* mat(const type::Type* inner, uint32_t cols, uint32_t rows);
+ const core::type::Matrix* mat(const core::type::Type* inner, uint32_t cols, uint32_t rows);
/// @param column_type the column vector type
/// @param cols the number of columns
/// @returns the matrix type
- const type::Matrix* mat(const type::Vector* column_type, uint32_t cols);
+ const core::type::Matrix* mat(const core::type::Vector* column_type, uint32_t cols);
/// @param inner the inner type
/// @returns a mat2x2 with the element @p inner
- const type::Matrix* mat2x2(const type::Type* inner);
+ const core::type::Matrix* mat2x2(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat2x2 with the element type `T`
template <typename T>
- const type::Matrix* mat2x2() {
+ const core::type::Matrix* mat2x2() {
return mat2x2(Get<T>());
}
/// @param inner the inner type
/// @returns a mat2x3 with the element @p inner
- const type::Matrix* mat2x3(const type::Type* inner);
+ const core::type::Matrix* mat2x3(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat2x3 with the element type `T`
template <typename T>
- const type::Matrix* mat2x3() {
+ const core::type::Matrix* mat2x3() {
return mat2x3(Get<T>());
}
/// @param inner the inner type
/// @returns a mat2x4 with the element @p inner
- const type::Matrix* mat2x4(const type::Type* inner);
+ const core::type::Matrix* mat2x4(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat2x4 with the element type `T`
template <typename T>
- const type::Matrix* mat2x4() {
+ const core::type::Matrix* mat2x4() {
return mat2x4(Get<T>());
}
/// @param inner the inner type
/// @returns a mat3x2 with the element @p inner
- const type::Matrix* mat3x2(const type::Type* inner);
+ const core::type::Matrix* mat3x2(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat3x2 with the element type `T`
template <typename T>
- const type::Matrix* mat3x2() {
+ const core::type::Matrix* mat3x2() {
return mat3x2(Get<T>());
}
/// @param inner the inner type
/// @returns a mat3x3 with the element @p inner
- const type::Matrix* mat3x3(const type::Type* inner);
+ const core::type::Matrix* mat3x3(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat3x3 with the element type `T`
template <typename T>
- const type::Matrix* mat3x3() {
+ const core::type::Matrix* mat3x3() {
return mat3x3(Get<T>());
}
/// @param inner the inner type
/// @returns a mat3x4 with the element @p inner
- const type::Matrix* mat3x4(const type::Type* inner);
+ const core::type::Matrix* mat3x4(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat3x4 with the element type `T`
template <typename T>
- const type::Matrix* mat3x4() {
+ const core::type::Matrix* mat3x4() {
return mat3x4(Get<T>());
}
/// @param inner the inner type
/// @returns a mat4x2 with the element @p inner
- const type::Matrix* mat4x2(const type::Type* inner);
+ const core::type::Matrix* mat4x2(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat4x2 with the element type `T`
template <typename T>
- const type::Matrix* mat4x2() {
+ const core::type::Matrix* mat4x2() {
return mat4x2(Get<T>());
}
/// @param inner the inner type
/// @returns a mat4x3 with the element @p inner
- const type::Matrix* mat4x3(const type::Type* inner);
+ const core::type::Matrix* mat4x3(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat4x3 with the element type `T`
template <typename T>
- const type::Matrix* mat4x3() {
+ const core::type::Matrix* mat4x3() {
return mat4x3(Get<T>());
}
/// @param inner the inner type
/// @returns a mat4x4 with the element @p inner
- const type::Matrix* mat4x4(const type::Type* inner);
+ const core::type::Matrix* mat4x4(const core::type::Type* inner);
/// @tparam T the element type
/// @returns a mat4x4 with the element type `T`
template <typename T>
- const type::Matrix* mat4x4() {
+ const core::type::Matrix* mat4x4() {
return mat4x4(Get<T>());
}
@@ -347,7 +347,7 @@
/// @tparam T the element type
/// @returns a matrix with the given number of columns and rows
template <typename T>
- const type::Matrix* mat(uint32_t columns, uint32_t rows) {
+ const core::type::Matrix* mat(uint32_t columns, uint32_t rows) {
return mat(Get<T>(), columns, rows);
}
@@ -356,7 +356,7 @@
/// @tparam T the element type
/// @returns a matrix with the given number of columns and rows
template <uint32_t C, uint32_t R, typename T>
- const type::Matrix* mat() {
+ const core::type::Matrix* mat() {
return mat(Get<T>(), C, R);
}
@@ -364,19 +364,21 @@
/// @param count the array element count
/// @param stride the optional array element stride
/// @returns the array type
- const type::Array* array(const type::Type* elem_ty, uint32_t count, uint32_t stride = 0);
+ const core::type::Array* array(const core::type::Type* elem_ty,
+ uint32_t count,
+ uint32_t stride = 0);
/// @param elem_ty the array element type
/// @param stride the optional array element stride
/// @returns the runtime array type
- const type::Array* runtime_array(const type::Type* elem_ty, uint32_t stride = 0);
+ const core::type::Array* runtime_array(const core::type::Type* elem_ty, uint32_t stride = 0);
/// @returns an array type with the element type `T` and size `N`.
/// @tparam T the element type
/// @tparam N the array length. If zero, then constructs a runtime-sized array.
/// @param stride the optional array element stride
template <typename T, size_t N = 0>
- const type::Array* array(uint32_t stride = 0) {
+ const core::type::Array* array(uint32_t stride = 0) {
if constexpr (N == 0) {
return runtime_array(Get<T>(), stride);
} else {
@@ -388,16 +390,16 @@
/// @param subtype the pointer subtype
/// @param access the access settings
/// @returns the pointer type
- const type::Pointer* ptr(core::AddressSpace address_space,
- const type::Type* subtype,
- core::Access access = core::Access::kReadWrite);
+ const core::type::Pointer* ptr(core::AddressSpace address_space,
+ const core::type::Type* subtype,
+ core::Access access = core::Access::kReadWrite);
/// @tparam SPACE the address space
/// @tparam T the storage type
/// @tparam ACCESS the access mode
/// @returns the pointer type with the templated address space, storage type and access.
template <core::AddressSpace SPACE, typename T, core::Access ACCESS = core::Access::kReadWrite>
- const type::Pointer* ptr() {
+ const core::type::Pointer* ptr() {
return ptr(SPACE, Get<T>(), ACCESS);
}
@@ -406,16 +408,18 @@
/// @tparam ACCESS the access mode
/// @returns the pointer type with the templated address space, storage type and access.
template <core::AddressSpace SPACE, core::Access ACCESS = core::Access::kReadWrite>
- const type::Pointer* ptr(const type::Type* subtype) {
+ const core::type::Pointer* ptr(const core::type::Type* subtype) {
return ptr(SPACE, subtype, ACCESS);
}
/// @returns the sampler type
- const type::Sampler* sampler() { return Get<type::Sampler>(type::SamplerKind::kSampler); }
+ const core::type::Sampler* sampler() {
+ return Get<core::type::Sampler>(core::type::SamplerKind::kSampler);
+ }
/// @returns the comparison sampler type
- const type::Sampler* comparison_sampler() {
- return Get<type::Sampler>(type::SamplerKind::kComparisonSampler);
+ const core::type::Sampler* comparison_sampler() {
+ return Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler);
}
/// A structure member descriptor.
@@ -423,22 +427,22 @@
/// The name of the struct member.
Symbol name;
/// The type of the struct member.
- const type::Type* type = nullptr;
+ const core::type::Type* type = nullptr;
/// The optional struct member attributes.
- type::StructMemberAttributes attributes = {};
+ core::type::StructMemberAttributes attributes = {};
};
/// Create a new structure declaration.
/// @param name the name of the structure
/// @param members the list of structure member descriptors
/// @returns the structure type
- type::Struct* Struct(Symbol name, VectorRef<StructMemberDesc> members);
+ core::type::Struct* Struct(Symbol name, VectorRef<StructMemberDesc> members);
/// Create a new structure declaration.
/// @param name the name of the structure
/// @param members the list of structure member descriptors
/// @returns the structure type
- type::Struct* Struct(Symbol name, std::initializer_list<StructMemberDesc> members) {
+ core::type::Struct* Struct(Symbol name, std::initializer_list<StructMemberDesc> members) {
return Struct(name, tint::Vector<StructMemberDesc, 4>(members));
}
@@ -449,7 +453,7 @@
private:
/// ToType<T> is specialized for various `T` types and each specialization contains a single
- /// `type` alias to the corresponding type deriving from `type::Type`.
+ /// `type` alias to the corresponding type deriving from `core::type::Type`.
template <typename T>
struct ToTypeImpl {
using type = T;
@@ -466,6 +470,6 @@
BlockAllocator<Node> nodes_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_MANAGER_H_
diff --git a/src/tint/lang/core/type/manager_test.cc b/src/tint/lang/core/type/manager_test.cc
index 23f58f5..d22b6bc 100644
--- a/src/tint/lang/core/type/manager_test.cc
+++ b/src/tint/lang/core/type/manager_test.cc
@@ -21,7 +21,7 @@
#include "src/tint/lang/core/type/i32.h"
#include "src/tint/lang/core/type/u32.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
template <typename T>
@@ -112,4 +112,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/matrix.cc b/src/tint/lang/core/type/matrix.cc
index 59e006a..6137170 100644
--- a/src/tint/lang/core/type/matrix.cc
+++ b/src/tint/lang/core/type/matrix.cc
@@ -21,13 +21,13 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Matrix);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Matrix);
-namespace tint::type {
+namespace tint::core::type {
Matrix::Matrix(const Vector* column_type, uint32_t columns)
: Base(Hash(tint::TypeInfo::Of<Vector>().full_hashcode, columns, column_type),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -83,4 +83,4 @@
return ctx.dst.mgr->Get<Matrix>(col_ty, columns_);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/matrix.h b/src/tint/lang/core/type/matrix.h
index 2a9cda5..080a2f3 100644
--- a/src/tint/lang/core/type/matrix.h
+++ b/src/tint/lang/core/type/matrix.h
@@ -20,11 +20,11 @@
#include "src/tint/lang/core/type/vector.h"
// Forward declarations
-namespace tint::type {
+namespace tint::core::type {
class Vector;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// A matrix type
class Matrix final : public Castable<Matrix, Type> {
@@ -83,6 +83,6 @@
const uint32_t columns_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_MATRIX_H_
diff --git a/src/tint/lang/core/type/matrix_test.cc b/src/tint/lang/core/type/matrix_test.cc
index 914ade6..079b0e3 100644
--- a/src/tint/lang/core/type/matrix_test.cc
+++ b/src/tint/lang/core/type/matrix_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using MatrixTest = TestHelper;
@@ -68,8 +68,8 @@
TEST_F(MatrixTest, Clone) {
auto* a = create<Matrix>(create<Vector>(create<I32>(), 3u), 4u);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* mat = a->Clone(ctx);
EXPECT_TRUE(mat->type()->Is<I32>());
@@ -78,4 +78,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/multisampled_texture.cc b/src/tint/lang/core/type/multisampled_texture.cc
index 20b9da3..8a93f86 100644
--- a/src/tint/lang/core/type/multisampled_texture.cc
+++ b/src/tint/lang/core/type/multisampled_texture.cc
@@ -21,9 +21,9 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::MultisampledTexture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::MultisampledTexture);
-namespace tint::type {
+namespace tint::core::type {
MultisampledTexture::MultisampledTexture(TextureDimension dim, const Type* type)
: Base(Hash(tint::TypeInfo::Of<MultisampledTexture>().full_hashcode, dim, type), dim),
@@ -51,4 +51,4 @@
return ctx.dst.mgr->Get<MultisampledTexture>(dim(), ty);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/multisampled_texture.h b/src/tint/lang/core/type/multisampled_texture.h
index 0a37556..017ad69 100644
--- a/src/tint/lang/core/type/multisampled_texture.h
+++ b/src/tint/lang/core/type/multisampled_texture.h
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
/// A multisampled texture type.
class MultisampledTexture final : public Castable<MultisampledTexture, Texture> {
@@ -52,6 +52,6 @@
const Type* const type_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_MULTISAMPLED_TEXTURE_H_
diff --git a/src/tint/lang/core/type/multisampled_texture_test.cc b/src/tint/lang/core/type/multisampled_texture_test.cc
index fcbd1d3..4a893b3 100644
--- a/src/tint/lang/core/type/multisampled_texture_test.cc
+++ b/src/tint/lang/core/type/multisampled_texture_test.cc
@@ -21,7 +21,7 @@
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using MultisampledTextureTest = TestHelper;
@@ -85,8 +85,8 @@
TEST_F(MultisampledTextureTest, Clone) {
auto* a = create<MultisampledTexture>(TextureDimension::k2d, create<F32>());
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* mt = a->Clone(ctx);
EXPECT_EQ(mt->dim(), TextureDimension::k2d);
@@ -94,4 +94,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/node.cc b/src/tint/lang/core/type/node.cc
index 7b04892..5735efd 100644
--- a/src/tint/lang/core/type/node.cc
+++ b/src/tint/lang/core/type/node.cc
@@ -14,9 +14,9 @@
#include "src/tint/lang/core/type/node.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Node);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Node);
-namespace tint::type {
+namespace tint::core::type {
Node::Node() = default;
@@ -24,4 +24,4 @@
Node::~Node() = default;
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/node.h b/src/tint/lang/core/type/node.h
index d4addf4..2cb4bdc 100644
--- a/src/tint/lang/core/type/node.h
+++ b/src/tint/lang/core/type/node.h
@@ -17,7 +17,7 @@
#include "src/tint/utils/rtti/castable.h"
-namespace tint::type {
+namespace tint::core::type {
/// Node is the base class for all type nodes
class Node : public Castable<Node> {
@@ -32,6 +32,6 @@
~Node() override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_NODE_H_
diff --git a/src/tint/lang/core/type/numeric_scalar.cc b/src/tint/lang/core/type/numeric_scalar.cc
index bce6b92..9813f4c 100644
--- a/src/tint/lang/core/type/numeric_scalar.cc
+++ b/src/tint/lang/core/type/numeric_scalar.cc
@@ -14,12 +14,12 @@
#include "src/tint/lang/core/type/numeric_scalar.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::NumericScalar);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::NumericScalar);
-namespace tint::type {
+namespace tint::core::type {
-NumericScalar::NumericScalar(size_t hash, type::Flags flags) : Base(hash, flags) {}
+NumericScalar::NumericScalar(size_t hash, core::type::Flags flags) : Base(hash, flags) {}
NumericScalar::~NumericScalar() = default;
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/numeric_scalar.h b/src/tint/lang/core/type/numeric_scalar.h
index 987921a..cdcd3fc 100644
--- a/src/tint/lang/core/type/numeric_scalar.h
+++ b/src/tint/lang/core/type/numeric_scalar.h
@@ -17,7 +17,7 @@
#include "src/tint/lang/core/type/scalar.h"
-namespace tint::type {
+namespace tint::core::type {
/// Base class for all numeric-scalar types
/// @see https://www.w3.org/TR/WGSL/#scalar-types
@@ -30,9 +30,9 @@
/// Constructor
/// @param hash the immutable hash for the node
/// @param flags the flags of this type
- NumericScalar(size_t hash, type::Flags flags);
+ NumericScalar(size_t hash, core::type::Flags flags);
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_NUMERIC_SCALAR_H_
diff --git a/src/tint/lang/core/type/pointer.cc b/src/tint/lang/core/type/pointer.cc
index c89f25c..c73c0fa 100644
--- a/src/tint/lang/core/type/pointer.cc
+++ b/src/tint/lang/core/type/pointer.cc
@@ -21,13 +21,13 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Pointer);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Pointer);
-namespace tint::type {
+namespace tint::core::type {
Pointer::Pointer(core::AddressSpace address_space, const Type* subtype, core::Access access)
: Base(Hash(tint::TypeInfo::Of<Pointer>().full_hashcode, address_space, subtype, access),
- type::Flags{}),
+ core::type::Flags{}),
subtype_(subtype),
address_space_(address_space),
access_(access) {
@@ -61,4 +61,4 @@
return ctx.dst.mgr->Get<Pointer>(address_space_, ty, access_);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/pointer.h b/src/tint/lang/core/type/pointer.h
index ec3b673..69e5b80 100644
--- a/src/tint/lang/core/type/pointer.h
+++ b/src/tint/lang/core/type/pointer.h
@@ -21,7 +21,7 @@
#include "src/tint/lang/core/address_space.h"
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A pointer type.
class Pointer final : public Castable<Pointer, Type> {
@@ -62,6 +62,6 @@
core::Access const access_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_POINTER_H_
diff --git a/src/tint/lang/core/type/pointer_test.cc b/src/tint/lang/core/type/pointer_test.cc
index 1649f5c..b937f77 100644
--- a/src/tint/lang/core/type/pointer_test.cc
+++ b/src/tint/lang/core/type/pointer_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using PointerTest = TestHelper;
@@ -83,8 +83,8 @@
auto* a =
create<Pointer>(core::AddressSpace::kStorage, create<I32>(), core::Access::kReadWrite);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* ptr = a->Clone(ctx);
EXPECT_TRUE(ptr->StoreType()->Is<I32>());
@@ -93,4 +93,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/reference.cc b/src/tint/lang/core/type/reference.cc
index 69e0a26..572a53a 100644
--- a/src/tint/lang/core/type/reference.cc
+++ b/src/tint/lang/core/type/reference.cc
@@ -20,13 +20,13 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Reference);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Reference);
-namespace tint::type {
+namespace tint::core::type {
Reference::Reference(core::AddressSpace address_space, const Type* subtype, core::Access access)
: Base(Hash(tint::TypeInfo::Of<Reference>().full_hashcode, address_space, subtype, access),
- type::Flags{}),
+ core::type::Flags{}),
subtype_(subtype),
address_space_(address_space),
access_(access) {
@@ -60,4 +60,4 @@
return ctx.dst.mgr->Get<Reference>(address_space_, ty, access_);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/reference.h b/src/tint/lang/core/type/reference.h
index 237db67..f1f2420 100644
--- a/src/tint/lang/core/type/reference.h
+++ b/src/tint/lang/core/type/reference.h
@@ -21,7 +21,7 @@
#include "src/tint/lang/core/address_space.h"
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A reference type.
class Reference final : public Castable<Reference, Type> {
@@ -62,6 +62,6 @@
core::Access const access_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_REFERENCE_H_
diff --git a/src/tint/lang/core/type/reference_test.cc b/src/tint/lang/core/type/reference_test.cc
index a5427fe..7aa1aab 100644
--- a/src/tint/lang/core/type/reference_test.cc
+++ b/src/tint/lang/core/type/reference_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/lang/core/address_space.h"
#include "src/tint/lang/core/type/helper_test.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using ReferenceTest = TestHelper;
@@ -83,8 +83,8 @@
auto* a =
create<Reference>(core::AddressSpace::kStorage, create<I32>(), core::Access::kReadWrite);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* ref = a->Clone(ctx);
EXPECT_TRUE(ref->StoreType()->Is<I32>());
@@ -93,4 +93,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/sampled_texture.cc b/src/tint/lang/core/type/sampled_texture.cc
index 297287b..8865ec8 100644
--- a/src/tint/lang/core/type/sampled_texture.cc
+++ b/src/tint/lang/core/type/sampled_texture.cc
@@ -21,9 +21,9 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::SampledTexture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::SampledTexture);
-namespace tint::type {
+namespace tint::core::type {
SampledTexture::SampledTexture(TextureDimension dim, const Type* type)
: Base(Hash(TypeInfo::Of<SampledTexture>().full_hashcode, dim, type), dim), type_(type) {
@@ -50,4 +50,4 @@
return ctx.dst.mgr->Get<SampledTexture>(dim(), ty);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/sampled_texture.h b/src/tint/lang/core/type/sampled_texture.h
index d22c81f..42191b5 100644
--- a/src/tint/lang/core/type/sampled_texture.h
+++ b/src/tint/lang/core/type/sampled_texture.h
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
/// A sampled texture type.
class SampledTexture final : public Castable<SampledTexture, Texture> {
@@ -52,6 +52,6 @@
const Type* const type_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_SAMPLED_TEXTURE_H_
diff --git a/src/tint/lang/core/type/sampled_texture_test.cc b/src/tint/lang/core/type/sampled_texture_test.cc
index 375e423..0a65228 100644
--- a/src/tint/lang/core/type/sampled_texture_test.cc
+++ b/src/tint/lang/core/type/sampled_texture_test.cc
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/storage_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using SampledTextureTest = TestHelper;
@@ -89,8 +89,8 @@
TEST_F(SampledTextureTest, Clone) {
auto* a = create<SampledTexture>(TextureDimension::kCube, create<F32>());
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* mt = a->Clone(ctx);
EXPECT_EQ(mt->dim(), TextureDimension::kCube);
@@ -98,4 +98,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/sampler.cc b/src/tint/lang/core/type/sampler.cc
index ffdaaa2..0ceaeed 100644
--- a/src/tint/lang/core/type/sampler.cc
+++ b/src/tint/lang/core/type/sampler.cc
@@ -17,12 +17,13 @@
#include "src/tint/lang/core/type/manager.h"
#include "src/tint/utils/math/hash.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Sampler);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Sampler);
-namespace tint::type {
+namespace tint::core::type {
Sampler::Sampler(SamplerKind kind)
- : Base(Hash(tint::TypeInfo::Of<Sampler>().full_hashcode, kind), type::Flags{}), kind_(kind) {}
+ : Base(Hash(tint::TypeInfo::Of<Sampler>().full_hashcode, kind), core::type::Flags{}),
+ kind_(kind) {}
Sampler::~Sampler() = default;
@@ -41,4 +42,4 @@
return ctx.dst.mgr->Get<Sampler>(kind_);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/sampler.h b/src/tint/lang/core/type/sampler.h
index 9946731..9487152 100644
--- a/src/tint/lang/core/type/sampler.h
+++ b/src/tint/lang/core/type/sampler.h
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/sampler_kind.h"
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A sampler type.
class Sampler final : public Castable<Sampler, Type> {
@@ -54,6 +54,6 @@
SamplerKind const kind_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_SAMPLER_H_
diff --git a/src/tint/lang/core/type/sampler_kind.cc b/src/tint/lang/core/type/sampler_kind.cc
index 17e950c..5019ba9 100644
--- a/src/tint/lang/core/type/sampler_kind.cc
+++ b/src/tint/lang/core/type/sampler_kind.cc
@@ -14,7 +14,7 @@
#include "src/tint/lang/core/type/sampler_kind.h"
-namespace tint::type {
+namespace tint::core::type {
std::string_view ToString(SamplerKind kind) {
switch (kind) {
@@ -26,4 +26,4 @@
return "<unknown>";
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/sampler_kind.h b/src/tint/lang/core/type/sampler_kind.h
index fed81c2..5b58e13 100644
--- a/src/tint/lang/core/type/sampler_kind.h
+++ b/src/tint/lang/core/type/sampler_kind.h
@@ -18,7 +18,7 @@
#include "src/tint/utils/text/string_stream.h"
#include "src/tint/utils/traits/traits.h"
-namespace tint::type {
+namespace tint::core::type {
/// The different kinds of samplers
enum class SamplerKind {
@@ -40,6 +40,6 @@
return out << ToString(kind);
}
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_SAMPLER_KIND_H_
diff --git a/src/tint/lang/core/type/sampler_test.cc b/src/tint/lang/core/type/sampler_test.cc
index 7b9657f..fb51867 100644
--- a/src/tint/lang/core/type/sampler_test.cc
+++ b/src/tint/lang/core/type/sampler_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using SamplerTest = TestHelper;
@@ -66,12 +66,12 @@
TEST_F(SamplerTest, Clone) {
auto* a = create<Sampler>(SamplerKind::kSampler);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* mt = a->Clone(ctx);
EXPECT_EQ(mt->kind(), SamplerKind::kSampler);
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/scalar.cc b/src/tint/lang/core/type/scalar.cc
index b6b9650..1536e21 100644
--- a/src/tint/lang/core/type/scalar.cc
+++ b/src/tint/lang/core/type/scalar.cc
@@ -14,11 +14,11 @@
#include "src/tint/lang/core/type/scalar.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Scalar);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Scalar);
-namespace tint::type {
+namespace tint::core::type {
-Scalar::Scalar(size_t hash, type::Flags flags) : Base(hash, flags) {}
+Scalar::Scalar(size_t hash, core::type::Flags flags) : Base(hash, flags) {}
Scalar::~Scalar() = default;
@@ -26,4 +26,4 @@
return &other.TypeInfo() == &TypeInfo();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/scalar.h b/src/tint/lang/core/type/scalar.h
index bbcd046..ac6d81b 100644
--- a/src/tint/lang/core/type/scalar.h
+++ b/src/tint/lang/core/type/scalar.h
@@ -17,7 +17,7 @@
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// Base class for all scalar types
/// @see https://www.w3.org/TR/WGSL/#scalar-types
@@ -34,9 +34,9 @@
/// Constructor
/// @param hash the immutable hash for the node
/// @param flags the flags of this type
- Scalar(size_t hash, type::Flags flags);
+ Scalar(size_t hash, core::type::Flags flags);
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_SCALAR_H_
diff --git a/src/tint/lang/core/type/storage_texture.cc b/src/tint/lang/core/type/storage_texture.cc
index 0e766c5..f1d7204 100644
--- a/src/tint/lang/core/type/storage_texture.cc
+++ b/src/tint/lang/core/type/storage_texture.cc
@@ -21,9 +21,9 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::StorageTexture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::StorageTexture);
-namespace tint::type {
+namespace tint::core::type {
StorageTexture::StorageTexture(TextureDimension dim,
core::TexelFormat format,
@@ -89,4 +89,4 @@
return ctx.dst.mgr->Get<StorageTexture>(dim(), texel_format_, access_, ty);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/storage_texture.h b/src/tint/lang/core/type/storage_texture.h
index 550973d..491e7fa 100644
--- a/src/tint/lang/core/type/storage_texture.h
+++ b/src/tint/lang/core/type/storage_texture.h
@@ -23,11 +23,11 @@
#include "src/tint/lang/core/type/texture_dimension.h"
// Forward declarations
-namespace tint::type {
+namespace tint::core::type {
class Manager;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// A storage texture type.
class StorageTexture final : public Castable<StorageTexture, Texture> {
@@ -77,6 +77,6 @@
Type* const subtype_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_STORAGE_TEXTURE_H_
diff --git a/src/tint/lang/core/type/storage_texture_test.cc b/src/tint/lang/core/type/storage_texture_test.cc
index 35a3b12..45f7776 100644
--- a/src/tint/lang/core/type/storage_texture_test.cc
+++ b/src/tint/lang/core/type/storage_texture_test.cc
@@ -20,7 +20,7 @@
#include "src/tint/lang/core/type/sampled_texture.h"
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
struct StorageTextureTest : public TestHelper {
@@ -137,8 +137,8 @@
auto* a =
Create(TextureDimension::kCube, core::TexelFormat::kRgba32Float, core::Access::kReadWrite);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* mt = a->Clone(ctx);
EXPECT_EQ(mt->dim(), TextureDimension::kCube);
@@ -147,4 +147,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/struct.cc b/src/tint/lang/core/type/struct.cc
index 7792923..142196e 100644
--- a/src/tint/lang/core/type/struct.cc
+++ b/src/tint/lang/core/type/struct.cc
@@ -24,14 +24,14 @@
#include "src/tint/utils/symbol/symbol_table.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Struct);
-TINT_INSTANTIATE_TYPEINFO(tint::type::StructMember);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Struct);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::StructMember);
-namespace tint::type {
+namespace tint::core::type {
namespace {
-type::Flags FlagsFrom(VectorRef<const StructMember*> members) {
- type::Flags flags{
+core::type::Flags FlagsFrom(VectorRef<const StructMember*> members) {
+ core::type::Flags flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -180,7 +180,7 @@
}
StructMember::StructMember(Symbol name,
- const type::Type* type,
+ const core::type::Type* type,
uint32_t index,
uint32_t offset,
uint32_t align,
@@ -202,4 +202,4 @@
return ctx.dst.mgr->Get<StructMember>(sym, ty, index_, offset_, align_, size_, attributes_);
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/struct.h b/src/tint/lang/core/type/struct.h
index 4bff0da..e19693f 100644
--- a/src/tint/lang/core/type/struct.h
+++ b/src/tint/lang/core/type/struct.h
@@ -30,11 +30,11 @@
#include "src/tint/utils/symbol/symbol.h"
// Forward declarations
-namespace tint::type {
+namespace tint::core::type {
class StructMember;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// Metadata to capture how a structure is used in a shader module.
enum class PipelineStageUsage {
@@ -109,7 +109,7 @@
uint32_t SizeNoPadding() const { return size_no_padding_; }
/// @returns the structure flags
- type::StructFlags StructFlags() const { return struct_flags_; }
+ core::type::StructFlags StructFlags() const { return struct_flags_; }
/// Set a structure flag.
/// @param flag the flag to set
@@ -181,7 +181,7 @@
const uint32_t align_;
const uint32_t size_;
const uint32_t size_no_padding_;
- type::StructFlags struct_flags_;
+ core::type::StructFlags struct_flags_;
std::unordered_set<core::AddressSpace> address_space_usage_;
std::unordered_set<PipelineStageUsage> pipeline_stage_uses_;
tint::Vector<const Struct*, 2> concrete_types_;
@@ -213,7 +213,7 @@
/// @param size the byte size of the member
/// @param attributes the optional attributes
StructMember(Symbol name,
- const type::Type* type,
+ const core::type::Type* type,
uint32_t index,
uint32_t offset,
uint32_t align,
@@ -231,10 +231,10 @@
void SetStruct(const Struct* s) { struct_ = s; }
/// @returns the structure that owns this member
- const type::Struct* Struct() const { return struct_; }
+ const core::type::Struct* Struct() const { return struct_; }
/// @returns the type of the member
- const type::Type* Type() const { return type_; }
+ const core::type::Type* Type() const { return type_; }
/// @returns the member index
uint32_t Index() const { return index_; }
@@ -261,8 +261,8 @@
private:
const Symbol name_;
- const type::Struct* struct_;
- const type::Type* type_;
+ const core::type::Struct* struct_;
+ const core::type::Type* type_;
const uint32_t index_;
const uint32_t offset_;
const uint32_t align_;
@@ -270,6 +270,6 @@
StructMemberAttributes attributes_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_STRUCT_H_
diff --git a/src/tint/lang/core/type/struct_test.cc b/src/tint/lang/core/type/struct_test.cc
index 7a743fd..b6059a1 100644
--- a/src/tint/lang/core/type/struct_test.cc
+++ b/src/tint/lang/core/type/struct_test.cc
@@ -16,7 +16,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using namespace tint::number_suffixes; // NOLINT
@@ -205,7 +205,7 @@
}
TEST_F(TypeStructTest, Clone) {
- type::StructMemberAttributes attrs_location_2;
+ core::type::StructMemberAttributes attrs_location_2;
attrs_location_2.location = 2;
auto* s = create<Struct>(
@@ -213,14 +213,14 @@
tint::Vector{create<StructMember>(Sym("b"), create<Vector>(create<F32>(), 3u), 0u, 0u, 16u,
12u, attrs_location_2),
create<StructMember>(Sym("a"), create<I32>(), 1u, 16u, 4u, 4u,
- type::StructMemberAttributes{})},
+ core::type::StructMemberAttributes{})},
4u /* align */, 8u /* size */, 16u /* size_no_padding */);
GenerationID id;
SymbolTable new_st{id};
- type::Manager mgr;
- type::CloneContext ctx{{&Symbols()}, {&new_st, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{&Symbols()}, {&new_st, &mgr}};
auto* st = s->Clone(ctx);
@@ -250,4 +250,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/texture.cc b/src/tint/lang/core/type/texture.cc
index e6d711b..7240bd6 100644
--- a/src/tint/lang/core/type/texture.cc
+++ b/src/tint/lang/core/type/texture.cc
@@ -14,44 +14,44 @@
#include "src/tint/lang/core/type/texture.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Texture);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Texture);
-namespace tint::type {
+namespace tint::core::type {
-Texture::Texture(size_t hash, TextureDimension dim) : Base(hash, type::Flags{}), dim_(dim) {}
+Texture::Texture(size_t hash, TextureDimension dim) : Base(hash, core::type::Flags{}), dim_(dim) {}
Texture::~Texture() = default;
-bool IsTextureArray(type::TextureDimension dim) {
+bool IsTextureArray(core::type::TextureDimension dim) {
switch (dim) {
- case type::TextureDimension::k2dArray:
- case type::TextureDimension::kCubeArray:
+ case core::type::TextureDimension::k2dArray:
+ case core::type::TextureDimension::kCubeArray:
return true;
- case type::TextureDimension::k2d:
- case type::TextureDimension::kNone:
- case type::TextureDimension::k1d:
- case type::TextureDimension::k3d:
- case type::TextureDimension::kCube:
+ case core::type::TextureDimension::k2d:
+ case core::type::TextureDimension::kNone:
+ case core::type::TextureDimension::k1d:
+ case core::type::TextureDimension::k3d:
+ case core::type::TextureDimension::kCube:
return false;
}
return false;
}
-int NumCoordinateAxes(type::TextureDimension dim) {
+int NumCoordinateAxes(core::type::TextureDimension dim) {
switch (dim) {
- case type::TextureDimension::kNone:
+ case core::type::TextureDimension::kNone:
return 0;
- case type::TextureDimension::k1d:
+ case core::type::TextureDimension::k1d:
return 1;
- case type::TextureDimension::k2d:
- case type::TextureDimension::k2dArray:
+ case core::type::TextureDimension::k2d:
+ case core::type::TextureDimension::k2dArray:
return 2;
- case type::TextureDimension::k3d:
- case type::TextureDimension::kCube:
- case type::TextureDimension::kCubeArray:
+ case core::type::TextureDimension::k3d:
+ case core::type::TextureDimension::kCube:
+ case core::type::TextureDimension::kCubeArray:
return 3;
}
return 0;
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/texture.h b/src/tint/lang/core/type/texture.h
index 792f9be..e94ef81 100644
--- a/src/tint/lang/core/type/texture.h
+++ b/src/tint/lang/core/type/texture.h
@@ -18,7 +18,7 @@
#include "src/tint/lang/core/type/texture_dimension.h"
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A texture type.
class Texture : public Castable<Texture, Type> {
@@ -39,7 +39,7 @@
/// @param dim the type::TextureDimension to query
/// @return true if the given type::TextureDimension is an array texture
-bool IsTextureArray(type::TextureDimension dim);
+bool IsTextureArray(core::type::TextureDimension dim);
/// Returns the number of axes in the coordinate used for accessing
/// the texture, where an access is one of: sampling, fetching, load,
@@ -53,8 +53,8 @@
/// size, representing the (x,y) size of each cube face, in texels.
/// @param dim the type::TextureDimension to query
/// @return number of dimensions in a coordinate for the dimensionality
-int NumCoordinateAxes(type::TextureDimension dim);
+int NumCoordinateAxes(core::type::TextureDimension dim);
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_TEXTURE_H_
diff --git a/src/tint/lang/core/type/texture_dimension.cc b/src/tint/lang/core/type/texture_dimension.cc
index dc2ce79..a322ec7 100644
--- a/src/tint/lang/core/type/texture_dimension.cc
+++ b/src/tint/lang/core/type/texture_dimension.cc
@@ -14,26 +14,26 @@
#include "src/tint/lang/core/type/texture_dimension.h"
-namespace tint::type {
+namespace tint::core::type {
-std::string_view ToString(type::TextureDimension dim) {
+std::string_view ToString(core::type::TextureDimension dim) {
switch (dim) {
- case type::TextureDimension::kNone:
+ case core::type::TextureDimension::kNone:
return "None";
- case type::TextureDimension::k1d:
+ case core::type::TextureDimension::k1d:
return "1d";
- case type::TextureDimension::k2d:
+ case core::type::TextureDimension::k2d:
return "2d";
- case type::TextureDimension::k2dArray:
+ case core::type::TextureDimension::k2dArray:
return "2d_array";
- case type::TextureDimension::k3d:
+ case core::type::TextureDimension::k3d:
return "3d";
- case type::TextureDimension::kCube:
+ case core::type::TextureDimension::kCube:
return "cube";
- case type::TextureDimension::kCubeArray:
+ case core::type::TextureDimension::kCubeArray:
return "cube_array";
}
return "<unknown>";
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/texture_dimension.h b/src/tint/lang/core/type/texture_dimension.h
index 1d5fd44..f77c796 100644
--- a/src/tint/lang/core/type/texture_dimension.h
+++ b/src/tint/lang/core/type/texture_dimension.h
@@ -18,7 +18,7 @@
#include "src/tint/utils/text/string_stream.h"
#include "src/tint/utils/traits/traits.h"
-namespace tint::type {
+namespace tint::core::type {
/// The dimensionality of the texture
enum class TextureDimension {
@@ -46,10 +46,10 @@
/// @param dim the type::TextureDimension
/// @return the stream so calls can be chained
template <typename STREAM, typename = traits::EnableIfIsOStream<STREAM>>
-auto& operator<<(STREAM& out, type::TextureDimension dim) {
+auto& operator<<(STREAM& out, core::type::TextureDimension dim) {
return out << ToString(dim);
}
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_TEXTURE_DIMENSION_H_
diff --git a/src/tint/lang/core/type/texture_test.cc b/src/tint/lang/core/type/texture_test.cc
index 55aa370..70f5ccf 100644
--- a/src/tint/lang/core/type/texture_test.cc
+++ b/src/tint/lang/core/type/texture_test.cc
@@ -17,7 +17,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/sampled_texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using TextureTypeDimTest = TestParamHelper<TextureDimension>;
@@ -41,4 +41,4 @@
TextureDimension::kCubeArray));
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/type.cc b/src/tint/lang/core/type/type.cc
index 3c5185f..9b99c5ad 100644
--- a/src/tint/lang/core/type/type.cc
+++ b/src/tint/lang/core/type/type.cc
@@ -31,11 +31,11 @@
#include "src/tint/lang/core/type/vector.h"
#include "src/tint/utils/rtti/switch.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Type);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Type);
-namespace tint::type {
+namespace tint::core::type {
-Type::Type(size_t hash, type::Flags flags) : Base(hash), flags_(flags) {
+Type::Type(size_t hash, core::type::Flags flags) : Base(hash), flags_(flags) {
if (IsConstructible()) {
TINT_ASSERT(HasCreationFixedFootprint());
}
@@ -149,15 +149,15 @@
}
bool Type::is_numeric_vector() const {
- return Is([](const Vector* v) { return v->type()->Is<type::NumericScalar>(); });
+ return Is([](const Vector* v) { return v->type()->Is<core::type::NumericScalar>(); });
}
bool Type::is_scalar_vector() const {
- return Is([](const Vector* v) { return v->type()->Is<type::Scalar>(); });
+ return Is([](const Vector* v) { return v->type()->Is<core::type::Scalar>(); });
}
bool Type::is_numeric_scalar_or_vector() const {
- return Is<type::NumericScalar>() || is_numeric_vector();
+ return Is<core::type::NumericScalar>() || is_numeric_vector();
}
bool Type::is_handle() const {
@@ -284,4 +284,4 @@
return common;
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/type.h b/src/tint/lang/core/type/type.h
index 2c9acd8..bfeb9b6 100644
--- a/src/tint/lang/core/type/type.h
+++ b/src/tint/lang/core/type/type.h
@@ -28,11 +28,11 @@
class ProgramBuilder;
class SymbolTable;
} // namespace tint
-namespace tint::type {
+namespace tint::core::type {
class Type;
-} // namespace tint::type
+} // namespace tint::core::type
-namespace tint::type {
+namespace tint::core::type {
/// Flag is an enumerator of type flag bits, used by Flags.
enum Flag {
@@ -97,7 +97,7 @@
virtual Type* Clone(CloneContext& ctx) const = 0;
/// @returns the flags on the type
- type::Flags Flags() { return flags_; }
+ core::type::Flags Flags() { return flags_; }
/// @returns true if type is constructable
/// https://gpuweb.github.io/gpuweb/wgsl/#constructible-types
@@ -228,31 +228,31 @@
/// Constructor
/// @param hash the immutable hash for the node
/// @param flags the flags of this type
- Type(size_t hash, type::Flags flags);
+ Type(size_t hash, core::type::Flags flags);
/// The flags of this type.
- const type::Flags flags_;
+ const core::type::Flags flags_;
};
-} // namespace tint::type
+} // namespace tint::core::type
namespace std {
-/// std::hash specialization for tint::type::Type
+/// std::hash specialization for tint::core::type::Type
template <>
-struct hash<tint::type::Type> {
+struct hash<tint::core::type::Type> {
/// @param type the type to obtain a hash from
/// @returns the hash of the type
- size_t operator()(const tint::type::Type& type) const { return type.unique_hash; }
+ size_t operator()(const tint::core::type::Type& type) const { return type.unique_hash; }
};
-/// std::equal_to specialization for tint::type::Type
+/// std::equal_to specialization for tint::core::type::Type
template <>
-struct equal_to<tint::type::Type> {
+struct equal_to<tint::core::type::Type> {
/// @param a the first type to compare
/// @param b the second type to compare
/// @returns true if the two types are equal
- bool operator()(const tint::type::Type& a, const tint::type::Type& b) const {
+ bool operator()(const tint::core::type::Type& a, const tint::core::type::Type& b) const {
return a.Equals(b);
}
};
diff --git a/src/tint/lang/core/type/type_test.cc b/src/tint/lang/core/type/type_test.cc
index 900fddd..25c0403 100644
--- a/src/tint/lang/core/type/type_test.cc
+++ b/src/tint/lang/core/type/type_test.cc
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/reference.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
struct TypeTest : public TestHelper {
@@ -45,34 +45,36 @@
const Matrix* mat4x3_af = create<Matrix>(vec3_af, 4u);
const Reference* ref_u32 =
create<Reference>(core::AddressSpace::kPrivate, u32, core::Access::kReadWrite);
- const Struct* str_f32 = create<Struct>(Sym("str_f32"),
- tint::Vector{
- create<StructMember>(
- /* name */ Sym("x"),
- /* type */ f32,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* attributes */ type::StructMemberAttributes{}),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
- const Struct* str_f16 = create<Struct>(Sym("str_f16"),
- tint::Vector{
- create<StructMember>(
- /* name */ Sym("x"),
- /* type */ f16,
- /* index */ 0u,
- /* offset */ 0u,
- /* align */ 4u,
- /* size */ 4u,
- /* attributes */ type::StructMemberAttributes{}),
- },
- /* align*/ 4u,
- /* size*/ 4u,
- /* size_no_padding*/ 4u);
+ const Struct* str_f32 =
+ create<Struct>(Sym("str_f32"),
+ tint::Vector{
+ create<StructMember>(
+ /* name */ Sym("x"),
+ /* type */ f32,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* attributes */ core::type::StructMemberAttributes{}),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
+ const Struct* str_f16 =
+ create<Struct>(Sym("str_f16"),
+ tint::Vector{
+ create<StructMember>(
+ /* name */ Sym("x"),
+ /* type */ f16,
+ /* index */ 0u,
+ /* offset */ 0u,
+ /* align */ 4u,
+ /* size */ 4u,
+ /* attributes */ core::type::StructMemberAttributes{}),
+ },
+ /* align*/ 4u,
+ /* size*/ 4u,
+ /* size_no_padding*/ 4u);
Struct* str_af = create<Struct>(Sym("str_af"),
tint::Vector{
create<StructMember>(
@@ -82,7 +84,7 @@
/* offset */ 0u,
/* align */ 4u,
/* size */ 4u,
- /* attributes */ type::StructMemberAttributes{}),
+ /* attributes */ core::type::StructMemberAttributes{}),
},
/* align*/ 4u,
/* size*/ 4u,
@@ -546,4 +548,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/u32.cc b/src/tint/lang/core/type/u32.cc
index 37cf91d..c548222 100644
--- a/src/tint/lang/core/type/u32.cc
+++ b/src/tint/lang/core/type/u32.cc
@@ -16,13 +16,13 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::U32);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::U32);
-namespace tint::type {
+namespace tint::core::type {
U32::U32()
: Base(static_cast<size_t>(tint::TypeInfo::Of<U32>().full_hashcode),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -46,4 +46,4 @@
return ctx.dst.mgr->Get<U32>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/u32.h b/src/tint/lang/core/type/u32.h
index 5498228..4013fed 100644
--- a/src/tint/lang/core/type/u32.h
+++ b/src/tint/lang/core/type/u32.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/numeric_scalar.h"
-namespace tint::type {
+namespace tint::core::type {
/// A unsigned int 32 type.
class U32 final : public Castable<U32, NumericScalar> {
@@ -45,6 +45,6 @@
U32* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_U32_H_
diff --git a/src/tint/lang/core/type/u32_test.cc b/src/tint/lang/core/type/u32_test.cc
index 54e9898..af58452 100644
--- a/src/tint/lang/core/type/u32_test.cc
+++ b/src/tint/lang/core/type/u32_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using U32Test = TestHelper;
@@ -47,12 +47,12 @@
TEST_F(U32Test, Clone) {
auto* a = create<U32>();
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* b = a->Clone(ctx);
ASSERT_TRUE(b->Is<U32>());
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/unique_node.cc b/src/tint/lang/core/type/unique_node.cc
index 1de2ec9..7a4aef2 100644
--- a/src/tint/lang/core/type/unique_node.cc
+++ b/src/tint/lang/core/type/unique_node.cc
@@ -14,10 +14,10 @@
#include "src/tint/lang/core/type/unique_node.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::UniqueNode);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::UniqueNode);
-namespace tint::type {
+namespace tint::core::type {
UniqueNode::~UniqueNode() = default;
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/unique_node.h b/src/tint/lang/core/type/unique_node.h
index c0042a5..bcf136b 100644
--- a/src/tint/lang/core/type/unique_node.h
+++ b/src/tint/lang/core/type/unique_node.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/node.h"
-namespace tint::type {
+namespace tint::core::type {
/// UniqueNode is the base class for objects that are de-duplicated by the Manager.
/// Deduplication is achieved by comparing a temporary object to the set of existing objects, using
@@ -42,25 +42,26 @@
const size_t unique_hash;
};
-} // namespace tint::type
+} // namespace tint::core::type
namespace std {
-/// std::hash specialization for tint::type::UniqueNode
+/// std::hash specialization for tint::core::type::UniqueNode
template <>
-struct hash<tint::type::UniqueNode> {
+struct hash<tint::core::type::UniqueNode> {
/// @param node the unique node to obtain a hash from
/// @returns the hash of the node
- size_t operator()(const tint::type::UniqueNode& node) const { return node.unique_hash; }
+ size_t operator()(const tint::core::type::UniqueNode& node) const { return node.unique_hash; }
};
-/// std::equal_to specialization for tint::type::UniqueNode
+/// std::equal_to specialization for tint::core::type::UniqueNode
template <>
-struct equal_to<tint::type::UniqueNode> {
+struct equal_to<tint::core::type::UniqueNode> {
/// @param a the first unique node to compare
/// @param b the second unique node to compare
/// @returns true if the two nodes are equal
- bool operator()(const tint::type::UniqueNode& a, const tint::type::UniqueNode& b) const {
+ bool operator()(const tint::core::type::UniqueNode& a,
+ const tint::core::type::UniqueNode& b) const {
return &a == &b || a.Equals(b);
}
};
diff --git a/src/tint/lang/core/type/vector.cc b/src/tint/lang/core/type/vector.cc
index 5e7d865..1bde999 100644
--- a/src/tint/lang/core/type/vector.cc
+++ b/src/tint/lang/core/type/vector.cc
@@ -20,13 +20,13 @@
#include "src/tint/utils/math/hash.h"
#include "src/tint/utils/text/string_stream.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Vector);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Vector);
-namespace tint::type {
+namespace tint::core::type {
Vector::Vector(Type const* subtype, uint32_t width, bool packed /* = false */)
: Base(Hash(tint::TypeInfo::Of<Vector>().full_hashcode, width, subtype, packed),
- type::Flags{
+ core::type::Flags{
Flag::kConstructable,
Flag::kCreationFixedFootprint,
Flag::kFixedFootprint,
@@ -86,4 +86,4 @@
return index < width_ ? subtype_ : nullptr;
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/vector.h b/src/tint/lang/core/type/vector.h
index ce92cef..2be8499 100644
--- a/src/tint/lang/core/type/vector.h
+++ b/src/tint/lang/core/type/vector.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A vector type.
class Vector : public Castable<Vector, Type> {
@@ -81,6 +81,6 @@
const bool packed_;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_VECTOR_H_
diff --git a/src/tint/lang/core/type/vector_test.cc b/src/tint/lang/core/type/vector_test.cc
index 85e28d1..3f73cec 100644
--- a/src/tint/lang/core/type/vector_test.cc
+++ b/src/tint/lang/core/type/vector_test.cc
@@ -15,7 +15,7 @@
#include "src/tint/lang/core/type/helper_test.h"
#include "src/tint/lang/core/type/texture.h"
-namespace tint::type {
+namespace tint::core::type {
namespace {
using VectorTest = TestHelper;
@@ -83,8 +83,8 @@
TEST_F(VectorTest, Clone) {
auto* a = create<Vector>(create<I32>(), 2u);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* vec = a->Clone(ctx);
EXPECT_TRUE(vec->type()->Is<I32>());
@@ -95,8 +95,8 @@
TEST_F(VectorTest, Clone_Packed) {
auto* a = create<Vector>(create<I32>(), 3u, true);
- type::Manager mgr;
- type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
+ core::type::Manager mgr;
+ core::type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* vec = a->Clone(ctx);
EXPECT_TRUE(vec->type()->Is<I32>());
@@ -105,4 +105,4 @@
}
} // namespace
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/void.cc b/src/tint/lang/core/type/void.cc
index 69c9a44..a829c17 100644
--- a/src/tint/lang/core/type/void.cc
+++ b/src/tint/lang/core/type/void.cc
@@ -16,11 +16,12 @@
#include "src/tint/lang/core/type/manager.h"
-TINT_INSTANTIATE_TYPEINFO(tint::type::Void);
+TINT_INSTANTIATE_TYPEINFO(tint::core::type::Void);
-namespace tint::type {
+namespace tint::core::type {
-Void::Void() : Base(static_cast<size_t>(tint::TypeInfo::Of<Void>().full_hashcode), type::Flags{}) {}
+Void::Void()
+ : Base(static_cast<size_t>(tint::TypeInfo::Of<Void>().full_hashcode), core::type::Flags{}) {}
Void::~Void() = default;
@@ -36,4 +37,4 @@
return ctx.dst.mgr->Get<Void>();
}
-} // namespace tint::type
+} // namespace tint::core::type
diff --git a/src/tint/lang/core/type/void.h b/src/tint/lang/core/type/void.h
index 5ee7146..05cb495 100644
--- a/src/tint/lang/core/type/void.h
+++ b/src/tint/lang/core/type/void.h
@@ -19,7 +19,7 @@
#include "src/tint/lang/core/type/type.h"
-namespace tint::type {
+namespace tint::core::type {
/// A void type
class Void final : public Castable<Void, Type> {
@@ -43,6 +43,6 @@
Void* Clone(CloneContext& ctx) const override;
};
-} // namespace tint::type
+} // namespace tint::core::type
#endif // SRC_TINT_LANG_CORE_TYPE_VOID_H_