[spirv-reader] Drop NonWritable NonReadable for now
Pending WGSL issue https://github.com/gpuweb/gpuweb/issues/935 Bug: tint:3, tint:99 Change-Id: I90771e6e0c6a2f109fd6e361d79adea273ca7bc6 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25261 Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
c8af502c01
commit
747e80a9b3
|
@ -375,6 +375,11 @@ ParserImpl::ConvertMemberDecoration(const Decoration& decoration) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return std::make_unique<ast::StructMemberOffsetDecoration>(decoration[1]);
|
return std::make_unique<ast::StructMemberOffsetDecoration>(decoration[1]);
|
||||||
|
case SpvDecorationNonReadable:
|
||||||
|
case SpvDecorationNonWritable:
|
||||||
|
// TODO(dneto): Drop these for now.
|
||||||
|
// https://github.com/gpuweb/gpuweb/issues/935
|
||||||
|
return nullptr;
|
||||||
default:
|
default:
|
||||||
// TODO(dneto): Support the remaining member decorations.
|
// TODO(dneto): Support the remaining member decorations.
|
||||||
break;
|
break;
|
||||||
|
@ -744,11 +749,12 @@ ast::type::Type* ParserImpl::ConvertType(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
auto ast_member_decoration = ConvertMemberDecoration(decoration);
|
auto ast_member_decoration = ConvertMemberDecoration(decoration);
|
||||||
if (ast_member_decoration == nullptr) {
|
if (!success_) {
|
||||||
// Already emitted diagnostics.
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
ast_member_decorations.push_back(std::move(ast_member_decoration));
|
if (ast_member_decoration) {
|
||||||
|
ast_member_decorations.push_back(std::move(ast_member_decoration));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto member_name = namer_.GetMemberName(type_id, member_index);
|
const auto member_name = namer_.GetMemberName(type_id, member_index);
|
||||||
|
|
|
@ -182,8 +182,9 @@ class ParserImpl : Reader {
|
||||||
DecorationList GetDecorationsForMember(uint32_t id,
|
DecorationList GetDecorationsForMember(uint32_t id,
|
||||||
uint32_t member_index) const;
|
uint32_t member_index) const;
|
||||||
|
|
||||||
/// Converts a SPIR-V decoration. On failure, emits a diagnostic and returns
|
/// Converts a SPIR-V decoration. If the decoration is recognized but
|
||||||
/// nullptr.
|
/// deliberately dropped, then returns nullptr without a diagnostic.
|
||||||
|
/// On failure, emits a diagnostic and returns nullptr.
|
||||||
/// @param decoration an encoded SPIR-V Decoration
|
/// @param decoration an encoded SPIR-V Decoration
|
||||||
/// @returns the corresponding ast::StructuMemberDecoration
|
/// @returns the corresponding ast::StructuMemberDecoration
|
||||||
std::unique_ptr<ast::StructMemberDecoration> ConvertMemberDecoration(
|
std::unique_ptr<ast::StructMemberDecoration> ConvertMemberDecoration(
|
||||||
|
|
|
@ -1292,6 +1292,50 @@ TEST_F(SpvParserTest,
|
||||||
"instruction, found '4'."));
|
"instruction, found '4'."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(SpvParserTest, ModuleScopeVar_NonReadableDecoration_DroppedForNow) {
|
||||||
|
auto* p = parser(test::Assemble(R"(
|
||||||
|
OpName %myvar "myvar"
|
||||||
|
OpDecorate %strct Block
|
||||||
|
OpMemberDecorate %strct 0 NonReadable
|
||||||
|
)" + CommonTypes() + R"(
|
||||||
|
%ptr_sb_strct = OpTypePointer StorageBuffer %strct
|
||||||
|
%myvar = OpVariable %ptr_sb_strct StorageBuffer
|
||||||
|
)"));
|
||||||
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
|
EXPECT_TRUE(p->error().empty());
|
||||||
|
const auto module_str = p->module().to_str();
|
||||||
|
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||||
|
Variable{
|
||||||
|
myvar
|
||||||
|
storage_buffer
|
||||||
|
__alias_S__struct_S
|
||||||
|
}
|
||||||
|
S -> __struct_S
|
||||||
|
})")) << module_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SpvParserTest, ModuleScopeVar_NonWritableDecoration_DroppedForNow) {
|
||||||
|
auto* p = parser(test::Assemble(R"(
|
||||||
|
OpName %myvar "myvar"
|
||||||
|
OpDecorate %strct Block
|
||||||
|
OpMemberDecorate %strct 0 NonWritable
|
||||||
|
)" + CommonTypes() + R"(
|
||||||
|
%ptr_sb_strct = OpTypePointer StorageBuffer %strct
|
||||||
|
%myvar = OpVariable %ptr_sb_strct StorageBuffer
|
||||||
|
)"));
|
||||||
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
|
EXPECT_TRUE(p->error().empty());
|
||||||
|
const auto module_str = p->module().to_str();
|
||||||
|
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||||
|
Variable{
|
||||||
|
myvar
|
||||||
|
storage_buffer
|
||||||
|
__alias_S__struct_S
|
||||||
|
}
|
||||||
|
S -> __struct_S
|
||||||
|
})")) << module_str;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace spirv
|
} // namespace spirv
|
||||||
} // namespace reader
|
} // namespace reader
|
||||||
|
|
Loading…
Reference in New Issue