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";
case StorageClass::kStorage:
return "storage";
case StorageClass::kImage:
return "image";
case StorageClass::kPrivate:
return "private";
case StorageClass::kFunction:

View File

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

View File

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

View File

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

View File

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

View File

@ -833,22 +833,6 @@ TEST_F(SpvParserTest, ConvertType_PointerStorageBuffer) {
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) {
auto p = parser(test::Assemble(Preamble() + R"(
%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"};
if (str == "if")
return {Token::Type::kIf, source, "if"};
if (str == "image")
return {Token::Type::kImage, source, "image"};
if (str == "import")
return {Token::Type::kImport, source, "import"};
if (str == "let")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -553,7 +553,6 @@ INSTANTIATE_TEST_SUITE_P(
PtrData{ast::StorageClass::kUniformConstant,
SpvStorageClassUniformConstant},
PtrData{ast::StorageClass::kStorage, SpvStorageClassStorageBuffer},
PtrData{ast::StorageClass::kImage, SpvStorageClassImage},
PtrData{ast::StorageClass::kPrivate, SpvStorageClassPrivate},
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