ast::AccessControl: Remove 'Only' suffix from enums

As requested in:
https://dawn-review.googlesource.com/c/tint/+/52503/1..3/src/intrinsics.def#38

Bug: tint:832
Change-Id: I88881d0654305cdbc6c05256e227a3b048fbff29
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52640
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton 2021-05-31 19:40:30 +00:00 committed by Tint LUCI CQ
parent 3264765bc2
commit 646f4a9958
37 changed files with 173 additions and 179 deletions

View File

@ -37,10 +37,10 @@ AccessControl::~AccessControl() = default;
std::string AccessControl::type_name() const { std::string AccessControl::type_name() const {
std::string name = "__access_control_"; std::string name = "__access_control_";
switch (access_) { switch (access_) {
case ast::AccessControl::kReadOnly: case ast::AccessControl::kRead:
name += "read_only"; name += "read_only";
break; break;
case ast::AccessControl::kWriteOnly: case ast::AccessControl::kWrite:
name += "write_only"; name += "write_only";
break; break;
case ast::AccessControl::kReadWrite: case ast::AccessControl::kReadWrite:
@ -54,10 +54,10 @@ std::string AccessControl::FriendlyName(const SymbolTable& symbols) const {
std::ostringstream out; std::ostringstream out;
out << "[[access("; out << "[[access(";
switch (access_) { switch (access_) {
case ast::AccessControl::kReadOnly: case ast::AccessControl::kRead:
out << "read"; out << "read";
break; break;
case ast::AccessControl::kWriteOnly: case ast::AccessControl::kWrite:
out << "write"; out << "write";
break; break;
case ast::AccessControl::kReadWrite: case ast::AccessControl::kReadWrite:
@ -77,7 +77,7 @@ AccessControl* AccessControl::Clone(CloneContext* ctx) const {
std::ostream& operator<<(std::ostream& out, AccessControl::Access access) { std::ostream& operator<<(std::ostream& out, AccessControl::Access access) {
switch (access) { switch (access) {
case ast::AccessControl::kReadOnly: { case ast::AccessControl::kRead: {
out << "read_only"; out << "read_only";
break; break;
} }
@ -85,7 +85,7 @@ std::ostream& operator<<(std::ostream& out, AccessControl::Access access) {
out << "read_write"; out << "read_write";
break; break;
} }
case ast::AccessControl::kWriteOnly: { case ast::AccessControl::kWrite: {
out << "write_only"; out << "write_only";
break; break;
} }

View File

@ -29,9 +29,9 @@ class AccessControl : public Castable<AccessControl, Type> {
/// The access control settings /// The access control settings
enum Access { enum Access {
/// Read only /// Read only
kReadOnly, kRead,
/// Write only /// Write only
kWriteOnly, kWrite,
/// Read write /// Read write
kReadWrite kReadWrite
}; };
@ -50,9 +50,9 @@ class AccessControl : public Castable<AccessControl, Type> {
~AccessControl() override; ~AccessControl() override;
/// @returns true if the access control is read only /// @returns true if the access control is read only
bool IsReadOnly() const { return access_ == Access::kReadOnly; } bool IsReadOnly() const { return access_ == Access::kRead; }
/// @returns true if the access control is write only /// @returns true if the access control is write only
bool IsWriteOnly() const { return access_ == Access::kWriteOnly; } bool IsWriteOnly() const { return access_ == Access::kWrite; }
/// @returns true if the access control is read/write /// @returns true if the access control is read/write
bool IsReadWrite() const { return access_ == Access::kReadWrite; } bool IsReadWrite() const { return access_ == Access::kReadWrite; }

View File

@ -43,7 +43,7 @@ TEST_F(AstAccessControlTest, Create) {
TEST_F(AstAccessControlTest, AccessRead) { TEST_F(AstAccessControlTest, AccessRead) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* ac = create<AccessControl>(AccessControl::kReadOnly, i32); auto* ac = create<AccessControl>(AccessControl::kRead, i32);
EXPECT_TRUE(ac->IsReadOnly()); EXPECT_TRUE(ac->IsReadOnly());
EXPECT_FALSE(ac->IsWriteOnly()); EXPECT_FALSE(ac->IsWriteOnly());
EXPECT_FALSE(ac->IsReadWrite()); EXPECT_FALSE(ac->IsReadWrite());
@ -53,7 +53,7 @@ TEST_F(AstAccessControlTest, AccessRead) {
TEST_F(AstAccessControlTest, AccessWrite) { TEST_F(AstAccessControlTest, AccessWrite) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* ac = create<AccessControl>(AccessControl::kWriteOnly, i32); auto* ac = create<AccessControl>(AccessControl::kWrite, i32);
EXPECT_FALSE(ac->IsReadOnly()); EXPECT_FALSE(ac->IsReadOnly());
EXPECT_TRUE(ac->IsWriteOnly()); EXPECT_TRUE(ac->IsWriteOnly());
EXPECT_FALSE(ac->IsReadWrite()); EXPECT_FALSE(ac->IsReadWrite());
@ -73,13 +73,13 @@ TEST_F(AstAccessControlTest, AccessReadWrite) {
TEST_F(AstAccessControlTest, FriendlyNameReadOnly) { TEST_F(AstAccessControlTest, FriendlyNameReadOnly) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* ac = create<AccessControl>(AccessControl::kReadOnly, i32); auto* ac = create<AccessControl>(AccessControl::kRead, i32);
EXPECT_EQ(ac->FriendlyName(Symbols()), "[[access(read)]] i32"); EXPECT_EQ(ac->FriendlyName(Symbols()), "[[access(read)]] i32");
} }
TEST_F(AstAccessControlTest, FriendlyNameWriteOnly) { TEST_F(AstAccessControlTest, FriendlyNameWriteOnly) {
auto* i32 = create<I32>(); auto* i32 = create<I32>();
auto* ac = create<AccessControl>(AccessControl::kWriteOnly, i32); auto* ac = create<AccessControl>(AccessControl::kWrite, i32);
EXPECT_EQ(ac->FriendlyName(Symbols()), "[[access(write)]] i32"); EXPECT_EQ(ac->FriendlyName(Symbols()), "[[access(write)]] i32");
} }

View File

@ -23,12 +23,12 @@ namespace {
using AccessDecorationTest = TestHelper; using AccessDecorationTest = TestHelper;
TEST_F(AccessDecorationTest, Creation) { TEST_F(AccessDecorationTest, Creation) {
auto* d = create<AccessDecoration>(ast::AccessControl::kWriteOnly); auto* d = create<AccessDecoration>(ast::AccessControl::kWrite);
EXPECT_EQ(ast::AccessControl::kWriteOnly, d->value()); EXPECT_EQ(ast::AccessControl::kWrite, d->value());
} }
TEST_F(AccessDecorationTest, ToStr) { TEST_F(AccessDecorationTest, ToStr) {
auto* d = create<AccessDecoration>(ast::AccessControl::kReadOnly); auto* d = create<AccessDecoration>(ast::AccessControl::kRead);
EXPECT_EQ(str(d), R"(AccessDecoration{read_only} EXPECT_EQ(str(d), R"(AccessDecoration{read_only}
)"); )");
} }

View File

@ -78,7 +78,7 @@ TEST_F(AstAliasTest, UnwrapAll_TwiceAliasPointerTwiceAlias) {
TEST_F(AstAliasTest, UnwrapAll_AccessControlPointer) { TEST_F(AstAliasTest, UnwrapAll_AccessControlPointer) {
auto* u32 = create<U32>(); auto* u32 = create<U32>();
auto* a = create<AccessControl>(AccessControl::kReadOnly, u32); auto* a = create<AccessControl>(AccessControl::kRead, u32);
auto* pa = create<Pointer>(a, StorageClass::kUniform); auto* pa = create<Pointer>(a, StorageClass::kUniform);
EXPECT_EQ(pa->type(), a); EXPECT_EQ(pa->type(), a);
EXPECT_EQ(pa->UnwrapAll(), u32); EXPECT_EQ(pa->UnwrapAll(), u32);
@ -87,7 +87,7 @@ TEST_F(AstAliasTest, UnwrapAll_AccessControlPointer) {
TEST_F(AstAliasTest, UnwrapAll_PointerAccessControl) { TEST_F(AstAliasTest, UnwrapAll_PointerAccessControl) {
auto* u32 = create<U32>(); auto* u32 = create<U32>();
auto* p = create<Pointer>(u32, StorageClass::kUniform); auto* p = create<Pointer>(u32, StorageClass::kUniform);
auto* a = create<AccessControl>(AccessControl::kReadOnly, p); auto* a = create<AccessControl>(AccessControl::kRead, p);
EXPECT_EQ(a->type(), p); EXPECT_EQ(a->type(), p);
EXPECT_EQ(a->UnwrapAll(), u32); EXPECT_EQ(a->UnwrapAll(), u32);

View File

@ -405,7 +405,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
{ {
ValidTextureOverload::kDimensionsStorageRO1d, ValidTextureOverload::kDimensionsStorageRO1d,
"textureDimensions(t : texture_storage_1d<rgba32float>) -> i32", "textureDimensions(t : texture_storage_1d<rgba32float>) -> i32",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k1d, ast::TextureDimension::k1d,
TextureDataType::kF32, TextureDataType::kF32,
@ -416,7 +416,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kDimensionsStorageRO2d, ValidTextureOverload::kDimensionsStorageRO2d,
"textureDimensions(t : texture_storage_2d<rgba32float>) -> " "textureDimensions(t : texture_storage_2d<rgba32float>) -> "
"vec2<i32>", "vec2<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -427,7 +427,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kDimensionsStorageRO2dArray, ValidTextureOverload::kDimensionsStorageRO2dArray,
"textureDimensions(t : texture_storage_2d_array<rgba32float>) -> " "textureDimensions(t : texture_storage_2d_array<rgba32float>) -> "
"vec2<i32>", "vec2<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2dArray, ast::TextureDimension::k2dArray,
TextureDataType::kF32, TextureDataType::kF32,
@ -438,7 +438,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kDimensionsStorageRO3d, ValidTextureOverload::kDimensionsStorageRO3d,
"textureDimensions(t : texture_storage_3d<rgba32float>) -> " "textureDimensions(t : texture_storage_3d<rgba32float>) -> "
"vec3<i32>", "vec3<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k3d, ast::TextureDimension::k3d,
TextureDataType::kF32, TextureDataType::kF32,
@ -448,7 +448,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
{ {
ValidTextureOverload::kDimensionsStorageWO1d, ValidTextureOverload::kDimensionsStorageWO1d,
"textureDimensions(t : texture_storage_1d<rgba32float>) -> i32", "textureDimensions(t : texture_storage_1d<rgba32float>) -> i32",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k1d, ast::TextureDimension::k1d,
TextureDataType::kF32, TextureDataType::kF32,
@ -459,7 +459,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kDimensionsStorageWO2d, ValidTextureOverload::kDimensionsStorageWO2d,
"textureDimensions(t : texture_storage_2d<rgba32float>) -> " "textureDimensions(t : texture_storage_2d<rgba32float>) -> "
"vec2<i32>", "vec2<i32>",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -470,7 +470,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kDimensionsStorageWO2dArray, ValidTextureOverload::kDimensionsStorageWO2dArray,
"textureDimensions(t : texture_storage_2d_array<rgba32float>) -> " "textureDimensions(t : texture_storage_2d_array<rgba32float>) -> "
"vec2<i32>", "vec2<i32>",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2dArray, ast::TextureDimension::k2dArray,
TextureDataType::kF32, TextureDataType::kF32,
@ -481,7 +481,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kDimensionsStorageWO3d, ValidTextureOverload::kDimensionsStorageWO3d,
"textureDimensions(t : texture_storage_3d<rgba32float>) -> " "textureDimensions(t : texture_storage_3d<rgba32float>) -> "
"vec3<i32>", "vec3<i32>",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k3d, ast::TextureDimension::k3d,
TextureDataType::kF32, TextureDataType::kF32,
@ -531,7 +531,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
{ {
ValidTextureOverload::kNumLayersStorageWO2dArray, ValidTextureOverload::kNumLayersStorageWO2dArray,
"textureNumLayers(t : texture_storage_2d_array<rgba32float>) -> i32", "textureNumLayers(t : texture_storage_2d_array<rgba32float>) -> i32",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2dArray, ast::TextureDimension::k2dArray,
TextureDataType::kF32, TextureDataType::kF32,
@ -1887,7 +1887,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO1dRgba32float, ValidTextureOverload::kLoadStorageRO1dRgba32float,
"textureLoad(t : texture_storage_1d<rgba32float>,\n" "textureLoad(t : texture_storage_1d<rgba32float>,\n"
" coords : i32) -> vec4<f32>", " coords : i32) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k1d, ast::TextureDimension::k1d,
TextureDataType::kF32, TextureDataType::kF32,
@ -1901,7 +1901,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba8unorm, ValidTextureOverload::kLoadStorageRO2dRgba8unorm,
"textureLoad(t : texture_storage_2d<rgba8unorm>,\n" "textureLoad(t : texture_storage_2d<rgba8unorm>,\n"
" coords : vec2<i32>) -> vec4<f32>", " coords : vec2<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba8Unorm, ast::ImageFormat::kRgba8Unorm,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -1915,7 +1915,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba8snorm, ValidTextureOverload::kLoadStorageRO2dRgba8snorm,
"textureLoad(t : texture_storage_2d<rgba8snorm>,\n" "textureLoad(t : texture_storage_2d<rgba8snorm>,\n"
" coords : vec2<i32>) -> vec4<f32>", " coords : vec2<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba8Snorm, ast::ImageFormat::kRgba8Snorm,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -1929,7 +1929,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba8uint, ValidTextureOverload::kLoadStorageRO2dRgba8uint,
"textureLoad(t : texture_storage_2d<rgba8uint>,\n" "textureLoad(t : texture_storage_2d<rgba8uint>,\n"
" coords : vec2<i32>) -> vec4<u32>", " coords : vec2<i32>) -> vec4<u32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba8Uint, ast::ImageFormat::kRgba8Uint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kU32, TextureDataType::kU32,
@ -1943,7 +1943,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba8sint, ValidTextureOverload::kLoadStorageRO2dRgba8sint,
"textureLoad(t : texture_storage_2d<rgba8sint>,\n" "textureLoad(t : texture_storage_2d<rgba8sint>,\n"
" coords : vec2<i32>) -> vec4<i32>", " coords : vec2<i32>) -> vec4<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba8Sint, ast::ImageFormat::kRgba8Sint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kI32, TextureDataType::kI32,
@ -1957,7 +1957,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba16uint, ValidTextureOverload::kLoadStorageRO2dRgba16uint,
"textureLoad(t : texture_storage_2d<rgba16uint>,\n" "textureLoad(t : texture_storage_2d<rgba16uint>,\n"
" coords : vec2<i32>) -> vec4<u32>", " coords : vec2<i32>) -> vec4<u32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba16Uint, ast::ImageFormat::kRgba16Uint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kU32, TextureDataType::kU32,
@ -1971,7 +1971,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba16sint, ValidTextureOverload::kLoadStorageRO2dRgba16sint,
"textureLoad(t : texture_storage_2d<rgba16sint>,\n" "textureLoad(t : texture_storage_2d<rgba16sint>,\n"
" coords : vec2<i32>) -> vec4<i32>", " coords : vec2<i32>) -> vec4<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba16Sint, ast::ImageFormat::kRgba16Sint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kI32, TextureDataType::kI32,
@ -1985,7 +1985,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba16float, ValidTextureOverload::kLoadStorageRO2dRgba16float,
"textureLoad(t : texture_storage_2d<rgba16float>,\n" "textureLoad(t : texture_storage_2d<rgba16float>,\n"
" coords : vec2<i32>) -> vec4<f32>", " coords : vec2<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba16Float, ast::ImageFormat::kRgba16Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -1999,7 +1999,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dR32uint, ValidTextureOverload::kLoadStorageRO2dR32uint,
"textureLoad(t : texture_storage_2d<r32uint>,\n" "textureLoad(t : texture_storage_2d<r32uint>,\n"
" coords : vec2<i32>) -> vec4<u32>", " coords : vec2<i32>) -> vec4<u32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kR32Uint, ast::ImageFormat::kR32Uint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kU32, TextureDataType::kU32,
@ -2013,7 +2013,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dR32sint, ValidTextureOverload::kLoadStorageRO2dR32sint,
"textureLoad(t : texture_storage_2d<r32sint>,\n" "textureLoad(t : texture_storage_2d<r32sint>,\n"
" coords : vec2<i32>) -> vec4<i32>", " coords : vec2<i32>) -> vec4<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kR32Sint, ast::ImageFormat::kR32Sint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kI32, TextureDataType::kI32,
@ -2027,7 +2027,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dR32float, ValidTextureOverload::kLoadStorageRO2dR32float,
"textureLoad(t : texture_storage_2d<r32float>,\n" "textureLoad(t : texture_storage_2d<r32float>,\n"
" coords : vec2<i32>) -> vec4<f32>", " coords : vec2<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kR32Float, ast::ImageFormat::kR32Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -2041,7 +2041,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRg32uint, ValidTextureOverload::kLoadStorageRO2dRg32uint,
"textureLoad(t : texture_storage_2d<rg32uint>,\n" "textureLoad(t : texture_storage_2d<rg32uint>,\n"
" coords : vec2<i32>) -> vec4<u32>", " coords : vec2<i32>) -> vec4<u32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRg32Uint, ast::ImageFormat::kRg32Uint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kU32, TextureDataType::kU32,
@ -2055,7 +2055,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRg32sint, ValidTextureOverload::kLoadStorageRO2dRg32sint,
"textureLoad(t : texture_storage_2d<rg32sint>,\n" "textureLoad(t : texture_storage_2d<rg32sint>,\n"
" coords : vec2<i32>) -> vec4<i32>", " coords : vec2<i32>) -> vec4<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRg32Sint, ast::ImageFormat::kRg32Sint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kI32, TextureDataType::kI32,
@ -2069,7 +2069,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRg32float, ValidTextureOverload::kLoadStorageRO2dRg32float,
"textureLoad(t : texture_storage_2d<rg32float>,\n" "textureLoad(t : texture_storage_2d<rg32float>,\n"
" coords : vec2<i32>) -> vec4<f32>", " coords : vec2<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRg32Float, ast::ImageFormat::kRg32Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -2083,7 +2083,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba32uint, ValidTextureOverload::kLoadStorageRO2dRgba32uint,
"textureLoad(t : texture_storage_2d<rgba32uint>,\n" "textureLoad(t : texture_storage_2d<rgba32uint>,\n"
" coords : vec2<i32>) -> vec4<u32>", " coords : vec2<i32>) -> vec4<u32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Uint, ast::ImageFormat::kRgba32Uint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kU32, TextureDataType::kU32,
@ -2097,7 +2097,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba32sint, ValidTextureOverload::kLoadStorageRO2dRgba32sint,
"textureLoad(t : texture_storage_2d<rgba32sint>,\n" "textureLoad(t : texture_storage_2d<rgba32sint>,\n"
" coords : vec2<i32>) -> vec4<i32>", " coords : vec2<i32>) -> vec4<i32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Sint, ast::ImageFormat::kRgba32Sint,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kI32, TextureDataType::kI32,
@ -2111,7 +2111,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO2dRgba32float, ValidTextureOverload::kLoadStorageRO2dRgba32float,
"textureLoad(t : texture_storage_2d<rgba32float>,\n" "textureLoad(t : texture_storage_2d<rgba32float>,\n"
" coords : vec2<i32>) -> vec4<f32>", " coords : vec2<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -2127,7 +2127,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
"texture_storage_2d_array<rgba32float>,\n" "texture_storage_2d_array<rgba32float>,\n"
" coords : vec2<i32>,\n" " coords : vec2<i32>,\n"
" array_index : i32) -> vec4<f32>", " array_index : i32) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2dArray, ast::TextureDimension::k2dArray,
TextureDataType::kF32, TextureDataType::kF32,
@ -2142,7 +2142,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
ValidTextureOverload::kLoadStorageRO3dRgba32float, ValidTextureOverload::kLoadStorageRO3dRgba32float,
"textureLoad(t : texture_storage_3d<rgba32float>,\n" "textureLoad(t : texture_storage_3d<rgba32float>,\n"
" coords : vec3<i32>) -> vec4<f32>", " coords : vec3<i32>) -> vec4<f32>",
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k3d, ast::TextureDimension::k3d,
TextureDataType::kF32, TextureDataType::kF32,
@ -2157,7 +2157,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
"textureStore(t : texture_storage_1d<rgba32float>,\n" "textureStore(t : texture_storage_1d<rgba32float>,\n"
" coords : i32,\n" " coords : i32,\n"
" value : vec4<T>)", " value : vec4<T>)",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k1d, ast::TextureDimension::k1d,
TextureDataType::kF32, TextureDataType::kF32,
@ -2173,7 +2173,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
"textureStore(t : texture_storage_2d<rgba32float>,\n" "textureStore(t : texture_storage_2d<rgba32float>,\n"
" coords : vec2<i32>,\n" " coords : vec2<i32>,\n"
" value : vec4<T>)", " value : vec4<T>)",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
TextureDataType::kF32, TextureDataType::kF32,
@ -2190,7 +2190,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
" coords : vec2<i32>,\n" " coords : vec2<i32>,\n"
" array_index : i32,\n" " array_index : i32,\n"
" value : vec4<T>)", " value : vec4<T>)",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k2dArray, ast::TextureDimension::k2dArray,
TextureDataType::kF32, TextureDataType::kF32,
@ -2207,7 +2207,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
"textureStore(t : texture_storage_3d<rgba32float>,\n" "textureStore(t : texture_storage_3d<rgba32float>,\n"
" coords : vec3<i32>,\n" " coords : vec3<i32>,\n"
" value : vec4<T>)", " value : vec4<T>)",
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
ast::ImageFormat::kRgba32Float, ast::ImageFormat::kRgba32Float,
ast::TextureDimension::k3d, ast::TextureDimension::k3d,
TextureDataType::kF32, TextureDataType::kF32,

View File

@ -641,7 +641,7 @@ std::vector<ResourceBinding> Inspector::GetStorageBufferResourceBindingsImpl(
auto* var = rsv.first; auto* var = rsv.first;
auto binding_info = rsv.second; auto binding_info = rsv.second;
if (read_only != (var->AccessControl() == ast::AccessControl::kReadOnly)) { if (read_only != (var->AccessControl() == ast::AccessControl::kRead)) {
continue; continue;
} }
@ -724,7 +724,7 @@ std::vector<ResourceBinding> Inspector::GetStorageTextureResourceBindingsImpl(
auto* texture_type = var->Type()->UnwrapRef()->As<sem::StorageTexture>(); auto* texture_type = var->Type()->UnwrapRef()->As<sem::StorageTexture>();
if (read_only != if (read_only !=
(texture_type->access_control() == ast::AccessControl::kReadOnly)) { (texture_type->access_control() == ast::AccessControl::kRead)) {
continue; continue;
} }

View File

@ -256,7 +256,7 @@ class InspectorHelper : public ProgramBuilder {
std::vector<ast::Type*> member_types) { std::vector<ast::Type*> member_types) {
MakeStructType(name, member_types, true); MakeStructType(name, member_types, true);
return [this, name] { return [this, name] {
return ty.access(ast::AccessControl::kReadOnly, ty.type_name(name)); return ty.access(ast::AccessControl::kRead, ty.type_name(name));
}; };
} }
@ -575,8 +575,8 @@ class InspectorHelper : public ProgramBuilder {
ast::Type* MakeStorageTextureTypes(ast::TextureDimension dim, ast::Type* MakeStorageTextureTypes(ast::TextureDimension dim,
ast::ImageFormat format, ast::ImageFormat format,
bool read_only) { bool read_only) {
auto ac = read_only ? ast::AccessControl::kReadOnly auto ac =
: ast::AccessControl::kWriteOnly; read_only ? ast::AccessControl::kRead : ast::AccessControl::kWrite;
auto* tex = ty.storage_texture(dim, format); auto* tex = ty.storage_texture(dim, format);
return ty.access(ac, tex); return ty.access(ac, tex);

View File

@ -1126,22 +1126,21 @@ Impl::Impl() {
auto* tex_storage_3d_FT = auto* tex_storage_3d_FT =
storage_texture(Dim::k3d, OpenNumber::A, OpenNumber::F, OpenType::T); storage_texture(Dim::k3d, OpenNumber::A, OpenNumber::F, OpenType::T);
auto* tex_storage_ro_1d_FT = storage_texture( auto* tex_storage_ro_1d_FT = storage_texture(
Dim::k1d, ast::AccessControl::kReadOnly, OpenNumber::F, OpenType::T); Dim::k1d, ast::AccessControl::kRead, OpenNumber::F, OpenType::T);
auto* tex_storage_ro_2d_FT = storage_texture( auto* tex_storage_ro_2d_FT = storage_texture(
Dim::k2d, ast::AccessControl::kReadOnly, OpenNumber::F, OpenType::T); Dim::k2d, ast::AccessControl::kRead, OpenNumber::F, OpenType::T);
auto* tex_storage_ro_2d_array_FT = storage_texture( auto* tex_storage_ro_2d_array_FT = storage_texture(
Dim::k2dArray, ast::AccessControl::kReadOnly, OpenNumber::F, OpenType::T); Dim::k2dArray, ast::AccessControl::kRead, OpenNumber::F, OpenType::T);
auto* tex_storage_ro_3d_FT = storage_texture( auto* tex_storage_ro_3d_FT = storage_texture(
Dim::k3d, ast::AccessControl::kReadOnly, OpenNumber::F, OpenType::T); Dim::k3d, ast::AccessControl::kRead, OpenNumber::F, OpenType::T);
auto* tex_storage_wo_1d_FT = storage_texture( auto* tex_storage_wo_1d_FT = storage_texture(
Dim::k1d, ast::AccessControl::kWriteOnly, OpenNumber::F, OpenType::T); Dim::k1d, ast::AccessControl::kWrite, OpenNumber::F, OpenType::T);
auto* tex_storage_wo_2d_FT = storage_texture( auto* tex_storage_wo_2d_FT = storage_texture(
Dim::k2d, ast::AccessControl::kWriteOnly, OpenNumber::F, OpenType::T); Dim::k2d, ast::AccessControl::kWrite, OpenNumber::F, OpenType::T);
auto* tex_storage_wo_2d_array_FT = auto* tex_storage_wo_2d_array_FT = storage_texture(
storage_texture(Dim::k2dArray, ast::AccessControl::kWriteOnly, Dim::k2dArray, ast::AccessControl::kWrite, OpenNumber::F, OpenType::T);
OpenNumber::F, OpenType::T);
auto* tex_storage_wo_3d_FT = storage_texture( auto* tex_storage_wo_3d_FT = storage_texture(
Dim::k3d, ast::AccessControl::kWriteOnly, OpenNumber::F, OpenType::T); Dim::k3d, ast::AccessControl::kWrite, OpenNumber::F, OpenType::T);
auto* sampler = this->sampler(ast::SamplerKind::kSampler); auto* sampler = this->sampler(ast::SamplerKind::kSampler);
auto* sampler_comparison = auto* sampler_comparison =

View File

@ -342,9 +342,9 @@ TEST_F(IntrinsicTableTest, MatchROStorageTexture) {
auto* vec4_f32 = create<sem::Vector>(f32, 4); auto* vec4_f32 = create<sem::Vector>(f32, 4);
auto* subtype = auto* subtype =
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types()); sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types());
auto* tex = create<sem::StorageTexture>( auto* tex = create<sem::StorageTexture>(ast::TextureDimension::k2d,
ast::TextureDimension::k2d, ast::ImageFormat::kR16Float, ast::ImageFormat::kR16Float,
ast::AccessControl::kReadOnly, subtype); ast::AccessControl::kRead, subtype);
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad, auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
{tex, vec2_i32}, Source{}); {tex, vec2_i32}, Source{});
@ -364,9 +364,9 @@ TEST_F(IntrinsicTableTest, MatchWOStorageTexture) {
auto* vec4_f32 = create<sem::Vector>(f32, 4); auto* vec4_f32 = create<sem::Vector>(f32, 4);
auto* subtype = auto* subtype =
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types()); sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types());
auto* tex = create<sem::StorageTexture>( auto* tex = create<sem::StorageTexture>(ast::TextureDimension::k2d,
ast::TextureDimension::k2d, ast::ImageFormat::kR16Float, ast::ImageFormat::kR16Float,
ast::AccessControl::kWriteOnly, subtype); ast::AccessControl::kWrite, subtype);
auto result = table->Lookup(*this, IntrinsicType::kTextureStore, auto result = table->Lookup(*this, IntrinsicType::kTextureStore,
{tex, vec2_i32, vec4_f32}, Source{}); {tex, vec2_i32, vec4_f32}, Source{});

View File

@ -1361,8 +1361,8 @@ ast::Variable* ParserImpl::MakeVariable(uint32_t id,
} }
// Apply the access(read) or access(read_write) modifier. // Apply the access(read) or access(read_write) modifier.
auto access = read_only ? ast::AccessControl::kReadOnly auto access =
: ast::AccessControl::kReadWrite; read_only ? ast::AccessControl::kRead : ast::AccessControl::kReadWrite;
storage_type = ty_.AccessControl(storage_type, access); storage_type = ty_.AccessControl(storage_type, access);
} }
@ -2124,8 +2124,8 @@ const Pointer* ParserImpl::GetTypeForHandleVar(
} }
} else { } else {
const auto access = usage.IsStorageReadTexture() const auto access = usage.IsStorageReadTexture()
? ast::AccessControl::kReadOnly ? ast::AccessControl::kRead
: ast::AccessControl::kWriteOnly; : ast::AccessControl::kWrite;
const auto format = enum_converter_.ToImageFormat(image_type->format()); const auto format = enum_converter_.ToImageFormat(image_type->format());
if (format == ast::ImageFormat::kNone) { if (format == ast::ImageFormat::kNone) {
return nullptr; return nullptr;

View File

@ -35,8 +35,8 @@ TEST(SpvParserTypeTest, SameArgumentsGivesSamePointer) {
EXPECT_EQ(ty.Vector(ty.I32(), 3), ty.Vector(ty.I32(), 3)); EXPECT_EQ(ty.Vector(ty.I32(), 3), ty.Vector(ty.I32(), 3));
EXPECT_EQ(ty.Matrix(ty.I32(), 3, 2), ty.Matrix(ty.I32(), 3, 2)); EXPECT_EQ(ty.Matrix(ty.I32(), 3, 2), ty.Matrix(ty.I32(), 3, 2));
EXPECT_EQ(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 2)); EXPECT_EQ(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 2));
EXPECT_EQ(ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly), EXPECT_EQ(ty.AccessControl(ty.I32(), ast::AccessControl::kRead),
ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly)); ty.AccessControl(ty.I32(), ast::AccessControl::kRead));
EXPECT_EQ(ty.Alias(sym, ty.I32()), ty.Alias(sym, ty.I32())); EXPECT_EQ(ty.Alias(sym, ty.I32()), ty.Alias(sym, ty.I32()));
EXPECT_EQ(ty.Struct(sym, {ty.I32()}), ty.Struct(sym, {ty.I32()})); EXPECT_EQ(ty.Struct(sym, {ty.I32()}), ty.Struct(sym, {ty.I32()}));
EXPECT_EQ(ty.Sampler(ast::SamplerKind::kSampler), EXPECT_EQ(ty.Sampler(ast::SamplerKind::kSampler),
@ -70,10 +70,10 @@ TEST(SpvParserTypeTest, DifferentArgumentsGivesDifferentPointer) {
EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.U32(), 3, 2)); EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.U32(), 3, 2));
EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 2, 2)); EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 2, 2));
EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 3)); EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 3));
EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly), EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kRead),
ty.AccessControl(ty.U32(), ast::AccessControl::kReadOnly)); ty.AccessControl(ty.U32(), ast::AccessControl::kRead));
EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly), EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kRead),
ty.AccessControl(ty.I32(), ast::AccessControl::kWriteOnly)); ty.AccessControl(ty.I32(), ast::AccessControl::kWrite));
EXPECT_NE(ty.Alias(sym_a, ty.I32()), ty.Alias(sym_b, ty.I32())); EXPECT_NE(ty.Alias(sym_a, ty.I32()), ty.Alias(sym_b, ty.I32()));
EXPECT_NE(ty.Struct(sym_a, {ty.I32()}), ty.Struct(sym_b, {ty.I32()})); EXPECT_NE(ty.Struct(sym_a, {ty.I32()}), ty.Struct(sym_b, {ty.I32()}));
EXPECT_NE(ty.Sampler(ast::SamplerKind::kSampler), EXPECT_NE(ty.Sampler(ast::SamplerKind::kSampler),

View File

@ -909,9 +909,9 @@ Expect<ast::AccessControl::Access> ParserImpl::expect_access_type() {
return Failure::kErrored; return Failure::kErrored;
if (ident.value == kReadAccessControl) if (ident.value == kReadAccessControl)
return {ast::AccessControl::kReadOnly, ident.source}; return {ast::AccessControl::kRead, ident.source};
if (ident.value == kWriteAccessControl) if (ident.value == kWriteAccessControl)
return {ast::AccessControl::kWriteOnly, ident.source}; return {ast::AccessControl::kWrite, ident.source};
if (ident.value == kReadWriteAccessControl) if (ident.value == kReadWriteAccessControl)
return {ast::AccessControl::kReadWrite, ident.source}; return {ast::AccessControl::kReadWrite, ident.source};

View File

@ -163,7 +163,7 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonStorable_Fail) {
auto make_type = [&] { auto make_type = [&] {
auto* tex_type = ty.storage_texture(ast::TextureDimension::k1d, auto* tex_type = ty.storage_texture(ast::TextureDimension::k1d,
ast::ImageFormat::kRgba8Unorm); ast::ImageFormat::kRgba8Unorm);
return ty.access(ast::AccessControl::kReadOnly, tex_type); return ty.access(ast::AccessControl::kRead, tex_type);
}; };
Global("a", make_type(), ast::StorageClass::kNone, nullptr, Global("a", make_type(), ast::StorageClass::kNone, nullptr,

View File

@ -69,8 +69,8 @@ static ast::DecorationList createDecorations(const Source& source,
DecorationKind kind) { DecorationKind kind) {
switch (kind) { switch (kind) {
case DecorationKind::kAccess: case DecorationKind::kAccess:
return {builder.create<ast::AccessDecoration>( return {builder.create<ast::AccessDecoration>(source,
source, ast::AccessControl::kReadOnly)}; ast::AccessControl::kRead)};
case DecorationKind::kAlign: case DecorationKind::kAlign:
return {builder.create<ast::StructMemberAlignDecoration>(source, 4u)}; return {builder.create<ast::StructMemberAlignDecoration>(source, 4u)};
case DecorationKind::kBinding: case DecorationKind::kBinding:
@ -523,7 +523,7 @@ TEST_F(ResourceDecorationTest, UniformBufferMissingBinding) {
TEST_F(ResourceDecorationTest, StorageBufferMissingBinding) { TEST_F(ResourceDecorationTest, StorageBufferMissingBinding) {
auto* s = Structure("S", {Member("x", ty.i32())}, auto* s = Structure("S", {Member("x", ty.i32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global(Source{{12, 34}}, "G", ac, ast::StorageClass::kStorage); Global(Source{{12, 34}}, "G", ac, ast::StorageClass::kStorage);
EXPECT_FALSE(r()->Resolve()); EXPECT_FALSE(r()->Resolve());

View File

@ -28,7 +28,7 @@ using ResolverHostShareableValidationTest = ResolverTest;
TEST_F(ResolverHostShareableValidationTest, BoolMember) { TEST_F(ResolverHostShareableValidationTest, BoolMember) {
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.bool_())}, auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.bool_())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -47,7 +47,7 @@ TEST_F(ResolverHostShareableValidationTest, BoolMember) {
TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) { TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) {
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.vec3<bool>())}, auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.vec3<bool>())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -68,7 +68,7 @@ TEST_F(ResolverHostShareableValidationTest, Aliases) {
AST().AddConstructedType(a1); AST().AddConstructedType(a1);
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", a1)}, auto* s = Structure("S", {Member(Source{{12, 34}}, "x", a1)},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
auto* a2 = ty.alias("a2", ac); auto* a2 = ty.alias("a2", ac);
AST().AddConstructedType(a2); AST().AddConstructedType(a2);
Global(Source{{56, 78}}, "g", a2, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", a2, ast::StorageClass::kStorage, nullptr,
@ -93,7 +93,7 @@ TEST_F(ResolverHostShareableValidationTest, NestedStructures) {
auto* s = Structure("S", {Member(Source{{7, 8}}, "m", i3)}, auto* s = Structure("S", {Member(Source{{7, 8}}, "m", i3)},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
Global(Source{{9, 10}}, "g", a, ast::StorageClass::kStorage, nullptr, Global(Source{{9, 10}}, "g", a, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -135,7 +135,7 @@ TEST_F(ResolverHostShareableValidationTest, NoError) {
auto* s = Structure("S", {Member(Source{{7, 8}}, "m", i3)}, auto* s = Structure("S", {Member(Source{{7, 8}}, "m", i3)},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
Global(Source{{9, 10}}, "g", a, ast::StorageClass::kStorage, nullptr, Global(Source{{9, 10}}, "g", a, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),

View File

@ -275,8 +275,7 @@ TEST_P(ResolverIntrinsicTest_StorageTextureOperation, TextureLoadRo) {
auto* coords_type = GetCoordsType(dim, ty.i32()); auto* coords_type = GetCoordsType(dim, ty.i32());
auto* texture_type = ty.storage_texture(dim, format); auto* texture_type = ty.storage_texture(dim, format);
auto* ro_texture_type = auto* ro_texture_type = ty.access(ast::AccessControl::kRead, texture_type);
ty.access(ast::AccessControl::kReadOnly, texture_type);
ast::ExpressionList call_params; ast::ExpressionList call_params;
@ -768,7 +767,7 @@ TEST_F(ResolverIntrinsicDataTest, ArrayLength_Vector) {
auto* ary = ty.array<i32>(); auto* ary = ty.array<i32>();
auto* str = Structure("S", {Member("x", ary)}, auto* str = Structure("S", {Member("x", ary)},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, str); auto* ac = ty.access(ast::AccessControl::kRead, str);
Global("a", ac, ast::StorageClass::kStorage, nullptr, Global("a", ac, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),

View File

@ -784,7 +784,7 @@ TEST_F(ResolverTest, Function_Parameters) {
TEST_F(ResolverTest, Function_RegisterInputOutputVariables) { TEST_F(ResolverTest, Function_RegisterInputOutputVariables) {
auto* s = Structure("S", {Member("m", ty.u32())}, auto* s = Structure("S", {Member("m", ty.u32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
auto* in_var = Global("in_var", ty.f32(), ast::StorageClass::kInput); auto* in_var = Global("in_var", ty.f32(), ast::StorageClass::kInput);
auto* out_var = Global("out_var", ty.f32(), ast::StorageClass::kOutput); auto* out_var = Global("out_var", ty.f32(), ast::StorageClass::kOutput);
@ -823,7 +823,7 @@ TEST_F(ResolverTest, Function_RegisterInputOutputVariables) {
TEST_F(ResolverTest, Function_RegisterInputOutputVariables_SubFunction) { TEST_F(ResolverTest, Function_RegisterInputOutputVariables_SubFunction) {
auto* s = Structure("S", {Member("m", ty.u32())}, auto* s = Structure("S", {Member("m", ty.u32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
auto* in_var = Global("in_var", ty.f32(), ast::StorageClass::kInput); auto* in_var = Global("in_var", ty.f32(), ast::StorageClass::kInput);
auto* out_var = Global("out_var", ty.f32(), ast::StorageClass::kOutput); auto* out_var = Global("out_var", ty.f32(), ast::StorageClass::kOutput);
@ -1752,7 +1752,7 @@ TEST_F(ResolverTest, StorageClass_SetForSampler) {
TEST_F(ResolverTest, StorageClass_SetForTexture) { TEST_F(ResolverTest, StorageClass_SetForTexture) {
auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); auto* t = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
auto* ac = ty.access(ast::AccessControl::kReadOnly, t); auto* ac = ty.access(ast::AccessControl::kRead, t);
auto* var = Global("var", ac, ast::StorageClass::kNone, nullptr, auto* var = Global("var", ac, ast::StorageClass::kNone, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),

View File

@ -229,7 +229,7 @@ ast::Type* ast_alias(const ProgramBuilder::TypesBuilder& ty) {
template <create_ast_type_func_ptr create_type> template <create_ast_type_func_ptr create_type>
ast::Type* ast_access(const ProgramBuilder::TypesBuilder& ty) { ast::Type* ast_access(const ProgramBuilder::TypesBuilder& ty) {
auto* type = create_type(ty); auto* type = create_type(ty);
return ty.access(ast::AccessControl::kReadOnly, type); return ty.access(ast::AccessControl::kRead, type);
} }
inline sem::Type* sem_bool(const ProgramBuilder::TypesBuilder& ty) { inline sem::Type* sem_bool(const ProgramBuilder::TypesBuilder& ty) {

View File

@ -69,7 +69,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferArray) {
// var<storage> g : [[access(read)]] array<S, 3>; // var<storage> g : [[access(read)]] array<S, 3>;
auto* s = Structure("S", {Member("a", ty.f32())}); auto* s = Structure("S", {Member("a", ty.f32())});
auto* a = ty.array(s, 3); auto* a = ty.array(s, 3);
auto* ac = ty.access(ast::AccessControl::kReadOnly, a); auto* ac = ty.access(ast::AccessControl::kRead, a);
Global(Source{{56, 78}}, "g", ac, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", ac, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -121,7 +121,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoBlockDecoration) {
// struct S { x : i32 }; // struct S { x : i32 };
// var<storage> g : [[access(read)]] S; // var<storage> g : [[access(read)]] S;
auto* s = Structure(Source{{12, 34}}, "S", {Member("x", ty.i32())}); auto* s = Structure(Source{{12, 34}}, "S", {Member("x", ty.i32())});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -141,7 +141,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Basic) {
// var<storage> g : [[access(read)]] S; // var<storage> g : [[access(read)]] S;
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())}, auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", a, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -160,7 +160,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Aliases) {
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a1 = ty.alias("a1", s); auto* a1 = ty.alias("a1", s);
AST().AddConstructedType(a1); AST().AddConstructedType(a1);
auto* ac = ty.access(ast::AccessControl::kReadOnly, a1); auto* ac = ty.access(ast::AccessControl::kRead, a1);
auto* a2 = ty.alias("a2", ac); auto* a2 = ty.alias("a2", ac);
AST().AddConstructedType(a2); AST().AddConstructedType(a2);
Global(Source{{56, 78}}, "g", a2, ast::StorageClass::kStorage, nullptr, Global(Source{{56, 78}}, "g", a2, ast::StorageClass::kStorage, nullptr,
@ -210,7 +210,7 @@ TEST_F(ResolverStorageClassValidationTest, UniformBufferArray) {
// var<uniform> g : [[access(read)]] array<S, 3>; // var<uniform> g : [[access(read)]] array<S, 3>;
auto* s = Structure("S", {Member("a", ty.f32())}); auto* s = Structure("S", {Member("a", ty.f32())});
auto* a = ty.array(s, 3); auto* a = ty.array(s, 3);
auto* ac = ty.access(ast::AccessControl::kReadOnly, a); auto* ac = ty.access(ast::AccessControl::kRead, a);
Global(Source{{56, 78}}, "g", ac, ast::StorageClass::kUniform, nullptr, Global(Source{{56, 78}}, "g", ac, ast::StorageClass::kUniform, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),

View File

@ -172,7 +172,7 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalArray) {
TEST_F(ResolverStorageClassUseTest, StructMultipleStorageClassUses) { TEST_F(ResolverStorageClassUseTest, StructMultipleStorageClassUses) {
auto* s = Structure("S", {Member("a", ty.f32())}, auto* s = Structure("S", {Member("a", ty.f32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("x", s, ast::StorageClass::kUniform, nullptr, Global("x", s, ast::StorageClass::kUniform, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),

View File

@ -519,7 +519,7 @@ TEST_P(StorageTextureDimensionTest, All) {
auto& params = GetParam(); auto& params = GetParam();
auto* st = ty.storage_texture(params.dim, ast::ImageFormat::kR32Uint); auto* st = ty.storage_texture(params.dim, ast::ImageFormat::kR32Uint);
auto* ac = ty.access(ast::AccessControl::kReadOnly, st); auto* ac = ty.access(ast::AccessControl::kRead, st);
Global(Source{{12, 34}}, "a", ac, ast::StorageClass::kNone, nullptr, Global(Source{{12, 34}}, "a", ac, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{
@ -595,7 +595,7 @@ TEST_P(StorageTextureFormatTest, All) {
// var d : [[access(read)]] texture_storage_3d<*>; // var d : [[access(read)]] texture_storage_3d<*>;
auto* st_a = ty.storage_texture(ast::TextureDimension::k1d, params.format); auto* st_a = ty.storage_texture(ast::TextureDimension::k1d, params.format);
auto* ac_a = ty.access(ast::AccessControl::kReadOnly, st_a); auto* ac_a = ty.access(ast::AccessControl::kRead, st_a);
Global(Source{{12, 34}}, "a", ac_a, ast::StorageClass::kNone, nullptr, Global(Source{{12, 34}}, "a", ac_a, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -603,7 +603,7 @@ TEST_P(StorageTextureFormatTest, All) {
}); });
auto* st_b = ty.storage_texture(ast::TextureDimension::k2d, params.format); auto* st_b = ty.storage_texture(ast::TextureDimension::k2d, params.format);
auto* ac_b = ty.access(ast::AccessControl::kReadOnly, st_b); auto* ac_b = ty.access(ast::AccessControl::kRead, st_b);
Global("b", ac_b, ast::StorageClass::kNone, nullptr, Global("b", ac_b, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -612,7 +612,7 @@ TEST_P(StorageTextureFormatTest, All) {
auto* st_c = auto* st_c =
ty.storage_texture(ast::TextureDimension::k2dArray, params.format); ty.storage_texture(ast::TextureDimension::k2dArray, params.format);
auto* ac_c = ty.access(ast::AccessControl::kReadOnly, st_c); auto* ac_c = ty.access(ast::AccessControl::kRead, st_c);
Global("c", ac_c, ast::StorageClass::kNone, nullptr, Global("c", ac_c, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -620,7 +620,7 @@ TEST_P(StorageTextureFormatTest, All) {
}); });
auto* st_d = ty.storage_texture(ast::TextureDimension::k3d, params.format); auto* st_d = ty.storage_texture(ast::TextureDimension::k3d, params.format);
auto* ac_d = ty.access(ast::AccessControl::kReadOnly, st_d); auto* ac_d = ty.access(ast::AccessControl::kRead, st_d);
Global("d", ac_d, ast::StorageClass::kNone, nullptr, Global("d", ac_d, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -687,7 +687,7 @@ TEST_F(StorageTextureAccessControlTest, ReadOnlyAccessControl_Pass) {
auto* st = ty.storage_texture(ast::TextureDimension::k1d, auto* st = ty.storage_texture(ast::TextureDimension::k1d,
ast::ImageFormat::kR32Uint); ast::ImageFormat::kR32Uint);
auto* ac = ty.access(ast::AccessControl::kReadOnly, st); auto* ac = ty.access(ast::AccessControl::kRead, st);
Global("a", ac, ast::StorageClass::kNone, nullptr, Global("a", ac, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{
@ -704,7 +704,7 @@ TEST_F(StorageTextureAccessControlTest, WriteOnlyAccessControl_Pass) {
auto* st = ty.storage_texture(ast::TextureDimension::k1d, auto* st = ty.storage_texture(ast::TextureDimension::k1d,
ast::ImageFormat::kR32Uint); ast::ImageFormat::kR32Uint);
auto* ac = ty.access(ast::AccessControl::kWriteOnly, st); auto* ac = ty.access(ast::AccessControl::kWrite, st);
Global("a", ac, ast::StorageClass::kNone, nullptr, Global("a", ac, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{

View File

@ -128,9 +128,9 @@ fn f() {
data.Add<BindingRemapper::Remappings>( data.Add<BindingRemapper::Remappings>(
BindingRemapper::BindingPoints{}, BindingRemapper::BindingPoints{},
BindingRemapper::AccessControls{ BindingRemapper::AccessControls{
{{2, 1}, ast::AccessControl::kWriteOnly}, // Modify access control {{2, 1}, ast::AccessControl::kWrite}, // Modify access control
// Keep [[group(3), binding(2)]] as is // Keep [[group(3), binding(2)]] as is
{{4, 3}, ast::AccessControl::kReadOnly}, // Add access control {{4, 3}, ast::AccessControl::kRead}, // Add access control
}); });
auto got = Run<BindingRemapper>(src, data); auto got = Run<BindingRemapper>(src, data);
@ -188,9 +188,9 @@ fn f() {
data.Add<BindingRemapper::Remappings>( data.Add<BindingRemapper::Remappings>(
BindingRemapper::BindingPoints{}, BindingRemapper::BindingPoints{},
BindingRemapper::AccessControls{ BindingRemapper::AccessControls{
{{2, 1}, ast::AccessControl::kWriteOnly}, // Modify access control {{2, 1}, ast::AccessControl::kWrite}, // Modify access control
// Keep [[group(3), binding(2)]] as is // Keep [[group(3), binding(2)]] as is
{{4, 3}, ast::AccessControl::kReadOnly}, // Add access control {{4, 3}, ast::AccessControl::kRead}, // Add access control
}); });
auto got = Run<BindingRemapper>(src, data); auto got = Run<BindingRemapper>(src, data);
@ -233,8 +233,8 @@ fn f() {
{{3, 2}, {6, 7}}, {{3, 2}, {6, 7}},
}, },
BindingRemapper::AccessControls{ BindingRemapper::AccessControls{
{{2, 1}, ast::AccessControl::kWriteOnly}, {{2, 1}, ast::AccessControl::kWrite},
{{3, 2}, ast::AccessControl::kWriteOnly}, {{3, 2}, ast::AccessControl::kWrite},
}); });
auto got = Run<BindingRemapper>(src, data); auto got = Run<BindingRemapper>(src, data);

View File

@ -214,8 +214,7 @@ struct State {
ctx.dst->create<ast::StructBlockDecoration>(), ctx.dst->create<ast::StructBlockDecoration>(),
}); });
for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) { for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) {
auto* access = auto* access = ctx.dst->ty.access(ast::AccessControl::kRead, struct_type);
ctx.dst->ty.access(ast::AccessControl::kReadOnly, struct_type);
// The decorated variable with struct type // The decorated variable with struct type
ctx.dst->Global( ctx.dst->Global(
GetVertexBufferName(i), access, ast::StorageClass::kStorage, nullptr, GetVertexBufferName(i), access, ast::StorageClass::kStorage, nullptr,

View File

@ -1753,8 +1753,7 @@ bool GeneratorImpl::EmitEntryPointData(
out << " " << builder_.Symbols().NameFor(decl->symbol()) out << " " << builder_.Symbols().NameFor(decl->symbol())
<< RegisterAndSpace( << RegisterAndSpace(
var->AccessControl() == ast::AccessControl::kReadOnly ? 't' var->AccessControl() == ast::AccessControl::kRead ? 't' : 'u',
: 'u',
binding_point) binding_point)
<< ";" << std::endl; << ";" << std::endl;
emitted_storagebuffer = true; emitted_storagebuffer = true;
@ -1917,7 +1916,7 @@ bool GeneratorImpl::EmitEntryPointData(
if (unwrapped_type->Is<sem::Texture>()) { if (unwrapped_type->Is<sem::Texture>()) {
register_space = "t"; register_space = "t";
if (auto* storage_tex = unwrapped_type->As<sem::StorageTexture>()) { if (auto* storage_tex = unwrapped_type->As<sem::StorageTexture>()) {
if (storage_tex->access_control() != ast::AccessControl::kReadOnly) { if (storage_tex->access_control() != ast::AccessControl::kRead) {
register_space = "u"; register_space = "u";
} }
} }
@ -2330,7 +2329,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
ast::AccessControl::Access access_control, ast::AccessControl::Access access_control,
const std::string& name) { const std::string& name) {
if (storage_class == ast::StorageClass::kStorage) { if (storage_class == ast::StorageClass::kStorage) {
if (access_control != ast::AccessControl::kReadOnly) { if (access_control != ast::AccessControl::kRead) {
out << "RW"; out << "RW";
} }
out << "ByteAddressBuffer"; out << "ByteAddressBuffer";
@ -2396,7 +2395,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
auto* sampled = tex->As<sem::SampledTexture>(); auto* sampled = tex->As<sem::SampledTexture>();
if (storage) { if (storage) {
if (access_control != ast::AccessControl::kReadOnly) { if (access_control != ast::AccessControl::kRead) {
out << "RW"; out << "RW";
} }
} }

View File

@ -472,7 +472,7 @@ TEST_F(HlslGeneratorImplTest_Function,
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("coord", ac, ast::StorageClass::kStorage, nullptr, Global("coord", ac, ast::StorageClass::kStorage, nullptr,
{ {
@ -518,7 +518,7 @@ TEST_F(HlslGeneratorImplTest_Function,
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kWriteOnly, s); auto* ac = ty.access(ast::AccessControl::kWrite, s);
Global("coord", ac, ast::StorageClass::kStorage, nullptr, Global("coord", ac, ast::StorageClass::kStorage, nullptr,
{ {

View File

@ -33,7 +33,7 @@ TEST_F(HlslSanitizerTest, ArrayLength) {
{ {
create<ast::StructBlockDecoration>(), create<ast::StructBlockDecoration>(),
}); });
auto* ac_ty = ty.access(ast::AccessControl::kReadOnly, sb_ty); auto* ac_ty = ty.access(ast::AccessControl::kRead, sb_ty);
Global("sb", ac_ty, ast::StorageClass::kStorage, nullptr, Global("sb", ac_ty, ast::StorageClass::kStorage, nullptr,
{ {

View File

@ -553,9 +553,8 @@ TEST_P(HlslStorageTexturesTest, Emit) {
auto params = GetParam(); auto params = GetParam();
auto* t = ty.storage_texture(params.dim, params.imgfmt); auto* t = ty.storage_texture(params.dim, params.imgfmt);
auto* ac = ty.access(params.ro ? ast::AccessControl::kReadOnly auto* ac = ty.access(
: ast::AccessControl::kWriteOnly, params.ro ? ast::AccessControl::kRead : ast::AccessControl::kWrite, t);
t);
Global("tex", ac, ast::StorageClass::kNone, nullptr, Global("tex", ac, ast::StorageClass::kNone, nullptr,
ast::DecorationList{ ast::DecorationList{

View File

@ -1288,7 +1288,7 @@ bool GeneratorImpl::EmitFunctionInternal(ast::Function* func,
} }
first = false; first = false;
if (var->AccessControl() == ast::AccessControl::kReadOnly) { if (var->AccessControl() == ast::AccessControl::kRead) {
out_ << "const "; out_ << "const ";
} }
@ -1506,7 +1506,7 @@ bool GeneratorImpl::EmitEntryPointFunction(ast::Function* func) {
auto* binding = data.second.binding; auto* binding = data.second.binding;
// auto* set = data.second.set; // auto* set = data.second.set;
if (var->AccessControl() == ast::AccessControl::kReadOnly) { if (var->AccessControl() == ast::AccessControl::kRead) {
out_ << "const "; out_ << "const ";
} }
@ -1988,9 +1988,9 @@ bool GeneratorImpl::EmitType(const sem::Type* type, const std::string& name) {
} }
std::string access_str; std::string access_str;
if (storage->access_control() == ast::AccessControl::kReadOnly) { if (storage->access_control() == ast::AccessControl::kRead) {
out_ << ", access::read"; out_ << ", access::read";
} else if (storage->access_control() == ast::AccessControl::kWriteOnly) { } else if (storage->access_control() == ast::AccessControl::kWrite) {
out_ << ", access::write"; out_ << ", access::write";
} else { } else {
diagnostics_.add_error("Invalid access control for storage texture"); diagnostics_.add_error("Invalid access control for storage texture");

View File

@ -351,7 +351,7 @@ TEST_F(MslGeneratorImplTest,
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("coord", ac, ast::StorageClass::kStorage, nullptr, Global("coord", ac, ast::StorageClass::kStorage, nullptr,
{create<ast::BindingDecoration>(0), create<ast::GroupDecoration>(1)}); {create<ast::BindingDecoration>(0), create<ast::GroupDecoration>(1)});
@ -663,7 +663,7 @@ TEST_F(MslGeneratorImplTest,
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("coord", ac, ast::StorageClass::kStorage, nullptr, Global("coord", ac, ast::StorageClass::kStorage, nullptr,
{create<ast::BindingDecoration>(0), create<ast::GroupDecoration>(1)}); {create<ast::BindingDecoration>(0), create<ast::GroupDecoration>(1)});

View File

@ -232,7 +232,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) {
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
Global("G", ty.access(ast::AccessControl::kReadOnly, s), Global("G", ty.access(ast::AccessControl::kRead, s),
ast::StorageClass::kStorage, nullptr, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -342,7 +342,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) {
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
Global("G", ty.access(ast::AccessControl::kReadOnly, s), Global("G", ty.access(ast::AccessControl::kRead, s),
ast::StorageClass::kStorage, nullptr, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -437,7 +437,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) {
}, },
ast::DecorationList{create<ast::StructBlockDecoration>()}); ast::DecorationList{create<ast::StructBlockDecoration>()});
Global("G", ty.access(ast::AccessControl::kReadOnly, s), Global("G", ty.access(ast::AccessControl::kRead, s),
ast::StorageClass::kStorage, nullptr, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -544,7 +544,7 @@ TEST_F(MslGeneratorImplTest, AttemptTintPadSymbolCollision) {
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
Global("G", ty.access(ast::AccessControl::kReadOnly, s), Global("G", ty.access(ast::AccessControl::kRead, s),
ast::StorageClass::kStorage, nullptr, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -610,7 +610,7 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) {
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
Global("G", ty.access(ast::AccessControl::kReadOnly, s), Global("G", ty.access(ast::AccessControl::kRead, s),
ast::StorageClass::kStorage, nullptr, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -765,9 +765,8 @@ TEST_P(MslStorageTexturesTest, Emit) {
auto params = GetParam(); auto params = GetParam();
auto* s = ty.storage_texture(params.dim, ast::ImageFormat::kR32Float); auto* s = ty.storage_texture(params.dim, ast::ImageFormat::kR32Float);
auto* ac = ty.access(params.ro ? ast::AccessControl::kReadOnly auto* ac = ty.access(
: ast::AccessControl::kWriteOnly, params.ro ? ast::AccessControl::kRead : ast::AccessControl::kWrite, s);
s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),

View File

@ -788,12 +788,12 @@ bool Builder::GenerateGlobalVariable(ast::Variable* var) {
if (type->Is<sem::StorageTexture>() || type->Is<sem::Struct>()) { if (type->Is<sem::StorageTexture>() || type->Is<sem::Struct>()) {
// type is a sem::Struct or a sem::StorageTexture // type is a sem::Struct or a sem::StorageTexture
switch (sem->AccessControl()) { switch (sem->AccessControl()) {
case ast::AccessControl::kWriteOnly: case ast::AccessControl::kWrite:
push_annot( push_annot(
spv::Op::OpDecorate, spv::Op::OpDecorate,
{Operand::Int(var_id), Operand::Int(SpvDecorationNonReadable)}); {Operand::Int(var_id), Operand::Int(SpvDecorationNonReadable)});
break; break;
case ast::AccessControl::kReadOnly: case ast::AccessControl::kRead:
push_annot( push_annot(
spv::Op::OpDecorate, spv::Op::OpDecorate,
{Operand::Int(var_id), Operand::Int(SpvDecorationNonWritable)}); {Operand::Int(var_id), Operand::Int(SpvDecorationNonWritable)});
@ -3175,12 +3175,12 @@ uint32_t Builder::GenerateTypeIfNeeded(const sem::Type* type) {
type_name_to_id_[builder_ type_name_to_id_[builder_
.create<sem::StorageTexture>( .create<sem::StorageTexture>(
st->dim(), st->image_format(), st->dim(), st->image_format(),
ast::AccessControl::kReadOnly, st->type()) ast::AccessControl::kRead, st->type())
->type_name()] = id; ->type_name()] = id;
type_name_to_id_[builder_ type_name_to_id_[builder_
.create<sem::StorageTexture>( .create<sem::StorageTexture>(
st->dim(), st->image_format(), st->dim(), st->image_format(),
ast::AccessControl::kWriteOnly, st->type()) ast::AccessControl::kWrite, st->type())
->type_name()] = id; ->type_name()] = id;
type_name_to_id_[builder_ type_name_to_id_[builder_
.create<sem::StorageTexture>( .create<sem::StorageTexture>(

View File

@ -402,7 +402,7 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
Member("b", ty.i32()), Member("b", ty.i32()),
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, A); auto* ac = ty.access(ast::AccessControl::kRead, A);
auto* var = Global("b", ac, ast::StorageClass::kStorage, nullptr, auto* var = Global("b", ac, ast::StorageClass::kStorage, nullptr,
{ {
@ -444,7 +444,7 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) {
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* B = ty.alias("B", A); auto* B = ty.alias("B", A);
AST().AddConstructedType(B); AST().AddConstructedType(B);
auto* ac = ty.access(ast::AccessControl::kReadOnly, B); auto* ac = ty.access(ast::AccessControl::kRead, B);
auto* var = Global("b", ac, ast::StorageClass::kStorage, nullptr, auto* var = Global("b", ac, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -481,7 +481,7 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) {
auto* A = Structure("A", {Member("a", ty.i32())}, auto* A = Structure("A", {Member("a", ty.i32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, A); auto* ac = ty.access(ast::AccessControl::kRead, A);
auto* B = ty.alias("B", ac); auto* B = ty.alias("B", ac);
AST().AddConstructedType(B); AST().AddConstructedType(B);
auto* var = Global("b", B, ast::StorageClass::kStorage, nullptr, auto* var = Global("b", B, ast::StorageClass::kStorage, nullptr,
@ -520,7 +520,7 @@ TEST_F(BuilderTest, GlobalVar_TwoVarDeclReadOnly) {
auto* A = Structure("A", {Member("a", ty.i32())}, auto* A = Structure("A", {Member("a", ty.i32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* read = ty.access(ast::AccessControl::kReadOnly, A); auto* read = ty.access(ast::AccessControl::kRead, A);
auto* rw = ty.access(ast::AccessControl::kReadWrite, A); auto* rw = ty.access(ast::AccessControl::kReadWrite, A);
auto* var_b = Global("b", read, ast::StorageClass::kStorage, nullptr, auto* var_b = Global("b", read, ast::StorageClass::kStorage, nullptr,
@ -567,7 +567,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageReadOnly) {
auto* type = ty.storage_texture(ast::TextureDimension::k2d, auto* type = ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Uint); ast::ImageFormat::kR32Uint);
auto* ac = ty.access(ast::AccessControl::kReadOnly, type); auto* ac = ty.access(ast::AccessControl::kRead, type);
auto* var_a = Global("a", ac, ast::StorageClass::kNone, nullptr, auto* var_a = Global("a", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -596,7 +596,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWriteOnly) {
auto* type = ty.storage_texture(ast::TextureDimension::k2d, auto* type = ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Uint); ast::ImageFormat::kR32Uint);
auto* ac = ty.access(ast::AccessControl::kWriteOnly, type); auto* ac = ty.access(ast::AccessControl::kWrite, type);
auto* var_a = Global("a", ac, ast::StorageClass::kNone, nullptr, auto* var_a = Global("a", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -625,7 +625,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWithDifferentAccess) {
// var<uniform_constant> a : [[access(read)]] texture_storage_2d<r32uint>; // var<uniform_constant> a : [[access(read)]] texture_storage_2d<r32uint>;
// var<uniform_constant> b : [[access(write)]] texture_storage_2d<r32uint>; // var<uniform_constant> b : [[access(write)]] texture_storage_2d<r32uint>;
auto* type_a = ty.access(ast::AccessControl::kReadOnly, auto* type_a = ty.access(ast::AccessControl::kRead,
ty.storage_texture(ast::TextureDimension::k2d, ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Uint)); ast::ImageFormat::kR32Uint));
auto* var_a = Global("a", type_a, ast::StorageClass::kNone, nullptr, auto* var_a = Global("a", type_a, ast::StorageClass::kNone, nullptr,
@ -634,7 +634,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWithDifferentAccess) {
create<ast::GroupDecoration>(0), create<ast::GroupDecoration>(0),
}); });
auto* type_b = ty.access(ast::AccessControl::kWriteOnly, auto* type_b = ty.access(ast::AccessControl::kWrite,
ty.storage_texture(ast::TextureDimension::k2d, ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Uint)); ast::ImageFormat::kR32Uint));
auto* var_b = Global("b", type_b, ast::StorageClass::kNone, nullptr, auto* var_b = Global("b", type_b, ast::StorageClass::kNone, nullptr,

View File

@ -1445,7 +1445,7 @@ OpFunctionEnd
TEST_F(IntrinsicBuilderTest, Call_ArrayLength) { TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))}, auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("b", ac, ast::StorageClass::kStorage, nullptr, Global("b", ac, ast::StorageClass::kStorage, nullptr,
ast::DecorationList{ ast::DecorationList{
create<ast::BindingDecoration>(1), create<ast::BindingDecoration>(1),
@ -1495,7 +1495,7 @@ TEST_F(IntrinsicBuilderTest, Call_ArrayLength_OtherMembersInStruct) {
Member(4, "a", ty.array<f32>(4)), Member(4, "a", ty.array<f32>(4)),
}, },
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("b", ac, ast::StorageClass::kStorage, nullptr, Global("b", ac, ast::StorageClass::kStorage, nullptr,
ast::DecorationList{ ast::DecorationList{
create<ast::BindingDecoration>(1), create<ast::BindingDecoration>(1),

View File

@ -30,7 +30,7 @@ TEST_F(BuilderTest_Type, GenerateRuntimeArray) {
auto* ary = ty.array(ty.i32(), 0); auto* ary = ty.array(ty.i32(), 0);
auto* str = Structure("S", {Member("x", ary)}, auto* str = Structure("S", {Member("x", ary)},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, str); auto* ac = ty.access(ast::AccessControl::kRead, str);
Global("a", ac, ast::StorageClass::kStorage, nullptr, Global("a", ac, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -52,7 +52,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedRuntimeArray) {
auto* ary = ty.array(ty.i32(), 0); auto* ary = ty.array(ty.i32(), 0);
auto* str = Structure("S", {Member("x", ary)}, auto* str = Structure("S", {Member("x", ary)},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* ac = ty.access(ast::AccessControl::kReadOnly, str); auto* ac = ty.access(ast::AccessControl::kRead, str);
Global("a", ac, ast::StorageClass::kStorage, nullptr, Global("a", ac, ast::StorageClass::kStorage, nullptr,
{ {
create<ast::BindingDecoration>(0), create<ast::BindingDecoration>(0),
@ -832,7 +832,7 @@ TEST_F(BuilderTest_Type, SampledTexture_Generate_CubeArray) {
TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) { TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) {
auto* s = ty.storage_texture(ast::TextureDimension::k1d, auto* s = ty.storage_texture(ast::TextureDimension::k1d,
ast::ImageFormat::kR32Float); ast::ImageFormat::kR32Float);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -852,7 +852,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) {
TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) { TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) {
auto* s = ty.storage_texture(ast::TextureDimension::k2d, auto* s = ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Float); ast::ImageFormat::kR32Float);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -872,7 +872,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) {
TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) { TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) {
auto* s = ty.storage_texture(ast::TextureDimension::k2dArray, auto* s = ty.storage_texture(ast::TextureDimension::k2dArray,
ast::ImageFormat::kR32Float); ast::ImageFormat::kR32Float);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -892,7 +892,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) {
TEST_F(BuilderTest_Type, StorageTexture_Generate_3d) { TEST_F(BuilderTest_Type, StorageTexture_Generate_3d) {
auto* s = ty.storage_texture(ast::TextureDimension::k3d, auto* s = ty.storage_texture(ast::TextureDimension::k3d,
ast::ImageFormat::kR32Float); ast::ImageFormat::kR32Float);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -913,7 +913,7 @@ TEST_F(BuilderTest_Type,
StorageTexture_Generate_SampledTypeFloat_Format_r32float) { StorageTexture_Generate_SampledTypeFloat_Format_r32float) {
auto* s = ty.storage_texture(ast::TextureDimension::k2d, auto* s = ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Float); ast::ImageFormat::kR32Float);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -934,7 +934,7 @@ TEST_F(BuilderTest_Type,
StorageTexture_Generate_SampledTypeSint_Format_r32sint) { StorageTexture_Generate_SampledTypeSint_Format_r32sint) {
auto* s = ty.storage_texture(ast::TextureDimension::k2d, auto* s = ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Sint); ast::ImageFormat::kR32Sint);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {
@ -955,7 +955,7 @@ TEST_F(BuilderTest_Type,
StorageTexture_Generate_SampledTypeUint_Format_r32uint) { StorageTexture_Generate_SampledTypeUint_Format_r32uint) {
auto* s = ty.storage_texture(ast::TextureDimension::k2d, auto* s = ty.storage_texture(ast::TextureDimension::k2d,
ast::ImageFormat::kR32Uint); ast::ImageFormat::kR32Uint);
auto* ac = ty.access(ast::AccessControl::kReadOnly, s); auto* ac = ty.access(ast::AccessControl::kRead, s);
Global("test_var", ac, ast::StorageClass::kNone, nullptr, Global("test_var", ac, ast::StorageClass::kNone, nullptr,
{ {

View File

@ -114,7 +114,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Global_Sampler) {
TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) { TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) {
auto* st = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32()); auto* st = ty.sampled_texture(ast::TextureDimension::k1d, ty.f32());
Global("t", ty.access(ast::AccessControl::kReadOnly, st), Global("t", ty.access(ast::AccessControl::kRead, st),
ast::StorageClass::kNone, nullptr, ast::StorageClass::kNone, nullptr,
{create<ast::GroupDecoration>(0), create<ast::BindingDecoration>(0)}); {create<ast::GroupDecoration>(0), create<ast::BindingDecoration>(0)});

View File

@ -49,7 +49,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_Read) {
auto* s = Structure("S", {Member("a", ty.i32())}, auto* s = Structure("S", {Member("a", ty.i32())},
{create<ast::StructBlockDecoration>()}); {create<ast::StructBlockDecoration>()});
auto* a = ty.access(ast::AccessControl::kReadOnly, s); auto* a = ty.access(ast::AccessControl::kRead, s);
AST().AddConstructedType(ty.alias("make_type_reachable", a)); AST().AddConstructedType(ty.alias("make_type_reachable", a));
GeneratorImpl& gen = Build(); GeneratorImpl& gen = Build();
@ -441,35 +441,35 @@ INSTANTIATE_TEST_SUITE_P(
testing::Values( testing::Values(
StorageTextureData{ast::ImageFormat::kR8Unorm, StorageTextureData{ast::ImageFormat::kR8Unorm,
ast::TextureDimension::k1d, ast::TextureDimension::k1d,
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
"[[access(read)]] texture_storage_1d<r8unorm>"}, "[[access(read)]] texture_storage_1d<r8unorm>"},
StorageTextureData{ast::ImageFormat::kR8Unorm, StorageTextureData{ast::ImageFormat::kR8Unorm,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
"[[access(read)]] texture_storage_2d<r8unorm>"}, "[[access(read)]] texture_storage_2d<r8unorm>"},
StorageTextureData{ StorageTextureData{
ast::ImageFormat::kR8Unorm, ast::TextureDimension::k2dArray, ast::ImageFormat::kR8Unorm, ast::TextureDimension::k2dArray,
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
"[[access(read)]] texture_storage_2d_array<r8unorm>"}, "[[access(read)]] texture_storage_2d_array<r8unorm>"},
StorageTextureData{ast::ImageFormat::kR8Unorm, StorageTextureData{ast::ImageFormat::kR8Unorm,
ast::TextureDimension::k3d, ast::TextureDimension::k3d,
ast::AccessControl::kReadOnly, ast::AccessControl::kRead,
"[[access(read)]] texture_storage_3d<r8unorm>"}, "[[access(read)]] texture_storage_3d<r8unorm>"},
StorageTextureData{ast::ImageFormat::kR8Unorm, StorageTextureData{ast::ImageFormat::kR8Unorm,
ast::TextureDimension::k1d, ast::TextureDimension::k1d,
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
"[[access(write)]] texture_storage_1d<r8unorm>"}, "[[access(write)]] texture_storage_1d<r8unorm>"},
StorageTextureData{ast::ImageFormat::kR8Unorm, StorageTextureData{ast::ImageFormat::kR8Unorm,
ast::TextureDimension::k2d, ast::TextureDimension::k2d,
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
"[[access(write)]] texture_storage_2d<r8unorm>"}, "[[access(write)]] texture_storage_2d<r8unorm>"},
StorageTextureData{ StorageTextureData{
ast::ImageFormat::kR8Unorm, ast::TextureDimension::k2dArray, ast::ImageFormat::kR8Unorm, ast::TextureDimension::k2dArray,
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
"[[access(write)]] texture_storage_2d_array<r8unorm>"}, "[[access(write)]] texture_storage_2d_array<r8unorm>"},
StorageTextureData{ast::ImageFormat::kR8Unorm, StorageTextureData{ast::ImageFormat::kR8Unorm,
ast::TextureDimension::k3d, ast::TextureDimension::k3d,
ast::AccessControl::kWriteOnly, ast::AccessControl::kWrite,
"[[access(write)]] texture_storage_3d<r8unorm>"})); "[[access(write)]] texture_storage_3d<r8unorm>"}));
struct ImageFormatData { struct ImageFormatData {