[tint] Remove Validator::IsFixedFootprint()
We can just use the method on the type instead, which is memoized.
Remove Resolver::IsFixedFootprint() too, which was unused.
Change-Id: I4477824b85e266c37b16960df2876b1777d675f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/236078
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/wgsl/resolver/resolver.h b/src/tint/lang/wgsl/resolver/resolver.h
index 9d031f9..5c22767 100644
--- a/src/tint/lang/wgsl/resolver/resolver.h
+++ b/src/tint/lang/wgsl/resolver/resolver.h
@@ -120,12 +120,6 @@
bool IsPlain(const core::type::Type* type) const { return validator_.IsPlain(type); }
/// @param type the given type
- /// @returns true if the given type is a fixed-footprint type
- bool IsFixedFootprint(const core::type::Type* type) const {
- return validator_.IsFixedFootprint(type);
- }
-
- /// @param type the given type
/// @returns true if the given type is storable
bool IsStorable(const core::type::Type* type) const { return validator_.IsStorable(type); }
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index 432c4d2..693ed59 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -220,29 +220,6 @@
sem::Array, core::type::Struct, core::type::SubgroupMatrix>();
}
-// https://gpuweb.github.io/gpuweb/wgsl/#fixed-footprint-types
-bool Validator::IsFixedFootprint(const core::type::Type* type) const {
- return Switch(
- type, //
- [&](const core::type::Vector*) { return true; }, //
- [&](const core::type::Matrix*) { return true; }, //
- [&](const core::type::Atomic*) { return true; },
- [&](const core::type::SubgroupMatrix*) { return true; },
- [&](const sem::Array* arr) {
- return !arr->Count()->Is<core::type::RuntimeArrayCount>() &&
- IsFixedFootprint(arr->ElemType());
- },
- [&](const core::type::Struct* str) {
- for (auto* member : str->Members()) {
- if (!IsFixedFootprint(member->Type())) {
- return false;
- }
- }
- return true;
- },
- [&](Default) { return type->Is<core::type::Scalar>(); });
-}
-
// https://gpuweb.github.io/gpuweb/wgsl.html#storable-types
bool Validator::IsStorable(const core::type::Type* type) const {
return IsPlain(type) ||
@@ -2488,7 +2465,7 @@
return false;
}
- if (!IsFixedFootprint(el_ty)) {
+ if (!el_ty->HasFixedFootprint()) {
AddError(el_source) << "an array element type cannot contain a runtime-sized array";
return false;
}
@@ -2549,7 +2526,7 @@
RaiseArrayWithOverrideCountError(member->Declaration()->type->source);
return false;
}
- } else if (!IsFixedFootprint(member->Type())) {
+ } else if (!member->Type()->HasFixedFootprint()) {
AddError(member->Declaration()->source)
<< "a struct that contains a runtime array cannot be nested inside another struct";
return false;
diff --git a/src/tint/lang/wgsl/resolver/validator.h b/src/tint/lang/wgsl/resolver/validator.h
index 3955832..53e1603 100644
--- a/src/tint/lang/wgsl/resolver/validator.h
+++ b/src/tint/lang/wgsl/resolver/validator.h
@@ -163,10 +163,6 @@
bool IsPlain(const core::type::Type* type) const;
/// @param type the given type
- /// @returns true if the given type is a fixed-footprint type
- bool IsFixedFootprint(const core::type::Type* type) const;
-
- /// @param type the given type
/// @returns true if the given type is storable
bool IsStorable(const core::type::Type* type) const;