diff --git a/docs/tint/origin-trial-changes.md b/docs/tint/origin-trial-changes.md index 55758aeb79..85a12efa61 100644 --- a/docs/tint/origin-trial-changes.md +++ b/docs/tint/origin-trial-changes.md @@ -1,5 +1,16 @@ # Tint changes during Origin Trial +## Changes for M105 + +### Deprecated Features + +* The `@stage` attribute has been deprecated. The short forms should be used + instead (`@vertex`, `@fragment`, or `@compute`). [tint:1503](crbug.com/tint/1503) + +## Changes for M104 + +* Parsing of `@compute`, `@fragment` and `@vertex` added. + ## Changes for M103 ### New features diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc index a28b7987fb..7fd1a810e3 100644 --- a/src/tint/reader/wgsl/parser_impl.cc +++ b/src/tint/reader/wgsl/parser_impl.cc @@ -3251,6 +3251,7 @@ Maybe ParserImpl::attribute() { }); } + // TODO(crbug.com/tint/1503): Remove when deprecation period is over. if (t == kStageAttribute) { return expect_paren_block("stage attribute", [&]() -> Result { auto stage = expect_pipeline_stage(); @@ -3258,26 +3259,22 @@ Maybe ParserImpl::attribute() { return Failure::kErrored; } - // TODO(crbug.com/tint/1503): Enable this once all the Dawn and CTS - // tests are updated to use the new format so we can avoid spamming - // the log files. - if ((false)) { - std::string warning = "stage should use @"; - switch (stage.value) { - case ast::PipelineStage::kVertex: - warning += "vertex"; - break; - case ast::PipelineStage::kFragment: - warning += "fragment"; - break; - case ast::PipelineStage::kCompute: - warning += "compute"; - break; - case ast::PipelineStage::kNone: - break; - } - deprecated(t.source(), warning); + std::string warning = "remove stage and use @"; + switch (stage.value) { + case ast::PipelineStage::kVertex: + warning += "vertex"; + break; + case ast::PipelineStage::kFragment: + warning += "fragment"; + break; + case ast::PipelineStage::kCompute: + warning += "compute"; + break; + case ast::PipelineStage::kNone: + break; } + deprecated(t.source(), warning); + return create(t.source(), stage.value); }); } diff --git a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc index ab97d94128..972e118c0e 100644 --- a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc +++ b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc @@ -316,8 +316,13 @@ TEST_F(ParserImplErrorTest, FunctionDeclStageMissingLParen) { } TEST_F(ParserImplErrorTest, FunctionDeclStageMissingRParen) { - EXPECT("@stage(vertex fn f() {}", - R"(test.wgsl:1:15 error: expected ')' for stage attribute + EXPECT( + "@stage(vertex fn f() {}", + R"(test.wgsl:1:2 warning: use of deprecated language feature: remove stage and use @vertex +@stage(vertex fn f() {} + ^^^^^ + +test.wgsl:1:15 error: expected ')' for stage attribute @stage(vertex fn f() {} ^^ )"); diff --git a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc index 44f3d78372..a32e140797 100644 --- a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc +++ b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc @@ -263,7 +263,8 @@ TEST_F(ParserImplTest, Attribute_Stage_MissingRightParen) { EXPECT_TRUE(attr.errored); EXPECT_EQ(attr.value, nullptr); EXPECT_TRUE(p->has_error()); - EXPECT_EQ(p->error(), "1:14: expected ')' for stage attribute"); + EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: remove stage and use @compute +1:14: expected ')' for stage attribute)"); } TEST_F(ParserImplTest, Attribute_Compute) {