Remove the "image" storage class

This doesn't exist in WGSL, and we don't have a supported path to
implement this in MSL.

This was preventing "image" from being used as an identifier.

Change-Id: I724e46c866a4dd488f45fbc1215ef23a67355a78
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78280
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
This commit is contained in:
James Price 2022-01-27 15:55:16 +00:00 committed by Tint LUCI CQ
parent c126bc95df
commit 792897422d
17 changed files with 16 additions and 76 deletions

View File

@ -35,8 +35,6 @@ const char* ToString(StorageClass sc) {
return "uniform_constant"; return "uniform_constant";
case StorageClass::kStorage: case StorageClass::kStorage:
return "storage"; return "storage";
case StorageClass::kImage:
return "image";
case StorageClass::kPrivate: case StorageClass::kPrivate:
return "private"; return "private";
case StorageClass::kFunction: case StorageClass::kFunction:

View File

@ -30,7 +30,6 @@ enum class StorageClass {
kWorkgroup, kWorkgroup,
kUniformConstant, kUniformConstant,
kStorage, kStorage,
kImage,
kPrivate, kPrivate,
kFunction kFunction
}; };

View File

@ -52,8 +52,6 @@ ast::StorageClass EnumConverter::ToStorageClass(const SpvStorageClass sc) {
return ast::StorageClass::kNone; return ast::StorageClass::kNone;
case SpvStorageClassStorageBuffer: case SpvStorageClassStorageBuffer:
return ast::StorageClass::kStorage; return ast::StorageClass::kStorage;
case SpvStorageClassImage:
return ast::StorageClass::kImage;
case SpvStorageClassPrivate: case SpvStorageClassPrivate:
return ast::StorageClass::kPrivate; return ast::StorageClass::kPrivate;
case SpvStorageClassFunction: case SpvStorageClassFunction:

View File

@ -134,8 +134,8 @@ TEST_P(SpvStorageClassTest, Samples) {
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
EnumConverterGood, EnumConverterGood,
SpvStorageClassTest, SpvStorageClassTest,
testing::Values( testing::Values(StorageClassCase{SpvStorageClassInput, true,
StorageClassCase{SpvStorageClassInput, true, ast::StorageClass::kInput}, ast::StorageClass::kInput},
StorageClassCase{SpvStorageClassOutput, true, StorageClassCase{SpvStorageClassOutput, true,
ast::StorageClass::kOutput}, ast::StorageClass::kOutput},
StorageClassCase{SpvStorageClassUniform, true, StorageClassCase{SpvStorageClassUniform, true,
@ -146,7 +146,6 @@ INSTANTIATE_TEST_SUITE_P(
ast::StorageClass::kNone}, ast::StorageClass::kNone},
StorageClassCase{SpvStorageClassStorageBuffer, true, StorageClassCase{SpvStorageClassStorageBuffer, true,
ast::StorageClass::kStorage}, ast::StorageClass::kStorage},
StorageClassCase{SpvStorageClassImage, true, ast::StorageClass::kImage},
StorageClassCase{SpvStorageClassPrivate, true, StorageClassCase{SpvStorageClassPrivate, true,
ast::StorageClass::kPrivate}, ast::StorageClass::kPrivate},
StorageClassCase{SpvStorageClassFunction, true, StorageClassCase{SpvStorageClassFunction, true,

View File

@ -1483,7 +1483,6 @@ bool ParserImpl::EmitModuleScopeVariables() {
case ast::StorageClass::kUniform: case ast::StorageClass::kUniform:
case ast::StorageClass::kUniformConstant: case ast::StorageClass::kUniformConstant:
case ast::StorageClass::kStorage: case ast::StorageClass::kStorage:
case ast::StorageClass::kImage:
case ast::StorageClass::kWorkgroup: case ast::StorageClass::kWorkgroup:
case ast::StorageClass::kPrivate: case ast::StorageClass::kPrivate:
break; break;

View File

@ -833,22 +833,6 @@ TEST_F(SpvParserTest, ConvertType_PointerStorageBuffer) {
EXPECT_TRUE(p->error().empty()); EXPECT_TRUE(p->error().empty());
} }
TEST_F(SpvParserTest, ConvertType_PointerImage) {
auto p = parser(test::Assemble(Preamble() + R"(
%float = OpTypeFloat 32
%3 = OpTypePointer Image %float
)" + MainBody()));
EXPECT_TRUE(p->BuildInternalModule());
auto* type = p->ConvertType(3);
EXPECT_TRUE(type->Is<Pointer>());
auto* ptr_ty = type->As<Pointer>();
EXPECT_NE(ptr_ty, nullptr);
EXPECT_TRUE(ptr_ty->type->Is<F32>());
EXPECT_EQ(ptr_ty->storage_class, ast::StorageClass::kImage);
EXPECT_TRUE(p->error().empty());
}
TEST_F(SpvParserTest, ConvertType_PointerPrivate) { TEST_F(SpvParserTest, ConvertType_PointerPrivate) {
auto p = parser(test::Assemble(Preamble() + R"( auto p = parser(test::Assemble(Preamble() + R"(
%float = OpTypeFloat 32 %float = OpTypeFloat 32

View File

@ -971,8 +971,6 @@ Token Lexer::check_keyword(const Source& source, std::string_view str) {
return {Token::Type::kI32, source, "i32"}; return {Token::Type::kI32, source, "i32"};
if (str == "if") if (str == "if")
return {Token::Type::kIf, source, "if"}; return {Token::Type::kIf, source, "if"};
if (str == "image")
return {Token::Type::kImage, source, "image"};
if (str == "import") if (str == "import")
return {Token::Type::kImport, source, "import"}; return {Token::Type::kImport, source, "import"};
if (str == "let") if (str == "let")

View File

@ -738,7 +738,6 @@ INSTANTIATE_TEST_SUITE_P(
TokenData{"function", Token::Type::kFunction}, TokenData{"function", Token::Type::kFunction},
TokenData{"i32", Token::Type::kI32}, TokenData{"i32", Token::Type::kI32},
TokenData{"if", Token::Type::kIf}, TokenData{"if", Token::Type::kIf},
TokenData{"image", Token::Type::kImage},
TokenData{"import", Token::Type::kImport}, TokenData{"import", Token::Type::kImport},
TokenData{"let", Token::Type::kLet}, TokenData{"let", Token::Type::kLet},
TokenData{"loop", Token::Type::kLoop}, TokenData{"loop", Token::Type::kLoop},

View File

@ -1156,7 +1156,6 @@ Expect<const ast::Type*> ParserImpl::expect_type_decl_matrix(Token t) {
// | UNIFORM // | UNIFORM
// | WORKGROUP // | WORKGROUP
// | STORAGE // | STORAGE
// | IMAGE
// | PRIVATE // | PRIVATE
// | FUNCTION // | FUNCTION
Expect<ast::StorageClass> ParserImpl::expect_storage_class( Expect<ast::StorageClass> ParserImpl::expect_storage_class(
@ -1172,9 +1171,6 @@ Expect<ast::StorageClass> ParserImpl::expect_storage_class(
if (match(Token::Type::kStorage)) if (match(Token::Type::kStorage))
return {ast::StorageClass::kStorage, source}; return {ast::StorageClass::kStorage, source};
if (match(Token::Type::kImage))
return {ast::StorageClass::kImage, source};
if (match(Token::Type::kPrivate)) if (match(Token::Type::kPrivate))
return {ast::StorageClass::kPrivate, source}; return {ast::StorageClass::kPrivate, source};

View File

@ -50,7 +50,6 @@ INSTANTIATE_TEST_SUITE_P(
StorageClassData{"workgroup", ast::StorageClass::kWorkgroup}, StorageClassData{"workgroup", ast::StorageClass::kWorkgroup},
StorageClassData{"storage", ast::StorageClass::kStorage}, StorageClassData{"storage", ast::StorageClass::kStorage},
StorageClassData{"storage_buffer", ast::StorageClass::kStorage}, StorageClassData{"storage_buffer", ast::StorageClass::kStorage},
StorageClassData{"image", ast::StorageClass::kImage},
StorageClassData{"private", ast::StorageClass::kPrivate}, StorageClassData{"private", ast::StorageClass::kPrivate},
StorageClassData{"function", ast::StorageClass::kFunction})); StorageClassData{"function", ast::StorageClass::kFunction}));

View File

@ -58,8 +58,6 @@ INSTANTIATE_TEST_SUITE_P(
ast::Access::kUndefined}, ast::Access::kUndefined},
VariableStorageData{"storage_buffer", ast::StorageClass::kStorage, VariableStorageData{"storage_buffer", ast::StorageClass::kStorage,
ast::Access::kUndefined}, ast::Access::kUndefined},
VariableStorageData{"image", ast::StorageClass::kImage,
ast::Access::kUndefined},
VariableStorageData{"private", ast::StorageClass::kPrivate, VariableStorageData{"private", ast::StorageClass::kPrivate,
ast::Access::kUndefined}, ast::Access::kUndefined},
VariableStorageData{"function", ast::StorageClass::kFunction, VariableStorageData{"function", ast::StorageClass::kFunction,

View File

@ -153,8 +153,6 @@ std::string_view Token::TypeToName(Type type) {
return "i32"; return "i32";
case Token::Type::kIf: case Token::Type::kIf:
return "if"; return "if";
case Token::Type::kImage:
return "image";
case Token::Type::kImport: case Token::Type::kImport:
return "import"; return "import";
case Token::Type::kLet: case Token::Type::kLet:

View File

@ -163,8 +163,6 @@ class Token {
kI32, kI32,
/// A 'if' /// A 'if'
kIf, kIf,
/// A 'image'
kImage,
/// A 'import' /// A 'import'
kImport, kImport,
/// A 'let' /// A 'let'

View File

@ -823,7 +823,6 @@ INSTANTIATE_TEST_SUITE_P(
TestParams{ast::StorageClass::kWorkgroup, true}, TestParams{ast::StorageClass::kWorkgroup, true},
TestParams{ast::StorageClass::kUniformConstant, false}, TestParams{ast::StorageClass::kUniformConstant, false},
TestParams{ast::StorageClass::kStorage, false}, TestParams{ast::StorageClass::kStorage, false},
TestParams{ast::StorageClass::kImage, false},
TestParams{ast::StorageClass::kPrivate, true}, TestParams{ast::StorageClass::kPrivate, true},
TestParams{ast::StorageClass::kFunction, true})); TestParams{ast::StorageClass::kFunction, true}));

View File

@ -4219,8 +4219,6 @@ SpvStorageClass Builder::ConvertStorageClass(ast::StorageClass klass) const {
return SpvStorageClassUniformConstant; return SpvStorageClassUniformConstant;
case ast::StorageClass::kStorage: case ast::StorageClass::kStorage:
return SpvStorageClassStorageBuffer; return SpvStorageClassStorageBuffer;
case ast::StorageClass::kImage:
return SpvStorageClassImage;
case ast::StorageClass::kPrivate: case ast::StorageClass::kPrivate:
return SpvStorageClassPrivate; return SpvStorageClassPrivate;
case ast::StorageClass::kFunction: case ast::StorageClass::kFunction:

View File

@ -553,7 +553,6 @@ INSTANTIATE_TEST_SUITE_P(
PtrData{ast::StorageClass::kUniformConstant, PtrData{ast::StorageClass::kUniformConstant,
SpvStorageClassUniformConstant}, SpvStorageClassUniformConstant},
PtrData{ast::StorageClass::kStorage, SpvStorageClassStorageBuffer}, PtrData{ast::StorageClass::kStorage, SpvStorageClassStorageBuffer},
PtrData{ast::StorageClass::kImage, SpvStorageClassImage},
PtrData{ast::StorageClass::kPrivate, SpvStorageClassPrivate}, PtrData{ast::StorageClass::kPrivate, SpvStorageClassPrivate},
PtrData{ast::StorageClass::kFunction, SpvStorageClassFunction})); PtrData{ast::StorageClass::kFunction, SpvStorageClassFunction}));

View File

@ -1,19 +0,0 @@
; Test: SpvParserTest_ConvertType_PointerImage.spvasm
; SPIR-V
; Version: 1.0
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 7
; Schema: 0
OpCapability Shader
OpMemoryModel Logical Simple
OpEntryPoint Fragment %1 "x_100"
OpExecutionMode %1 OriginUpperLeft
%float = OpTypeFloat 32
%_ptr_Image_float = OpTypePointer Image %float
%void = OpTypeVoid
%5 = OpTypeFunction %void
%1 = OpFunction %void None %5
%6 = OpLabel
OpReturn
OpFunctionEnd