mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
Rename StorageClass to AddressSpace.
This CL updates the internals to use AddressSpace instead of the old StorageClass name. Bug: tint:1404 Change-Id: Iecc208e839453437f4d630f65e0152206a52db7e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104420 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
d5b64ecd78
commit
ff7cf21021
@@ -68,7 +68,7 @@ Function::VariableBindings Function::TransitivelyReferencedUniformVariables() co
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* global : TransitivelyReferencedGlobals()) {
|
||||
if (global->StorageClass() != ast::StorageClass::kUniform) {
|
||||
if (global->AddressSpace() != ast::AddressSpace::kUniform) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ Function::VariableBindings Function::TransitivelyReferencedStorageBufferVariable
|
||||
VariableBindings ret;
|
||||
|
||||
for (auto* global : TransitivelyReferencedGlobals()) {
|
||||
if (global->StorageClass() != ast::StorageClass::kStorage) {
|
||||
if (global->AddressSpace() != ast::AddressSpace::kStorage) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,19 +22,19 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Pointer);
|
||||
|
||||
namespace tint::sem {
|
||||
|
||||
Pointer::Pointer(const Type* subtype, ast::StorageClass storage_class, ast::Access access)
|
||||
: subtype_(subtype), storage_class_(storage_class), access_(access) {
|
||||
Pointer::Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
|
||||
: subtype_(subtype), address_space_(address_space), access_(access) {
|
||||
TINT_ASSERT(Semantic, !subtype->Is<Reference>());
|
||||
TINT_ASSERT(Semantic, access != ast::Access::kUndefined);
|
||||
}
|
||||
|
||||
size_t Pointer::Hash() const {
|
||||
return utils::Hash(TypeInfo::Of<Pointer>().full_hashcode, storage_class_, subtype_, access_);
|
||||
return utils::Hash(TypeInfo::Of<Pointer>().full_hashcode, address_space_, subtype_, access_);
|
||||
}
|
||||
|
||||
bool Pointer::Equals(const sem::Type& other) const {
|
||||
if (auto* o = other.As<Pointer>()) {
|
||||
return o->storage_class_ == storage_class_ && o->subtype_ == subtype_ &&
|
||||
return o->address_space_ == address_space_ && o->subtype_ == subtype_ &&
|
||||
o->access_ == access_;
|
||||
}
|
||||
return false;
|
||||
@@ -43,8 +43,8 @@ bool Pointer::Equals(const sem::Type& other) const {
|
||||
std::string Pointer::FriendlyName(const SymbolTable& symbols) const {
|
||||
std::ostringstream out;
|
||||
out << "ptr<";
|
||||
if (storage_class_ != ast::StorageClass::kNone) {
|
||||
out << storage_class_ << ", ";
|
||||
if (address_space_ != ast::AddressSpace::kNone) {
|
||||
out << address_space_ << ", ";
|
||||
}
|
||||
out << subtype_->FriendlyName(symbols) << ", " << access_;
|
||||
out << ">";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "src/tint/ast/access.h"
|
||||
#include "src/tint/ast/storage_class.h"
|
||||
#include "src/tint/ast/address_space.h"
|
||||
#include "src/tint/sem/type.h"
|
||||
|
||||
namespace tint::sem {
|
||||
@@ -28,9 +28,9 @@ class Pointer final : public Castable<Pointer, Type> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param subtype the pointee type
|
||||
/// @param storage_class the storage class of the pointer
|
||||
/// @param address_space the address space of the pointer
|
||||
/// @param access the resolved access control of the reference
|
||||
Pointer(const Type* subtype, ast::StorageClass storage_class, ast::Access access);
|
||||
Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access);
|
||||
|
||||
/// Move constructor
|
||||
Pointer(Pointer&&);
|
||||
@@ -46,8 +46,8 @@ class Pointer final : public Castable<Pointer, Type> {
|
||||
/// @returns the pointee type
|
||||
const Type* StoreType() const { return subtype_; }
|
||||
|
||||
/// @returns the storage class of the pointer
|
||||
ast::StorageClass StorageClass() const { return storage_class_; }
|
||||
/// @returns the address space of the pointer
|
||||
ast::AddressSpace AddressSpace() const { return address_space_; }
|
||||
|
||||
/// @returns the access control of the reference
|
||||
ast::Access Access() const { return access_; }
|
||||
@@ -59,7 +59,7 @@ class Pointer final : public Castable<Pointer, Type> {
|
||||
|
||||
private:
|
||||
Type const* const subtype_;
|
||||
ast::StorageClass const storage_class_;
|
||||
ast::AddressSpace const address_space_;
|
||||
ast::Access const access_;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace {
|
||||
using PointerTest = TestHelper;
|
||||
|
||||
TEST_F(PointerTest, Creation) {
|
||||
auto* a = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* b = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* c = create<Pointer>(create<F32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* d = create<Pointer>(create<I32>(), ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kRead);
|
||||
auto* a = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* b = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* c = create<Pointer>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* d = create<Pointer>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
|
||||
|
||||
EXPECT_TRUE(a->StoreType()->Is<sem::I32>());
|
||||
EXPECT_EQ(a->StorageClass(), ast::StorageClass::kStorage);
|
||||
EXPECT_EQ(a->AddressSpace(), ast::AddressSpace::kStorage);
|
||||
EXPECT_EQ(a->Access(), ast::Access::kReadWrite);
|
||||
|
||||
EXPECT_EQ(a, b);
|
||||
@@ -38,11 +38,11 @@ TEST_F(PointerTest, Creation) {
|
||||
}
|
||||
|
||||
TEST_F(PointerTest, Hash) {
|
||||
auto* a = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* b = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* c = create<Pointer>(create<F32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* d = create<Pointer>(create<I32>(), ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kRead);
|
||||
auto* a = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* b = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* c = create<Pointer>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* d = create<Pointer>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
|
||||
|
||||
EXPECT_EQ(a->Hash(), b->Hash());
|
||||
EXPECT_NE(a->Hash(), c->Hash());
|
||||
@@ -51,11 +51,11 @@ TEST_F(PointerTest, Hash) {
|
||||
}
|
||||
|
||||
TEST_F(PointerTest, Equals) {
|
||||
auto* a = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* b = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* c = create<Pointer>(create<F32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
auto* d = create<Pointer>(create<I32>(), ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Pointer>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kRead);
|
||||
auto* a = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* b = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* c = create<Pointer>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* d = create<Pointer>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Pointer>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
|
||||
|
||||
EXPECT_TRUE(a->Equals(*b));
|
||||
EXPECT_FALSE(a->Equals(*c));
|
||||
@@ -65,12 +65,12 @@ TEST_F(PointerTest, Equals) {
|
||||
}
|
||||
|
||||
TEST_F(PointerTest, FriendlyName) {
|
||||
auto* r = create<Pointer>(create<I32>(), ast::StorageClass::kNone, ast::Access::kRead);
|
||||
auto* r = create<Pointer>(create<I32>(), ast::AddressSpace::kNone, ast::Access::kRead);
|
||||
EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<i32, read>");
|
||||
}
|
||||
|
||||
TEST_F(PointerTest, FriendlyNameWithStorageClass) {
|
||||
auto* r = create<Pointer>(create<I32>(), ast::StorageClass::kWorkgroup, ast::Access::kRead);
|
||||
TEST_F(PointerTest, FriendlyNameWithAddressSpace) {
|
||||
auto* r = create<Pointer>(create<I32>(), ast::AddressSpace::kWorkgroup, ast::Access::kRead);
|
||||
EXPECT_EQ(r->FriendlyName(Symbols()), "ptr<workgroup, i32, read>");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,19 +21,19 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Reference);
|
||||
|
||||
namespace tint::sem {
|
||||
|
||||
Reference::Reference(const Type* subtype, ast::StorageClass storage_class, ast::Access access)
|
||||
: subtype_(subtype), storage_class_(storage_class), access_(access) {
|
||||
Reference::Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
|
||||
: subtype_(subtype), address_space_(address_space), access_(access) {
|
||||
TINT_ASSERT(Semantic, !subtype->Is<Reference>());
|
||||
TINT_ASSERT(Semantic, access != ast::Access::kUndefined);
|
||||
}
|
||||
|
||||
size_t Reference::Hash() const {
|
||||
return utils::Hash(TypeInfo::Of<Reference>().full_hashcode, storage_class_, subtype_, access_);
|
||||
return utils::Hash(TypeInfo::Of<Reference>().full_hashcode, address_space_, subtype_, access_);
|
||||
}
|
||||
|
||||
bool Reference::Equals(const sem::Type& other) const {
|
||||
if (auto* o = other.As<Reference>()) {
|
||||
return o->storage_class_ == storage_class_ && o->subtype_ == subtype_ &&
|
||||
return o->address_space_ == address_space_ && o->subtype_ == subtype_ &&
|
||||
o->access_ == access_;
|
||||
}
|
||||
return false;
|
||||
@@ -42,8 +42,8 @@ bool Reference::Equals(const sem::Type& other) const {
|
||||
std::string Reference::FriendlyName(const SymbolTable& symbols) const {
|
||||
std::ostringstream out;
|
||||
out << "ref<";
|
||||
if (storage_class_ != ast::StorageClass::kNone) {
|
||||
out << storage_class_ << ", ";
|
||||
if (address_space_ != ast::AddressSpace::kNone) {
|
||||
out << address_space_ << ", ";
|
||||
}
|
||||
out << subtype_->FriendlyName(symbols) << ", " << access_;
|
||||
out << ">";
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "src/tint/ast/access.h"
|
||||
#include "src/tint/ast/storage_class.h"
|
||||
#include "src/tint/ast/address_space.h"
|
||||
#include "src/tint/sem/type.h"
|
||||
|
||||
namespace tint::sem {
|
||||
@@ -28,9 +28,9 @@ class Reference final : public Castable<Reference, Type> {
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param subtype the pointee type
|
||||
/// @param storage_class the storage class of the reference
|
||||
/// @param address_space the address space of the reference
|
||||
/// @param access the resolved access control of the reference
|
||||
Reference(const Type* subtype, ast::StorageClass storage_class, ast::Access access);
|
||||
Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access);
|
||||
|
||||
/// Move constructor
|
||||
Reference(Reference&&);
|
||||
@@ -46,8 +46,8 @@ class Reference final : public Castable<Reference, Type> {
|
||||
/// @returns the pointee type
|
||||
const Type* StoreType() const { return subtype_; }
|
||||
|
||||
/// @returns the storage class of the reference
|
||||
ast::StorageClass StorageClass() const { return storage_class_; }
|
||||
/// @returns the address space of the reference
|
||||
ast::AddressSpace AddressSpace() const { return address_space_; }
|
||||
|
||||
/// @returns the resolved access control of the reference.
|
||||
ast::Access Access() const { return access_; }
|
||||
@@ -59,7 +59,7 @@ class Reference final : public Castable<Reference, Type> {
|
||||
|
||||
private:
|
||||
Type const* const subtype_;
|
||||
ast::StorageClass const storage_class_;
|
||||
ast::AddressSpace const address_space_;
|
||||
ast::Access const access_;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,17 +22,17 @@ using ReferenceTest = TestHelper;
|
||||
|
||||
TEST_F(ReferenceTest, Creation) {
|
||||
auto* a =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* b =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* c =
|
||||
create<Reference>(create<F32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* d =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kRead);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
|
||||
|
||||
EXPECT_TRUE(a->StoreType()->Is<sem::I32>());
|
||||
EXPECT_EQ(a->StorageClass(), ast::StorageClass::kStorage);
|
||||
EXPECT_EQ(a->AddressSpace(), ast::AddressSpace::kStorage);
|
||||
EXPECT_EQ(a->Access(), ast::Access::kReadWrite);
|
||||
|
||||
EXPECT_EQ(a, b);
|
||||
@@ -43,14 +43,14 @@ TEST_F(ReferenceTest, Creation) {
|
||||
|
||||
TEST_F(ReferenceTest, Hash) {
|
||||
auto* a =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* b =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* c =
|
||||
create<Reference>(create<F32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* d =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kRead);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
|
||||
|
||||
EXPECT_EQ(a->Hash(), b->Hash());
|
||||
EXPECT_NE(a->Hash(), c->Hash());
|
||||
@@ -60,14 +60,14 @@ TEST_F(ReferenceTest, Hash) {
|
||||
|
||||
TEST_F(ReferenceTest, Equals) {
|
||||
auto* a =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* b =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* c =
|
||||
create<Reference>(create<F32>(), ast::StorageClass::kStorage, ast::Access::kReadWrite);
|
||||
create<Reference>(create<F32>(), ast::AddressSpace::kStorage, ast::Access::kReadWrite);
|
||||
auto* d =
|
||||
create<Reference>(create<I32>(), ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Reference>(create<I32>(), ast::StorageClass::kStorage, ast::Access::kRead);
|
||||
create<Reference>(create<I32>(), ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
auto* e = create<Reference>(create<I32>(), ast::AddressSpace::kStorage, ast::Access::kRead);
|
||||
|
||||
EXPECT_TRUE(a->Equals(*b));
|
||||
EXPECT_FALSE(a->Equals(*c));
|
||||
@@ -77,12 +77,12 @@ TEST_F(ReferenceTest, Equals) {
|
||||
}
|
||||
|
||||
TEST_F(ReferenceTest, FriendlyName) {
|
||||
auto* r = create<Reference>(create<I32>(), ast::StorageClass::kNone, ast::Access::kRead);
|
||||
auto* r = create<Reference>(create<I32>(), ast::AddressSpace::kNone, ast::Access::kRead);
|
||||
EXPECT_EQ(r->FriendlyName(Symbols()), "ref<i32, read>");
|
||||
}
|
||||
|
||||
TEST_F(ReferenceTest, FriendlyNameWithStorageClass) {
|
||||
auto* r = create<Reference>(create<I32>(), ast::StorageClass::kWorkgroup, ast::Access::kRead);
|
||||
TEST_F(ReferenceTest, FriendlyNameWithAddressSpace) {
|
||||
auto* r = create<Reference>(create<I32>(), ast::AddressSpace::kWorkgroup, ast::Access::kRead);
|
||||
EXPECT_EQ(r->FriendlyName(Symbols()), "ref<workgroup, i32, read>");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "src/tint/ast/storage_class.h"
|
||||
#include "src/tint/ast/address_space.h"
|
||||
#include "src/tint/ast/struct.h"
|
||||
#include "src/tint/sem/node.h"
|
||||
#include "src/tint/sem/type.h"
|
||||
@@ -109,23 +109,23 @@ class Struct final : public Castable<Struct, Type> {
|
||||
/// alignment padding
|
||||
uint32_t SizeNoPadding() const { return size_no_padding_; }
|
||||
|
||||
/// Adds the StorageClass usage to the structure.
|
||||
/// Adds the AddressSpace usage to the structure.
|
||||
/// @param usage the storage usage
|
||||
void AddUsage(ast::StorageClass usage) { storage_class_usage_.emplace(usage); }
|
||||
void AddUsage(ast::AddressSpace usage) { address_space_usage_.emplace(usage); }
|
||||
|
||||
/// @returns the set of storage class uses of this structure
|
||||
const std::unordered_set<ast::StorageClass>& StorageClassUsage() const {
|
||||
return storage_class_usage_;
|
||||
/// @returns the set of address space uses of this structure
|
||||
const std::unordered_set<ast::AddressSpace>& AddressSpaceUsage() const {
|
||||
return address_space_usage_;
|
||||
}
|
||||
|
||||
/// @param usage the ast::StorageClass usage type to query
|
||||
/// @returns true iff this structure has been used as the given storage class
|
||||
bool UsedAs(ast::StorageClass usage) const { return storage_class_usage_.count(usage) > 0; }
|
||||
/// @param usage the ast::AddressSpace usage type to query
|
||||
/// @returns true iff this structure has been used as the given address space
|
||||
bool UsedAs(ast::AddressSpace usage) const { return address_space_usage_.count(usage) > 0; }
|
||||
|
||||
/// @returns true iff this structure has been used by storage class that's
|
||||
/// @returns true iff this structure has been used by address space that's
|
||||
/// host-shareable.
|
||||
bool IsHostShareable() const {
|
||||
for (auto sc : storage_class_usage_) {
|
||||
for (auto sc : address_space_usage_) {
|
||||
if (ast::IsHostShareable(sc)) {
|
||||
return true;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ class Struct final : public Castable<Struct, Type> {
|
||||
const uint32_t align_;
|
||||
const uint32_t size_;
|
||||
const uint32_t size_no_padding_;
|
||||
std::unordered_set<ast::StorageClass> storage_class_usage_;
|
||||
std::unordered_set<ast::AddressSpace> address_space_usage_;
|
||||
std::unordered_set<PipelineStageUsage> pipeline_stage_uses_;
|
||||
bool constructible_;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ struct TypeTest : public TestHelper {
|
||||
const sem::Matrix* mat4x3_f16 = create<Matrix>(vec3_f16, 4u);
|
||||
const sem::Matrix* mat4x3_af = create<Matrix>(vec3_af, 4u);
|
||||
const sem::Reference* ref_u32 =
|
||||
create<Reference>(u32, ast::StorageClass::kPrivate, ast::Access::kReadWrite);
|
||||
create<Reference>(u32, ast::AddressSpace::kPrivate, ast::Access::kReadWrite);
|
||||
const sem::Struct* str = create<Struct>(nullptr,
|
||||
Sym("s"),
|
||||
StructMemberList{
|
||||
|
||||
@@ -31,13 +31,13 @@ namespace tint::sem {
|
||||
Variable::Variable(const ast::Variable* declaration,
|
||||
const sem::Type* type,
|
||||
EvaluationStage stage,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const Constant* constant_value)
|
||||
: declaration_(declaration),
|
||||
type_(type),
|
||||
stage_(stage),
|
||||
storage_class_(storage_class),
|
||||
address_space_(address_space),
|
||||
access_(access),
|
||||
constant_value_(constant_value) {}
|
||||
|
||||
@@ -46,11 +46,11 @@ Variable::~Variable() = default;
|
||||
LocalVariable::LocalVariable(const ast::Variable* declaration,
|
||||
const sem::Type* type,
|
||||
EvaluationStage stage,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const sem::Statement* statement,
|
||||
const Constant* constant_value)
|
||||
: Base(declaration, type, stage, storage_class, access, constant_value),
|
||||
: Base(declaration, type, stage, address_space, access, constant_value),
|
||||
statement_(statement) {}
|
||||
|
||||
LocalVariable::~LocalVariable() = default;
|
||||
@@ -58,12 +58,12 @@ LocalVariable::~LocalVariable() = default;
|
||||
GlobalVariable::GlobalVariable(const ast::Variable* declaration,
|
||||
const sem::Type* type,
|
||||
EvaluationStage stage,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const Constant* constant_value,
|
||||
sem::BindingPoint binding_point,
|
||||
std::optional<uint32_t> location)
|
||||
: Base(declaration, type, stage, storage_class, access, constant_value),
|
||||
: Base(declaration, type, stage, address_space, access, constant_value),
|
||||
binding_point_(binding_point),
|
||||
location_(location) {}
|
||||
|
||||
@@ -72,12 +72,12 @@ GlobalVariable::~GlobalVariable() = default;
|
||||
Parameter::Parameter(const ast::Parameter* declaration,
|
||||
uint32_t index,
|
||||
const sem::Type* type,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const ParameterUsage usage /* = ParameterUsage::kNone */,
|
||||
sem::BindingPoint binding_point /* = {} */,
|
||||
std::optional<uint32_t> location /* = std::nullopt */)
|
||||
: Base(declaration, type, EvaluationStage::kRuntime, storage_class, access, nullptr),
|
||||
: Base(declaration, type, EvaluationStage::kRuntime, address_space, access, nullptr),
|
||||
index_(index),
|
||||
usage_(usage),
|
||||
binding_point_(binding_point),
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "tint/override_id.h"
|
||||
|
||||
#include "src/tint/ast/access.h"
|
||||
#include "src/tint/ast/storage_class.h"
|
||||
#include "src/tint/ast/address_space.h"
|
||||
#include "src/tint/sem/binding_point.h"
|
||||
#include "src/tint/sem/expression.h"
|
||||
#include "src/tint/sem/parameter_usage.h"
|
||||
@@ -49,13 +49,13 @@ class Variable : public Castable<Variable, Node> {
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param type the variable type
|
||||
/// @param stage the evaluation stage for an expression of this variable type
|
||||
/// @param storage_class the variable storage class
|
||||
/// @param address_space the variable address space
|
||||
/// @param access the variable access control type
|
||||
/// @param constant_value the constant value for the variable. May be null
|
||||
Variable(const ast::Variable* declaration,
|
||||
const sem::Type* type,
|
||||
EvaluationStage stage,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const Constant* constant_value);
|
||||
|
||||
@@ -71,8 +71,8 @@ class Variable : public Castable<Variable, Node> {
|
||||
/// @returns the evaluation stage for an expression of this variable type
|
||||
EvaluationStage Stage() const { return stage_; }
|
||||
|
||||
/// @returns the storage class for the variable
|
||||
ast::StorageClass StorageClass() const { return storage_class_; }
|
||||
/// @returns the address space for the variable
|
||||
ast::AddressSpace AddressSpace() const { return address_space_; }
|
||||
|
||||
/// @returns the access control for the variable
|
||||
ast::Access Access() const { return access_; }
|
||||
@@ -98,7 +98,7 @@ class Variable : public Castable<Variable, Node> {
|
||||
const ast::Variable* const declaration_;
|
||||
const sem::Type* const type_;
|
||||
const EvaluationStage stage_;
|
||||
const ast::StorageClass storage_class_;
|
||||
const ast::AddressSpace address_space_;
|
||||
const ast::Access access_;
|
||||
const Constant* constant_value_;
|
||||
const Expression* constructor_ = nullptr;
|
||||
@@ -112,14 +112,14 @@ class LocalVariable final : public Castable<LocalVariable, Variable> {
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param type the variable type
|
||||
/// @param stage the evaluation stage for an expression of this variable type
|
||||
/// @param storage_class the variable storage class
|
||||
/// @param address_space the variable address space
|
||||
/// @param access the variable access control type
|
||||
/// @param statement the statement that declared this local variable
|
||||
/// @param constant_value the constant value for the variable. May be null
|
||||
LocalVariable(const ast::Variable* declaration,
|
||||
const sem::Type* type,
|
||||
EvaluationStage stage,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const sem::Statement* statement,
|
||||
const Constant* constant_value);
|
||||
@@ -149,7 +149,7 @@ class GlobalVariable final : public Castable<GlobalVariable, Variable> {
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param type the variable type
|
||||
/// @param stage the evaluation stage for an expression of this variable type
|
||||
/// @param storage_class the variable storage class
|
||||
/// @param address_space the variable address space
|
||||
/// @param access the variable access control type
|
||||
/// @param constant_value the constant value for the variable. May be null
|
||||
/// @param binding_point the optional resource binding point of the variable
|
||||
@@ -160,7 +160,7 @@ class GlobalVariable final : public Castable<GlobalVariable, Variable> {
|
||||
GlobalVariable(const ast::Variable* declaration,
|
||||
const sem::Type* type,
|
||||
EvaluationStage stage,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const Constant* constant_value,
|
||||
sem::BindingPoint binding_point = {},
|
||||
@@ -195,7 +195,7 @@ class Parameter final : public Castable<Parameter, Variable> {
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param index the index of the parmeter in the function
|
||||
/// @param type the variable type
|
||||
/// @param storage_class the variable storage class
|
||||
/// @param address_space the variable address space
|
||||
/// @param access the variable access control type
|
||||
/// @param usage the semantic usage for the parameter
|
||||
/// @param binding_point the optional resource binding point of the parameter
|
||||
@@ -203,7 +203,7 @@ class Parameter final : public Castable<Parameter, Variable> {
|
||||
Parameter(const ast::Parameter* declaration,
|
||||
uint32_t index,
|
||||
const sem::Type* type,
|
||||
ast::StorageClass storage_class,
|
||||
ast::AddressSpace address_space,
|
||||
ast::Access access,
|
||||
const ParameterUsage usage = ParameterUsage::kNone,
|
||||
sem::BindingPoint binding_point = {},
|
||||
|
||||
Reference in New Issue
Block a user