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:
parent
3264765bc2
commit
646f4a9958
|
@ -37,10 +37,10 @@ AccessControl::~AccessControl() = default;
|
|||
std::string AccessControl::type_name() const {
|
||||
std::string name = "__access_control_";
|
||||
switch (access_) {
|
||||
case ast::AccessControl::kReadOnly:
|
||||
case ast::AccessControl::kRead:
|
||||
name += "read_only";
|
||||
break;
|
||||
case ast::AccessControl::kWriteOnly:
|
||||
case ast::AccessControl::kWrite:
|
||||
name += "write_only";
|
||||
break;
|
||||
case ast::AccessControl::kReadWrite:
|
||||
|
@ -54,10 +54,10 @@ std::string AccessControl::FriendlyName(const SymbolTable& symbols) const {
|
|||
std::ostringstream out;
|
||||
out << "[[access(";
|
||||
switch (access_) {
|
||||
case ast::AccessControl::kReadOnly:
|
||||
case ast::AccessControl::kRead:
|
||||
out << "read";
|
||||
break;
|
||||
case ast::AccessControl::kWriteOnly:
|
||||
case ast::AccessControl::kWrite:
|
||||
out << "write";
|
||||
break;
|
||||
case ast::AccessControl::kReadWrite:
|
||||
|
@ -77,7 +77,7 @@ AccessControl* AccessControl::Clone(CloneContext* ctx) const {
|
|||
|
||||
std::ostream& operator<<(std::ostream& out, AccessControl::Access access) {
|
||||
switch (access) {
|
||||
case ast::AccessControl::kReadOnly: {
|
||||
case ast::AccessControl::kRead: {
|
||||
out << "read_only";
|
||||
break;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ std::ostream& operator<<(std::ostream& out, AccessControl::Access access) {
|
|||
out << "read_write";
|
||||
break;
|
||||
}
|
||||
case ast::AccessControl::kWriteOnly: {
|
||||
case ast::AccessControl::kWrite: {
|
||||
out << "write_only";
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ class AccessControl : public Castable<AccessControl, Type> {
|
|||
/// The access control settings
|
||||
enum Access {
|
||||
/// Read only
|
||||
kReadOnly,
|
||||
kRead,
|
||||
/// Write only
|
||||
kWriteOnly,
|
||||
kWrite,
|
||||
/// Read write
|
||||
kReadWrite
|
||||
};
|
||||
|
@ -50,9 +50,9 @@ class AccessControl : public Castable<AccessControl, Type> {
|
|||
~AccessControl() override;
|
||||
|
||||
/// @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
|
||||
bool IsWriteOnly() const { return access_ == Access::kWriteOnly; }
|
||||
bool IsWriteOnly() const { return access_ == Access::kWrite; }
|
||||
/// @returns true if the access control is read/write
|
||||
bool IsReadWrite() const { return access_ == Access::kReadWrite; }
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ TEST_F(AstAccessControlTest, Create) {
|
|||
|
||||
TEST_F(AstAccessControlTest, AccessRead) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* ac = create<AccessControl>(AccessControl::kReadOnly, i32);
|
||||
auto* ac = create<AccessControl>(AccessControl::kRead, i32);
|
||||
EXPECT_TRUE(ac->IsReadOnly());
|
||||
EXPECT_FALSE(ac->IsWriteOnly());
|
||||
EXPECT_FALSE(ac->IsReadWrite());
|
||||
|
@ -53,7 +53,7 @@ TEST_F(AstAccessControlTest, AccessRead) {
|
|||
|
||||
TEST_F(AstAccessControlTest, AccessWrite) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* ac = create<AccessControl>(AccessControl::kWriteOnly, i32);
|
||||
auto* ac = create<AccessControl>(AccessControl::kWrite, i32);
|
||||
EXPECT_FALSE(ac->IsReadOnly());
|
||||
EXPECT_TRUE(ac->IsWriteOnly());
|
||||
EXPECT_FALSE(ac->IsReadWrite());
|
||||
|
@ -73,13 +73,13 @@ TEST_F(AstAccessControlTest, AccessReadWrite) {
|
|||
|
||||
TEST_F(AstAccessControlTest, FriendlyNameReadOnly) {
|
||||
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");
|
||||
}
|
||||
|
||||
TEST_F(AstAccessControlTest, FriendlyNameWriteOnly) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ namespace {
|
|||
using AccessDecorationTest = TestHelper;
|
||||
|
||||
TEST_F(AccessDecorationTest, Creation) {
|
||||
auto* d = create<AccessDecoration>(ast::AccessControl::kWriteOnly);
|
||||
EXPECT_EQ(ast::AccessControl::kWriteOnly, d->value());
|
||||
auto* d = create<AccessDecoration>(ast::AccessControl::kWrite);
|
||||
EXPECT_EQ(ast::AccessControl::kWrite, d->value());
|
||||
}
|
||||
|
||||
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}
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ TEST_F(AstAliasTest, UnwrapAll_TwiceAliasPointerTwiceAlias) {
|
|||
|
||||
TEST_F(AstAliasTest, UnwrapAll_AccessControlPointer) {
|
||||
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);
|
||||
EXPECT_EQ(pa->type(), a);
|
||||
EXPECT_EQ(pa->UnwrapAll(), u32);
|
||||
|
@ -87,7 +87,7 @@ TEST_F(AstAliasTest, UnwrapAll_AccessControlPointer) {
|
|||
TEST_F(AstAliasTest, UnwrapAll_PointerAccessControl) {
|
||||
auto* u32 = create<U32>();
|
||||
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->UnwrapAll(), u32);
|
||||
|
|
|
@ -405,7 +405,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
{
|
||||
ValidTextureOverload::kDimensionsStorageRO1d,
|
||||
"textureDimensions(t : texture_storage_1d<rgba32float>) -> i32",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -416,7 +416,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsStorageRO2d,
|
||||
"textureDimensions(t : texture_storage_2d<rgba32float>) -> "
|
||||
"vec2<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -427,7 +427,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsStorageRO2dArray,
|
||||
"textureDimensions(t : texture_storage_2d_array<rgba32float>) -> "
|
||||
"vec2<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
|
@ -438,7 +438,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsStorageRO3d,
|
||||
"textureDimensions(t : texture_storage_3d<rgba32float>) -> "
|
||||
"vec3<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -448,7 +448,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
{
|
||||
ValidTextureOverload::kDimensionsStorageWO1d,
|
||||
"textureDimensions(t : texture_storage_1d<rgba32float>) -> i32",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -459,7 +459,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsStorageWO2d,
|
||||
"textureDimensions(t : texture_storage_2d<rgba32float>) -> "
|
||||
"vec2<i32>",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -470,7 +470,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsStorageWO2dArray,
|
||||
"textureDimensions(t : texture_storage_2d_array<rgba32float>) -> "
|
||||
"vec2<i32>",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
|
@ -481,7 +481,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kDimensionsStorageWO3d,
|
||||
"textureDimensions(t : texture_storage_3d<rgba32float>) -> "
|
||||
"vec3<i32>",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -531,7 +531,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
{
|
||||
ValidTextureOverload::kNumLayersStorageWO2dArray,
|
||||
"textureNumLayers(t : texture_storage_2d_array<rgba32float>) -> i32",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
|
@ -1887,7 +1887,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO1dRgba32float,
|
||||
"textureLoad(t : texture_storage_1d<rgba32float>,\n"
|
||||
" coords : i32) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -1901,7 +1901,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba8unorm,
|
||||
"textureLoad(t : texture_storage_2d<rgba8unorm>,\n"
|
||||
" coords : vec2<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba8Unorm,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -1915,7 +1915,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba8snorm,
|
||||
"textureLoad(t : texture_storage_2d<rgba8snorm>,\n"
|
||||
" coords : vec2<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba8Snorm,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -1929,7 +1929,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba8uint,
|
||||
"textureLoad(t : texture_storage_2d<rgba8uint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<u32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba8Uint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kU32,
|
||||
|
@ -1943,7 +1943,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba8sint,
|
||||
"textureLoad(t : texture_storage_2d<rgba8sint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba8Sint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kI32,
|
||||
|
@ -1957,7 +1957,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba16uint,
|
||||
"textureLoad(t : texture_storage_2d<rgba16uint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<u32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba16Uint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kU32,
|
||||
|
@ -1971,7 +1971,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba16sint,
|
||||
"textureLoad(t : texture_storage_2d<rgba16sint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba16Sint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kI32,
|
||||
|
@ -1985,7 +1985,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba16float,
|
||||
"textureLoad(t : texture_storage_2d<rgba16float>,\n"
|
||||
" coords : vec2<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba16Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -1999,7 +1999,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dR32uint,
|
||||
"textureLoad(t : texture_storage_2d<r32uint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<u32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kR32Uint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kU32,
|
||||
|
@ -2013,7 +2013,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dR32sint,
|
||||
"textureLoad(t : texture_storage_2d<r32sint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kR32Sint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kI32,
|
||||
|
@ -2027,7 +2027,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dR32float,
|
||||
"textureLoad(t : texture_storage_2d<r32float>,\n"
|
||||
" coords : vec2<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kR32Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2041,7 +2041,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRg32uint,
|
||||
"textureLoad(t : texture_storage_2d<rg32uint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<u32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRg32Uint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kU32,
|
||||
|
@ -2055,7 +2055,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRg32sint,
|
||||
"textureLoad(t : texture_storage_2d<rg32sint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRg32Sint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kI32,
|
||||
|
@ -2069,7 +2069,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRg32float,
|
||||
"textureLoad(t : texture_storage_2d<rg32float>,\n"
|
||||
" coords : vec2<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRg32Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2083,7 +2083,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba32uint,
|
||||
"textureLoad(t : texture_storage_2d<rgba32uint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<u32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Uint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kU32,
|
||||
|
@ -2097,7 +2097,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba32sint,
|
||||
"textureLoad(t : texture_storage_2d<rgba32sint>,\n"
|
||||
" coords : vec2<i32>) -> vec4<i32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Sint,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kI32,
|
||||
|
@ -2111,7 +2111,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO2dRgba32float,
|
||||
"textureLoad(t : texture_storage_2d<rgba32float>,\n"
|
||||
" coords : vec2<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2127,7 +2127,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"texture_storage_2d_array<rgba32float>,\n"
|
||||
" coords : vec2<i32>,\n"
|
||||
" array_index : i32) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2142,7 +2142,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
ValidTextureOverload::kLoadStorageRO3dRgba32float,
|
||||
"textureLoad(t : texture_storage_3d<rgba32float>,\n"
|
||||
" coords : vec3<i32>) -> vec4<f32>",
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2157,7 +2157,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureStore(t : texture_storage_1d<rgba32float>,\n"
|
||||
" coords : i32,\n"
|
||||
" value : vec4<T>)",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2173,7 +2173,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureStore(t : texture_storage_2d<rgba32float>,\n"
|
||||
" coords : vec2<i32>,\n"
|
||||
" value : vec4<T>)",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2190,7 +2190,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
" coords : vec2<i32>,\n"
|
||||
" array_index : i32,\n"
|
||||
" value : vec4<T>)",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
|
@ -2207,7 +2207,7 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
|||
"textureStore(t : texture_storage_3d<rgba32float>,\n"
|
||||
" coords : vec3<i32>,\n"
|
||||
" value : vec4<T>)",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
ast::ImageFormat::kRgba32Float,
|
||||
ast::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
|
|
|
@ -641,7 +641,7 @@ std::vector<ResourceBinding> Inspector::GetStorageBufferResourceBindingsImpl(
|
|||
auto* var = rsv.first;
|
||||
auto binding_info = rsv.second;
|
||||
|
||||
if (read_only != (var->AccessControl() == ast::AccessControl::kReadOnly)) {
|
||||
if (read_only != (var->AccessControl() == ast::AccessControl::kRead)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ std::vector<ResourceBinding> Inspector::GetStorageTextureResourceBindingsImpl(
|
|||
auto* texture_type = var->Type()->UnwrapRef()->As<sem::StorageTexture>();
|
||||
|
||||
if (read_only !=
|
||||
(texture_type->access_control() == ast::AccessControl::kReadOnly)) {
|
||||
(texture_type->access_control() == ast::AccessControl::kRead)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ class InspectorHelper : public ProgramBuilder {
|
|||
std::vector<ast::Type*> member_types) {
|
||||
MakeStructType(name, member_types, true);
|
||||
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::ImageFormat format,
|
||||
bool read_only) {
|
||||
auto ac = read_only ? ast::AccessControl::kReadOnly
|
||||
: ast::AccessControl::kWriteOnly;
|
||||
auto ac =
|
||||
read_only ? ast::AccessControl::kRead : ast::AccessControl::kWrite;
|
||||
auto* tex = ty.storage_texture(dim, format);
|
||||
|
||||
return ty.access(ac, tex);
|
||||
|
|
|
@ -1126,22 +1126,21 @@ Impl::Impl() {
|
|||
auto* tex_storage_3d_FT =
|
||||
storage_texture(Dim::k3d, OpenNumber::A, OpenNumber::F, OpenType::T);
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
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(
|
||||
Dim::k2d, ast::AccessControl::kWriteOnly, OpenNumber::F, OpenType::T);
|
||||
auto* tex_storage_wo_2d_array_FT =
|
||||
storage_texture(Dim::k2dArray, ast::AccessControl::kWriteOnly,
|
||||
OpenNumber::F, OpenType::T);
|
||||
Dim::k2d, ast::AccessControl::kWrite, OpenNumber::F, OpenType::T);
|
||||
auto* tex_storage_wo_2d_array_FT = storage_texture(
|
||||
Dim::k2dArray, ast::AccessControl::kWrite, OpenNumber::F, OpenType::T);
|
||||
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_comparison =
|
||||
|
|
|
@ -342,9 +342,9 @@ TEST_F(IntrinsicTableTest, MatchROStorageTexture) {
|
|||
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
||||
auto* subtype =
|
||||
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types());
|
||||
auto* tex = create<sem::StorageTexture>(
|
||||
ast::TextureDimension::k2d, ast::ImageFormat::kR16Float,
|
||||
ast::AccessControl::kReadOnly, subtype);
|
||||
auto* tex = create<sem::StorageTexture>(ast::TextureDimension::k2d,
|
||||
ast::ImageFormat::kR16Float,
|
||||
ast::AccessControl::kRead, subtype);
|
||||
|
||||
auto result = table->Lookup(*this, IntrinsicType::kTextureLoad,
|
||||
{tex, vec2_i32}, Source{});
|
||||
|
@ -364,9 +364,9 @@ TEST_F(IntrinsicTableTest, MatchWOStorageTexture) {
|
|||
auto* vec4_f32 = create<sem::Vector>(f32, 4);
|
||||
auto* subtype =
|
||||
sem::StorageTexture::SubtypeFor(ast::ImageFormat::kR16Float, Types());
|
||||
auto* tex = create<sem::StorageTexture>(
|
||||
ast::TextureDimension::k2d, ast::ImageFormat::kR16Float,
|
||||
ast::AccessControl::kWriteOnly, subtype);
|
||||
auto* tex = create<sem::StorageTexture>(ast::TextureDimension::k2d,
|
||||
ast::ImageFormat::kR16Float,
|
||||
ast::AccessControl::kWrite, subtype);
|
||||
|
||||
auto result = table->Lookup(*this, IntrinsicType::kTextureStore,
|
||||
{tex, vec2_i32, vec4_f32}, Source{});
|
||||
|
|
|
@ -1361,8 +1361,8 @@ ast::Variable* ParserImpl::MakeVariable(uint32_t id,
|
|||
}
|
||||
|
||||
// Apply the access(read) or access(read_write) modifier.
|
||||
auto access = read_only ? ast::AccessControl::kReadOnly
|
||||
: ast::AccessControl::kReadWrite;
|
||||
auto access =
|
||||
read_only ? ast::AccessControl::kRead : ast::AccessControl::kReadWrite;
|
||||
storage_type = ty_.AccessControl(storage_type, access);
|
||||
}
|
||||
|
||||
|
@ -2124,8 +2124,8 @@ const Pointer* ParserImpl::GetTypeForHandleVar(
|
|||
}
|
||||
} else {
|
||||
const auto access = usage.IsStorageReadTexture()
|
||||
? ast::AccessControl::kReadOnly
|
||||
: ast::AccessControl::kWriteOnly;
|
||||
? ast::AccessControl::kRead
|
||||
: ast::AccessControl::kWrite;
|
||||
const auto format = enum_converter_.ToImageFormat(image_type->format());
|
||||
if (format == ast::ImageFormat::kNone) {
|
||||
return nullptr;
|
||||
|
|
|
@ -35,8 +35,8 @@ TEST(SpvParserTypeTest, SameArgumentsGivesSamePointer) {
|
|||
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.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 2));
|
||||
EXPECT_EQ(ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly),
|
||||
ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly));
|
||||
EXPECT_EQ(ty.AccessControl(ty.I32(), ast::AccessControl::kRead),
|
||||
ty.AccessControl(ty.I32(), ast::AccessControl::kRead));
|
||||
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.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.I32(), 2, 2));
|
||||
EXPECT_NE(ty.Array(ty.I32(), 3, 2), ty.Array(ty.I32(), 3, 3));
|
||||
EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly),
|
||||
ty.AccessControl(ty.U32(), ast::AccessControl::kReadOnly));
|
||||
EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kReadOnly),
|
||||
ty.AccessControl(ty.I32(), ast::AccessControl::kWriteOnly));
|
||||
EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kRead),
|
||||
ty.AccessControl(ty.U32(), ast::AccessControl::kRead));
|
||||
EXPECT_NE(ty.AccessControl(ty.I32(), ast::AccessControl::kRead),
|
||||
ty.AccessControl(ty.I32(), ast::AccessControl::kWrite));
|
||||
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.Sampler(ast::SamplerKind::kSampler),
|
||||
|
|
|
@ -909,9 +909,9 @@ Expect<ast::AccessControl::Access> ParserImpl::expect_access_type() {
|
|||
return Failure::kErrored;
|
||||
|
||||
if (ident.value == kReadAccessControl)
|
||||
return {ast::AccessControl::kReadOnly, ident.source};
|
||||
return {ast::AccessControl::kRead, ident.source};
|
||||
if (ident.value == kWriteAccessControl)
|
||||
return {ast::AccessControl::kWriteOnly, ident.source};
|
||||
return {ast::AccessControl::kWrite, ident.source};
|
||||
if (ident.value == kReadWriteAccessControl)
|
||||
return {ast::AccessControl::kReadWrite, ident.source};
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ TEST_F(ResolverAssignmentValidationTest, AssignNonStorable_Fail) {
|
|||
auto make_type = [&] {
|
||||
auto* tex_type = ty.storage_texture(ast::TextureDimension::k1d,
|
||||
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,
|
||||
|
|
|
@ -69,8 +69,8 @@ static ast::DecorationList createDecorations(const Source& source,
|
|||
DecorationKind kind) {
|
||||
switch (kind) {
|
||||
case DecorationKind::kAccess:
|
||||
return {builder.create<ast::AccessDecoration>(
|
||||
source, ast::AccessControl::kReadOnly)};
|
||||
return {builder.create<ast::AccessDecoration>(source,
|
||||
ast::AccessControl::kRead)};
|
||||
case DecorationKind::kAlign:
|
||||
return {builder.create<ast::StructMemberAlignDecoration>(source, 4u)};
|
||||
case DecorationKind::kBinding:
|
||||
|
@ -523,7 +523,7 @@ TEST_F(ResourceDecorationTest, UniformBufferMissingBinding) {
|
|||
TEST_F(ResourceDecorationTest, StorageBufferMissingBinding) {
|
||||
auto* s = Structure("S", {Member("x", ty.i32())},
|
||||
{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);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
|
|
@ -28,7 +28,7 @@ using ResolverHostShareableValidationTest = ResolverTest;
|
|||
TEST_F(ResolverHostShareableValidationTest, BoolMember) {
|
||||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.bool_())},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -47,7 +47,7 @@ TEST_F(ResolverHostShareableValidationTest, BoolMember) {
|
|||
TEST_F(ResolverHostShareableValidationTest, BoolVectorMember) {
|
||||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.vec3<bool>())},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -68,7 +68,7 @@ TEST_F(ResolverHostShareableValidationTest, Aliases) {
|
|||
AST().AddConstructedType(a1);
|
||||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", a1)},
|
||||
{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);
|
||||
AST().AddConstructedType(a2);
|
||||
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)},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -135,7 +135,7 @@ TEST_F(ResolverHostShareableValidationTest, NoError) {
|
|||
|
||||
auto* s = Structure("S", {Member(Source{{7, 8}}, "m", i3)},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
|
|
@ -275,8 +275,7 @@ TEST_P(ResolverIntrinsicTest_StorageTextureOperation, TextureLoadRo) {
|
|||
|
||||
auto* coords_type = GetCoordsType(dim, ty.i32());
|
||||
auto* texture_type = ty.storage_texture(dim, format);
|
||||
auto* ro_texture_type =
|
||||
ty.access(ast::AccessControl::kReadOnly, texture_type);
|
||||
auto* ro_texture_type = ty.access(ast::AccessControl::kRead, texture_type);
|
||||
|
||||
ast::ExpressionList call_params;
|
||||
|
||||
|
@ -768,7 +767,7 @@ TEST_F(ResolverIntrinsicDataTest, ArrayLength_Vector) {
|
|||
auto* ary = ty.array<i32>();
|
||||
auto* str = Structure("S", {Member("x", ary)},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
|
|
@ -784,7 +784,7 @@ TEST_F(ResolverTest, Function_Parameters) {
|
|||
TEST_F(ResolverTest, Function_RegisterInputOutputVariables) {
|
||||
auto* s = Structure("S", {Member("m", ty.u32())},
|
||||
{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* 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) {
|
||||
auto* s = Structure("S", {Member("m", ty.u32())},
|
||||
{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* out_var = Global("out_var", ty.f32(), ast::StorageClass::kOutput);
|
||||
|
@ -1752,7 +1752,7 @@ TEST_F(ResolverTest, StorageClass_SetForSampler) {
|
|||
|
||||
TEST_F(ResolverTest, StorageClass_SetForTexture) {
|
||||
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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
|
|
@ -229,7 +229,7 @@ ast::Type* ast_alias(const ProgramBuilder::TypesBuilder& ty) {
|
|||
template <create_ast_type_func_ptr create_type>
|
||||
ast::Type* ast_access(const ProgramBuilder::TypesBuilder& 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) {
|
||||
|
|
|
@ -69,7 +69,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferArray) {
|
|||
// var<storage> g : [[access(read)]] array<S, 3>;
|
||||
auto* s = Structure("S", {Member("a", ty.f32())});
|
||||
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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -121,7 +121,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoBlockDecoration) {
|
|||
// struct S { x : i32 };
|
||||
// var<storage> g : [[access(read)]] S;
|
||||
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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -141,7 +141,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Basic) {
|
|||
// var<storage> g : [[access(read)]] S;
|
||||
auto* s = Structure("S", {Member(Source{{12, 34}}, "x", ty.i32())},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -160,7 +160,7 @@ TEST_F(ResolverStorageClassValidationTest, StorageBufferNoError_Aliases) {
|
|||
{create<ast::StructBlockDecoration>()});
|
||||
auto* a1 = ty.alias("a1", s);
|
||||
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);
|
||||
AST().AddConstructedType(a2);
|
||||
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>;
|
||||
auto* s = Structure("S", {Member("a", ty.f32())});
|
||||
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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
|
|
@ -172,7 +172,7 @@ TEST_F(ResolverStorageClassUseTest, StructReachableViaLocalArray) {
|
|||
TEST_F(ResolverStorageClassUseTest, StructMultipleStorageClassUses) {
|
||||
auto* s = Structure("S", {Member("a", ty.f32())},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
|
|
@ -519,7 +519,7 @@ TEST_P(StorageTextureDimensionTest, All) {
|
|||
auto& params = GetParam();
|
||||
|
||||
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,
|
||||
ast::DecorationList{
|
||||
|
@ -595,7 +595,7 @@ TEST_P(StorageTextureFormatTest, All) {
|
|||
// var d : [[access(read)]] texture_storage_3d<*>;
|
||||
|
||||
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,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -603,7 +603,7 @@ TEST_P(StorageTextureFormatTest, All) {
|
|||
});
|
||||
|
||||
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,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -612,7 +612,7 @@ TEST_P(StorageTextureFormatTest, All) {
|
|||
|
||||
auto* st_c =
|
||||
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,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -620,7 +620,7 @@ TEST_P(StorageTextureFormatTest, All) {
|
|||
});
|
||||
|
||||
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,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -687,7 +687,7 @@ TEST_F(StorageTextureAccessControlTest, ReadOnlyAccessControl_Pass) {
|
|||
|
||||
auto* st = ty.storage_texture(ast::TextureDimension::k1d,
|
||||
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,
|
||||
ast::DecorationList{
|
||||
|
@ -704,7 +704,7 @@ TEST_F(StorageTextureAccessControlTest, WriteOnlyAccessControl_Pass) {
|
|||
|
||||
auto* st = ty.storage_texture(ast::TextureDimension::k1d,
|
||||
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,
|
||||
ast::DecorationList{
|
||||
|
|
|
@ -128,9 +128,9 @@ fn f() {
|
|||
data.Add<BindingRemapper::Remappings>(
|
||||
BindingRemapper::BindingPoints{},
|
||||
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
|
||||
{{4, 3}, ast::AccessControl::kReadOnly}, // Add access control
|
||||
{{4, 3}, ast::AccessControl::kRead}, // Add access control
|
||||
});
|
||||
auto got = Run<BindingRemapper>(src, data);
|
||||
|
||||
|
@ -188,9 +188,9 @@ fn f() {
|
|||
data.Add<BindingRemapper::Remappings>(
|
||||
BindingRemapper::BindingPoints{},
|
||||
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
|
||||
{{4, 3}, ast::AccessControl::kReadOnly}, // Add access control
|
||||
{{4, 3}, ast::AccessControl::kRead}, // Add access control
|
||||
});
|
||||
auto got = Run<BindingRemapper>(src, data);
|
||||
|
||||
|
@ -233,8 +233,8 @@ fn f() {
|
|||
{{3, 2}, {6, 7}},
|
||||
},
|
||||
BindingRemapper::AccessControls{
|
||||
{{2, 1}, ast::AccessControl::kWriteOnly},
|
||||
{{3, 2}, ast::AccessControl::kWriteOnly},
|
||||
{{2, 1}, ast::AccessControl::kWrite},
|
||||
{{3, 2}, ast::AccessControl::kWrite},
|
||||
});
|
||||
auto got = Run<BindingRemapper>(src, data);
|
||||
|
||||
|
|
|
@ -214,8 +214,7 @@ struct State {
|
|||
ctx.dst->create<ast::StructBlockDecoration>(),
|
||||
});
|
||||
for (uint32_t i = 0; i < cfg.vertex_state.size(); ++i) {
|
||||
auto* access =
|
||||
ctx.dst->ty.access(ast::AccessControl::kReadOnly, struct_type);
|
||||
auto* access = ctx.dst->ty.access(ast::AccessControl::kRead, struct_type);
|
||||
// The decorated variable with struct type
|
||||
ctx.dst->Global(
|
||||
GetVertexBufferName(i), access, ast::StorageClass::kStorage, nullptr,
|
||||
|
|
|
@ -1753,8 +1753,7 @@ bool GeneratorImpl::EmitEntryPointData(
|
|||
|
||||
out << " " << builder_.Symbols().NameFor(decl->symbol())
|
||||
<< RegisterAndSpace(
|
||||
var->AccessControl() == ast::AccessControl::kReadOnly ? 't'
|
||||
: 'u',
|
||||
var->AccessControl() == ast::AccessControl::kRead ? 't' : 'u',
|
||||
binding_point)
|
||||
<< ";" << std::endl;
|
||||
emitted_storagebuffer = true;
|
||||
|
@ -1917,7 +1916,7 @@ bool GeneratorImpl::EmitEntryPointData(
|
|||
if (unwrapped_type->Is<sem::Texture>()) {
|
||||
register_space = "t";
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
@ -2330,7 +2329,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
ast::AccessControl::Access access_control,
|
||||
const std::string& name) {
|
||||
if (storage_class == ast::StorageClass::kStorage) {
|
||||
if (access_control != ast::AccessControl::kReadOnly) {
|
||||
if (access_control != ast::AccessControl::kRead) {
|
||||
out << "RW";
|
||||
}
|
||||
out << "ByteAddressBuffer";
|
||||
|
@ -2396,7 +2395,7 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
|||
auto* sampled = tex->As<sem::SampledTexture>();
|
||||
|
||||
if (storage) {
|
||||
if (access_control != ast::AccessControl::kReadOnly) {
|
||||
if (access_control != ast::AccessControl::kRead) {
|
||||
out << "RW";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
},
|
||||
{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,
|
||||
{
|
||||
|
@ -518,7 +518,7 @@ TEST_F(HlslGeneratorImplTest_Function,
|
|||
},
|
||||
{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,
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ TEST_F(HlslSanitizerTest, ArrayLength) {
|
|||
{
|
||||
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,
|
||||
{
|
||||
|
|
|
@ -553,9 +553,8 @@ TEST_P(HlslStorageTexturesTest, Emit) {
|
|||
auto params = GetParam();
|
||||
|
||||
auto* t = ty.storage_texture(params.dim, params.imgfmt);
|
||||
auto* ac = ty.access(params.ro ? ast::AccessControl::kReadOnly
|
||||
: ast::AccessControl::kWriteOnly,
|
||||
t);
|
||||
auto* ac = ty.access(
|
||||
params.ro ? ast::AccessControl::kRead : ast::AccessControl::kWrite, t);
|
||||
|
||||
Global("tex", ac, ast::StorageClass::kNone, nullptr,
|
||||
ast::DecorationList{
|
||||
|
|
|
@ -1288,7 +1288,7 @@ bool GeneratorImpl::EmitFunctionInternal(ast::Function* func,
|
|||
}
|
||||
first = false;
|
||||
|
||||
if (var->AccessControl() == ast::AccessControl::kReadOnly) {
|
||||
if (var->AccessControl() == ast::AccessControl::kRead) {
|
||||
out_ << "const ";
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1506,7 @@ bool GeneratorImpl::EmitEntryPointFunction(ast::Function* func) {
|
|||
auto* binding = data.second.binding;
|
||||
// auto* set = data.second.set;
|
||||
|
||||
if (var->AccessControl() == ast::AccessControl::kReadOnly) {
|
||||
if (var->AccessControl() == ast::AccessControl::kRead) {
|
||||
out_ << "const ";
|
||||
}
|
||||
|
||||
|
@ -1988,9 +1988,9 @@ bool GeneratorImpl::EmitType(const sem::Type* type, const std::string& name) {
|
|||
}
|
||||
|
||||
std::string access_str;
|
||||
if (storage->access_control() == ast::AccessControl::kReadOnly) {
|
||||
if (storage->access_control() == ast::AccessControl::kRead) {
|
||||
out_ << ", access::read";
|
||||
} else if (storage->access_control() == ast::AccessControl::kWriteOnly) {
|
||||
} else if (storage->access_control() == ast::AccessControl::kWrite) {
|
||||
out_ << ", access::write";
|
||||
} else {
|
||||
diagnostics_.add_error("Invalid access control for storage texture");
|
||||
|
|
|
@ -351,7 +351,7 @@ TEST_F(MslGeneratorImplTest,
|
|||
},
|
||||
{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,
|
||||
{create<ast::BindingDecoration>(0), create<ast::GroupDecoration>(1)});
|
||||
|
@ -663,7 +663,7 @@ TEST_F(MslGeneratorImplTest,
|
|||
},
|
||||
{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,
|
||||
{create<ast::BindingDecoration>(0), create<ast::GroupDecoration>(1)});
|
||||
|
|
|
@ -232,7 +232,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_NonComposites) {
|
|||
},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
|
||||
Global("G", ty.access(ast::AccessControl::kReadOnly, s),
|
||||
Global("G", ty.access(ast::AccessControl::kRead, s),
|
||||
ast::StorageClass::kStorage, nullptr,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -342,7 +342,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_Structures) {
|
|||
},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
|
||||
Global("G", ty.access(ast::AccessControl::kReadOnly, s),
|
||||
Global("G", ty.access(ast::AccessControl::kRead, s),
|
||||
ast::StorageClass::kStorage, nullptr,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -437,7 +437,7 @@ TEST_F(MslGeneratorImplTest, EmitType_Struct_Layout_ArrayDefaultStride) {
|
|||
},
|
||||
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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -544,7 +544,7 @@ TEST_F(MslGeneratorImplTest, AttemptTintPadSymbolCollision) {
|
|||
},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
|
||||
Global("G", ty.access(ast::AccessControl::kReadOnly, s),
|
||||
Global("G", ty.access(ast::AccessControl::kRead, s),
|
||||
ast::StorageClass::kStorage, nullptr,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -610,7 +610,7 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithDecoration) {
|
|||
},
|
||||
{create<ast::StructBlockDecoration>()});
|
||||
|
||||
Global("G", ty.access(ast::AccessControl::kReadOnly, s),
|
||||
Global("G", ty.access(ast::AccessControl::kRead, s),
|
||||
ast::StorageClass::kStorage, nullptr,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -765,9 +765,8 @@ TEST_P(MslStorageTexturesTest, Emit) {
|
|||
auto params = GetParam();
|
||||
|
||||
auto* s = ty.storage_texture(params.dim, ast::ImageFormat::kR32Float);
|
||||
auto* ac = ty.access(params.ro ? ast::AccessControl::kReadOnly
|
||||
: ast::AccessControl::kWriteOnly,
|
||||
s);
|
||||
auto* ac = ty.access(
|
||||
params.ro ? ast::AccessControl::kRead : ast::AccessControl::kWrite, s);
|
||||
Global("test_var", ac, ast::StorageClass::kNone, nullptr,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
|
|
@ -788,12 +788,12 @@ bool Builder::GenerateGlobalVariable(ast::Variable* var) {
|
|||
if (type->Is<sem::StorageTexture>() || type->Is<sem::Struct>()) {
|
||||
// type is a sem::Struct or a sem::StorageTexture
|
||||
switch (sem->AccessControl()) {
|
||||
case ast::AccessControl::kWriteOnly:
|
||||
case ast::AccessControl::kWrite:
|
||||
push_annot(
|
||||
spv::Op::OpDecorate,
|
||||
{Operand::Int(var_id), Operand::Int(SpvDecorationNonReadable)});
|
||||
break;
|
||||
case ast::AccessControl::kReadOnly:
|
||||
case ast::AccessControl::kRead:
|
||||
push_annot(
|
||||
spv::Op::OpDecorate,
|
||||
{Operand::Int(var_id), Operand::Int(SpvDecorationNonWritable)});
|
||||
|
@ -3175,12 +3175,12 @@ uint32_t Builder::GenerateTypeIfNeeded(const sem::Type* type) {
|
|||
type_name_to_id_[builder_
|
||||
.create<sem::StorageTexture>(
|
||||
st->dim(), st->image_format(),
|
||||
ast::AccessControl::kReadOnly, st->type())
|
||||
ast::AccessControl::kRead, st->type())
|
||||
->type_name()] = id;
|
||||
type_name_to_id_[builder_
|
||||
.create<sem::StorageTexture>(
|
||||
st->dim(), st->image_format(),
|
||||
ast::AccessControl::kWriteOnly, st->type())
|
||||
ast::AccessControl::kWrite, st->type())
|
||||
->type_name()] = id;
|
||||
type_name_to_id_[builder_
|
||||
.create<sem::StorageTexture>(
|
||||
|
|
|
@ -402,7 +402,7 @@ TEST_F(BuilderTest, GlobalVar_DeclReadOnly) {
|
|||
Member("b", ty.i32()),
|
||||
},
|
||||
{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,
|
||||
{
|
||||
|
@ -444,7 +444,7 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasDeclReadOnly) {
|
|||
{create<ast::StructBlockDecoration>()});
|
||||
auto* B = ty.alias("B", A);
|
||||
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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -481,7 +481,7 @@ TEST_F(BuilderTest, GlobalVar_TypeAliasAssignReadOnly) {
|
|||
|
||||
auto* A = Structure("A", {Member("a", ty.i32())},
|
||||
{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);
|
||||
AST().AddConstructedType(B);
|
||||
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())},
|
||||
{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* 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,
|
||||
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,
|
||||
{
|
||||
|
@ -596,7 +596,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWriteOnly) {
|
|||
auto* type = ty.storage_texture(ast::TextureDimension::k2d,
|
||||
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,
|
||||
{
|
||||
|
@ -625,7 +625,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWithDifferentAccess) {
|
|||
// var<uniform_constant> a : [[access(read)]] 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,
|
||||
ast::ImageFormat::kR32Uint));
|
||||
auto* var_a = Global("a", type_a, ast::StorageClass::kNone, nullptr,
|
||||
|
@ -634,7 +634,7 @@ TEST_F(BuilderTest, GlobalVar_TextureStorageWithDifferentAccess) {
|
|||
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,
|
||||
ast::ImageFormat::kR32Uint));
|
||||
auto* var_b = Global("b", type_b, ast::StorageClass::kNone, nullptr,
|
||||
|
|
|
@ -1445,7 +1445,7 @@ OpFunctionEnd
|
|||
TEST_F(IntrinsicBuilderTest, Call_ArrayLength) {
|
||||
auto* s = Structure("my_struct", {Member(0, "a", ty.array<f32>(4))},
|
||||
{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,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(1),
|
||||
|
@ -1495,7 +1495,7 @@ TEST_F(IntrinsicBuilderTest, Call_ArrayLength_OtherMembersInStruct) {
|
|||
Member(4, "a", ty.array<f32>(4)),
|
||||
},
|
||||
{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,
|
||||
ast::DecorationList{
|
||||
create<ast::BindingDecoration>(1),
|
||||
|
|
|
@ -30,7 +30,7 @@ TEST_F(BuilderTest_Type, GenerateRuntimeArray) {
|
|||
auto* ary = ty.array(ty.i32(), 0);
|
||||
auto* str = Structure("S", {Member("x", ary)},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -52,7 +52,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedRuntimeArray) {
|
|||
auto* ary = ty.array(ty.i32(), 0);
|
||||
auto* str = Structure("S", {Member("x", ary)},
|
||||
{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,
|
||||
{
|
||||
create<ast::BindingDecoration>(0),
|
||||
|
@ -832,7 +832,7 @@ TEST_F(BuilderTest_Type, SampledTexture_Generate_CubeArray) {
|
|||
TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k1d,
|
||||
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,
|
||||
{
|
||||
|
@ -852,7 +852,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_1d) {
|
|||
TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k2d,
|
||||
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,
|
||||
{
|
||||
|
@ -872,7 +872,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2d) {
|
|||
TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k2dArray,
|
||||
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,
|
||||
{
|
||||
|
@ -892,7 +892,7 @@ TEST_F(BuilderTest_Type, StorageTexture_Generate_2dArray) {
|
|||
TEST_F(BuilderTest_Type, StorageTexture_Generate_3d) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k3d,
|
||||
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,
|
||||
{
|
||||
|
@ -913,7 +913,7 @@ TEST_F(BuilderTest_Type,
|
|||
StorageTexture_Generate_SampledTypeFloat_Format_r32float) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k2d,
|
||||
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,
|
||||
{
|
||||
|
@ -934,7 +934,7 @@ TEST_F(BuilderTest_Type,
|
|||
StorageTexture_Generate_SampledTypeSint_Format_r32sint) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k2d,
|
||||
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,
|
||||
{
|
||||
|
@ -955,7 +955,7 @@ TEST_F(BuilderTest_Type,
|
|||
StorageTexture_Generate_SampledTypeUint_Format_r32uint) {
|
||||
auto* s = ty.storage_texture(ast::TextureDimension::k2d,
|
||||
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,
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ TEST_F(WgslGeneratorImplTest, Emit_Global_Sampler) {
|
|||
|
||||
TEST_F(WgslGeneratorImplTest, Emit_Global_Texture) {
|
||||
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,
|
||||
{create<ast::GroupDecoration>(0), create<ast::BindingDecoration>(0)});
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_AccessControl_Read) {
|
|||
auto* s = Structure("S", {Member("a", ty.i32())},
|
||||
{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));
|
||||
|
||||
GeneratorImpl& gen = Build();
|
||||
|
@ -441,35 +441,35 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
testing::Values(
|
||||
StorageTextureData{ast::ImageFormat::kR8Unorm,
|
||||
ast::TextureDimension::k1d,
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
"[[access(read)]] texture_storage_1d<r8unorm>"},
|
||||
StorageTextureData{ast::ImageFormat::kR8Unorm,
|
||||
ast::TextureDimension::k2d,
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
"[[access(read)]] texture_storage_2d<r8unorm>"},
|
||||
StorageTextureData{
|
||||
ast::ImageFormat::kR8Unorm, ast::TextureDimension::k2dArray,
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
"[[access(read)]] texture_storage_2d_array<r8unorm>"},
|
||||
StorageTextureData{ast::ImageFormat::kR8Unorm,
|
||||
ast::TextureDimension::k3d,
|
||||
ast::AccessControl::kReadOnly,
|
||||
ast::AccessControl::kRead,
|
||||
"[[access(read)]] texture_storage_3d<r8unorm>"},
|
||||
StorageTextureData{ast::ImageFormat::kR8Unorm,
|
||||
ast::TextureDimension::k1d,
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
"[[access(write)]] texture_storage_1d<r8unorm>"},
|
||||
StorageTextureData{ast::ImageFormat::kR8Unorm,
|
||||
ast::TextureDimension::k2d,
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
"[[access(write)]] texture_storage_2d<r8unorm>"},
|
||||
StorageTextureData{
|
||||
ast::ImageFormat::kR8Unorm, ast::TextureDimension::k2dArray,
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
"[[access(write)]] texture_storage_2d_array<r8unorm>"},
|
||||
StorageTextureData{ast::ImageFormat::kR8Unorm,
|
||||
ast::TextureDimension::k3d,
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::AccessControl::kWrite,
|
||||
"[[access(write)]] texture_storage_3d<r8unorm>"}));
|
||||
|
||||
struct ImageFormatData {
|
||||
|
|
Loading…
Reference in New Issue