[spirv-reader] Set entry point name

Until now, we were only setting the function name.

Bug: tint:3
Change-Id: I6d82f6e9744201a04cc8969013694e2e8304a928
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28080
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc
index 70aed3b..7771643 100644
--- a/src/reader/spirv/parser_impl.cc
+++ b/src/reader/spirv/parser_impl.cc
@@ -613,10 +613,11 @@
        module_->entry_points()) {
     const auto stage = SpvExecutionModel(entry_point.GetSingleWordInOperand(0));
     const uint32_t function_id = entry_point.GetSingleWordInOperand(1);
+    const std::string ep_name = entry_point.GetOperand(2).AsString();
     const std::string name = namer_.GetName(function_id);
 
     ast_module_.AddEntryPoint(std::make_unique<ast::EntryPoint>(
-        enum_converter_.ToPipelineStage(stage), "", name));
+        enum_converter_.ToPipelineStage(stage), ep_name, name));
   }
   // The enum conversion could have failed, so return the existing status value.
   return success_;
diff --git a/src/reader/spirv/parser_impl_entry_point_test.cc b/src/reader/spirv/parser_impl_entry_point_test.cc
index 998f0cf..30dbebc 100644
--- a/src/reader/spirv/parser_impl_entry_point_test.cc
+++ b/src/reader/spirv/parser_impl_entry_point_test.cc
@@ -47,7 +47,8 @@
   EXPECT_TRUE(p->BuildAndParseInternalModule());
   EXPECT_TRUE(p->error().empty());
   const auto module_str = p->module().to_str();
-  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{vertex = foobar})"));
+  EXPECT_THAT(module_str,
+              HasSubstr(R"(EntryPoint{vertex as foobar = foobar})"));
 }
 
 TEST_F(SpvParserTest, EntryPoint_Fragment) {
@@ -55,7 +56,8 @@
   EXPECT_TRUE(p->BuildAndParseInternalModule());
   EXPECT_TRUE(p->error().empty());
   const auto module_str = p->module().to_str();
-  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{fragment = blitz})"));
+  EXPECT_THAT(module_str,
+              HasSubstr(R"(EntryPoint{fragment as blitz = blitz})"));
 }
 
 TEST_F(SpvParserTest, EntryPoint_Compute) {
@@ -63,7 +65,7 @@
   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 = sort})"));
+  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{compute as sort = sort})"));
 }
 
 TEST_F(SpvParserTest, EntryPoint_MultiNameConflict) {
@@ -73,9 +75,10 @@
   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 = work})"));
-  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{vertex = work_1})"));
-  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{fragment = work_2})"));
+  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{compute as work = work})"));
+  EXPECT_THAT(module_str, HasSubstr(R"(EntryPoint{vertex as work = work_1})"));
+  EXPECT_THAT(module_str,
+              HasSubstr(R"(EntryPoint{fragment as work = work_2})"));
 }
 
 TEST_F(SpvParserTest, EntryPoint_NameIsSanitized) {
@@ -83,7 +86,8 @@
   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 = x_1234})"));
+  EXPECT_THAT(module_str,
+              HasSubstr(R"(EntryPoint{compute as .1234 = x_1234})"));
 }
 
 }  // namespace