reader::spirv fix entry point tests
Define the ID targeted by the entry point. Do this to avoid
asserts in the optimizer code
Bug: tint:3
Change-Id: Idbd4c8a058f2d51ff44696d2029502044d01b424
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17562
Reviewed-by: dan sinclair <dsinclair@google.com>
diff --git a/src/reader/spirv/parser_impl_entry_point_test.cc b/src/reader/spirv/parser_impl_entry_point_test.cc
index 0e772a4..9542a80 100644
--- a/src/reader/spirv/parser_impl_entry_point_test.cc
+++ b/src/reader/spirv/parser_impl_entry_point_test.cc
@@ -30,8 +30,9 @@
std::string MakeEntryPoint(const std::string& stage,
const std::string& name,
const std::string& id = "42") {
- return std::string("OpEntryPoint ") + stage + " %" + id + "2 \"" + name +
- "\"\n";
+ return std::string("OpEntryPoint ") + stage + " %" + id + " \"" + name +
+ "\"\n" + // Give the target ID a definition.
+ "%" + id + " = OpTypeVoid\n";
}
TEST_F(SpvParseImport, NoEntryPoint) {
@@ -43,11 +44,11 @@
}
TEST_F(SpvParseImport, EntryPointVertex) {
- ParserImpl p(test::Assemble(MakeEntryPoint("GLCompute", "foobar")));
+ ParserImpl p(test::Assemble(MakeEntryPoint("Vertex", "foobar")));
EXPECT_TRUE(p.BuildAndParseInternalModule());
EXPECT_TRUE(p.error().empty());
const auto module_str = p.module().to_str();
- EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{compute = foobar})"));
+ EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{vertex = foobar})"));
}
TEST_F(SpvParseImport, EntryPointFragment) {