mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
Remove sem::AccessControl
In preparation for implementing https://github.com/gpuweb/gpuweb/issues/1604, this change removes the sem::AccessControl node. Instead, the ast::AccessControl::Access enum is now on the sem::StorageTexture class, as well as on sem::Variable. For sem::Variable, the field is set when the variable's type is either a storage buffer or a storage texture. Bug: tint:802 Change-Id: Id479af36b401d067b015027923f4e715f5f69f25 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51020 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
31d761329a
commit
dc4e6c1844
@@ -37,6 +37,9 @@ AccessControl::~AccessControl() = default;
|
||||
std::string AccessControl::type_name() const {
|
||||
std::string name = "__access_control_";
|
||||
switch (access_) {
|
||||
case ast::AccessControl::kInvalid:
|
||||
name += "invalid";
|
||||
break;
|
||||
case ast::AccessControl::kReadOnly:
|
||||
name += "read_only";
|
||||
break;
|
||||
@@ -54,6 +57,9 @@ std::string AccessControl::FriendlyName(const SymbolTable& symbols) const {
|
||||
std::ostringstream out;
|
||||
out << "[[access(";
|
||||
switch (access_) {
|
||||
case ast::AccessControl::kInvalid:
|
||||
out << "invalid";
|
||||
break;
|
||||
case ast::AccessControl::kReadOnly:
|
||||
out << "read";
|
||||
break;
|
||||
@@ -77,6 +83,10 @@ AccessControl* AccessControl::Clone(CloneContext* ctx) const {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, AccessControl::Access access) {
|
||||
switch (access) {
|
||||
case ast::AccessControl::kInvalid: {
|
||||
out << "invalid";
|
||||
break;
|
||||
}
|
||||
case ast::AccessControl::kReadOnly: {
|
||||
out << "read_only";
|
||||
break;
|
||||
|
||||
@@ -28,8 +28,11 @@ class AccessControl : public Castable<AccessControl, Type> {
|
||||
public:
|
||||
/// The access control settings
|
||||
enum Access {
|
||||
/// Invalid
|
||||
// TODO(crbug.com/tint/805): Remove this.
|
||||
kInvalid = -1,
|
||||
/// Read only
|
||||
kReadOnly = 0,
|
||||
kReadOnly,
|
||||
/// Write only
|
||||
kWriteOnly,
|
||||
/// Read write
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "src/ast/intrinsic_texture_helper_test.h"
|
||||
|
||||
#include "src/sem/access_control_type.h"
|
||||
#include "src/sem/depth_texture_type.h"
|
||||
#include "src/sem/multisampled_texture_type.h"
|
||||
#include "src/sem/sampled_texture_type.h"
|
||||
@@ -173,7 +172,7 @@ ast::Variable* TextureOverloadCase::buildTextureVariable(
|
||||
|
||||
case ast::intrinsic::test::TextureKind::kStorage: {
|
||||
auto st = b->ty.storage_texture(texture_dimension, image_format);
|
||||
auto ac = b->ty.access(access_control, st);
|
||||
auto* ac = b->ty.access(access_control, st);
|
||||
return b->Global("texture", ac, ast::StorageClass::kNone, nullptr, decos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ Variable::Variable(ProgramID program_id,
|
||||
const Source& source,
|
||||
const Symbol& sym,
|
||||
StorageClass declared_storage_class,
|
||||
ast::Type* type,
|
||||
const ast::Type* type,
|
||||
bool is_const,
|
||||
Expression* constructor,
|
||||
DecorationList decorations)
|
||||
|
||||
@@ -109,7 +109,7 @@ class Variable : public Castable<Variable, Node> {
|
||||
const Source& source,
|
||||
const Symbol& sym,
|
||||
StorageClass declared_storage_class,
|
||||
ast::Type* type,
|
||||
const ast::Type* type,
|
||||
bool is_const,
|
||||
Expression* constructor,
|
||||
DecorationList decorations);
|
||||
@@ -122,7 +122,7 @@ class Variable : public Castable<Variable, Node> {
|
||||
const Symbol& symbol() const { return symbol_; }
|
||||
|
||||
/// @returns the variable type
|
||||
ast::Type* type() const { return type_; }
|
||||
ast::Type* type() const { return const_cast<ast::Type*>(type_); }
|
||||
|
||||
/// @returns the declared storage class
|
||||
StorageClass declared_storage_class() const {
|
||||
@@ -177,7 +177,7 @@ class Variable : public Castable<Variable, Node> {
|
||||
|
||||
Symbol const symbol_;
|
||||
// The value type if a const or formal paramter, and the store type if a var
|
||||
ast::Type* const type_;
|
||||
ast::Type const* const type_;
|
||||
bool const is_const_;
|
||||
Expression* const constructor_;
|
||||
DecorationList const decorations_;
|
||||
|
||||
Reference in New Issue
Block a user