Remove sem::UnwrapAccess()
Bug: tint:802 Change-Id: I8bc769e4e7c2a27a8793e2851d12f75ec20c97e9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51142 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
5f5f79c71f
commit
be607c07a4
|
@ -183,7 +183,6 @@ bool Resolver::Resolve() {
|
||||||
|
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl.html#storable-types
|
// https://gpuweb.github.io/gpuweb/wgsl.html#storable-types
|
||||||
bool Resolver::IsStorable(const sem::Type* type) {
|
bool Resolver::IsStorable(const sem::Type* type) {
|
||||||
type = type->UnwrapAccess();
|
|
||||||
if (type->is_scalar() || type->Is<sem::Vector>() || type->Is<sem::Matrix>()) {
|
if (type->is_scalar() || type->Is<sem::Vector>() || type->Is<sem::Matrix>()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +202,6 @@ bool Resolver::IsStorable(const sem::Type* type) {
|
||||||
|
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable-types
|
// https://gpuweb.github.io/gpuweb/wgsl.html#host-shareable-types
|
||||||
bool Resolver::IsHostShareable(const sem::Type* type) {
|
bool Resolver::IsHostShareable(const sem::Type* type) {
|
||||||
type = type->UnwrapAccess();
|
|
||||||
if (type->IsAnyOf<sem::I32, sem::U32, sem::F32>()) {
|
if (type->IsAnyOf<sem::I32, sem::U32, sem::F32>()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -555,7 +553,7 @@ bool Resolver::ValidateVariableConstructor(const ast::Variable* var,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value type has to match storage type
|
// Value type has to match storage type
|
||||||
if (storage_type->UnwrapAccess() != value_type->UnwrapAccess()) {
|
if (storage_type != value_type) {
|
||||||
std::string decl = var->is_const() ? "let" : "var";
|
std::string decl = var->is_const() ? "let" : "var";
|
||||||
diagnostics_.add_error("cannot initialize " + decl + " of type '" +
|
diagnostics_.add_error("cannot initialize " + decl + " of type '" +
|
||||||
type_name + "' with value of type '" +
|
type_name + "' with value of type '" +
|
||||||
|
@ -3018,13 +3016,12 @@ bool Resolver::ValidateAssignment(const ast::AssignmentStatement* a) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* storage_type_with_access = lhs_ref->StoreType();
|
auto* storage_type = lhs_ref->StoreType();
|
||||||
|
|
||||||
// TODO(crbug.com/tint/809): The originating variable of the left-hand side
|
// TODO(crbug.com/tint/809): The originating variable of the left-hand side
|
||||||
// must not have an access(read) access attribute.
|
// must not have an access(read) access attribute.
|
||||||
// https://gpuweb.github.io/gpuweb/wgsl/#assignment
|
// https://gpuweb.github.io/gpuweb/wgsl/#assignment
|
||||||
|
|
||||||
auto* storage_type = storage_type_with_access->UnwrapAccess();
|
|
||||||
auto* value_type = rhs_type->UnwrapRef(); // Implicit load of RHS
|
auto* value_type = rhs_type->UnwrapRef(); // Implicit load of RHS
|
||||||
|
|
||||||
// RHS needs to be of a storable type
|
// RHS needs to be of a storable type
|
||||||
|
|
|
@ -52,12 +52,6 @@ const Type* Type::UnwrapRef() const {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type* Type::UnwrapAccess() const {
|
|
||||||
// TODO(amaiorano): Delete this function
|
|
||||||
auto* type = this;
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Type::is_scalar() const {
|
bool Type::is_scalar() const {
|
||||||
return IsAnyOf<F32, U32, I32, Bool>();
|
return IsAnyOf<F32, U32, I32, Bool>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,6 @@ class Type : public Castable<Type, Node> {
|
||||||
/// @returns the inner type if this is a reference, `this` otherwise
|
/// @returns the inner type if this is a reference, `this` otherwise
|
||||||
const Type* UnwrapRef() const;
|
const Type* UnwrapRef() const;
|
||||||
|
|
||||||
/// @returns the inner most type if this is an access control, `this`
|
|
||||||
/// otherwise
|
|
||||||
const Type* UnwrapAccess() const;
|
|
||||||
|
|
||||||
/// @returns true if this type is a scalar
|
/// @returns true if this type is a scalar
|
||||||
bool is_scalar() const;
|
bool is_scalar() const;
|
||||||
|
|
Loading…
Reference in New Issue