Emit deprecation warnings for @stage.
This PR enables the deprecation warnings for the @stage builtin. Bug: tint:1503 Change-Id: I4a560f451a9ad56bc712f6a04c18eba6ae67ab64 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93121 Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
125ce575b9
commit
0fa572ff05
|
@ -1,5 +1,16 @@
|
||||||
# Tint changes during Origin Trial
|
# 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
|
## Changes for M103
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
|
@ -3251,6 +3251,7 @@ Maybe<const ast::Attribute*> ParserImpl::attribute() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(crbug.com/tint/1503): Remove when deprecation period is over.
|
||||||
if (t == kStageAttribute) {
|
if (t == kStageAttribute) {
|
||||||
return expect_paren_block("stage attribute", [&]() -> Result {
|
return expect_paren_block("stage attribute", [&]() -> Result {
|
||||||
auto stage = expect_pipeline_stage();
|
auto stage = expect_pipeline_stage();
|
||||||
|
@ -3258,26 +3259,22 @@ Maybe<const ast::Attribute*> ParserImpl::attribute() {
|
||||||
return Failure::kErrored;
|
return Failure::kErrored;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(crbug.com/tint/1503): Enable this once all the Dawn and CTS
|
std::string warning = "remove stage and use @";
|
||||||
// tests are updated to use the new format so we can avoid spamming
|
switch (stage.value) {
|
||||||
// the log files.
|
case ast::PipelineStage::kVertex:
|
||||||
if ((false)) {
|
warning += "vertex";
|
||||||
std::string warning = "stage should use @";
|
break;
|
||||||
switch (stage.value) {
|
case ast::PipelineStage::kFragment:
|
||||||
case ast::PipelineStage::kVertex:
|
warning += "fragment";
|
||||||
warning += "vertex";
|
break;
|
||||||
break;
|
case ast::PipelineStage::kCompute:
|
||||||
case ast::PipelineStage::kFragment:
|
warning += "compute";
|
||||||
warning += "fragment";
|
break;
|
||||||
break;
|
case ast::PipelineStage::kNone:
|
||||||
case ast::PipelineStage::kCompute:
|
break;
|
||||||
warning += "compute";
|
|
||||||
break;
|
|
||||||
case ast::PipelineStage::kNone:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
deprecated(t.source(), warning);
|
|
||||||
}
|
}
|
||||||
|
deprecated(t.source(), warning);
|
||||||
|
|
||||||
return create<ast::StageAttribute>(t.source(), stage.value);
|
return create<ast::StageAttribute>(t.source(), stage.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,8 +316,13 @@ TEST_F(ParserImplErrorTest, FunctionDeclStageMissingLParen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserImplErrorTest, FunctionDeclStageMissingRParen) {
|
TEST_F(ParserImplErrorTest, FunctionDeclStageMissingRParen) {
|
||||||
EXPECT("@stage(vertex fn f() {}",
|
EXPECT(
|
||||||
R"(test.wgsl:1:15 error: expected ')' for stage attribute
|
"@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() {}
|
@stage(vertex fn f() {}
|
||||||
^^
|
^^
|
||||||
)");
|
)");
|
||||||
|
|
|
@ -263,7 +263,8 @@ TEST_F(ParserImplTest, Attribute_Stage_MissingRightParen) {
|
||||||
EXPECT_TRUE(attr.errored);
|
EXPECT_TRUE(attr.errored);
|
||||||
EXPECT_EQ(attr.value, nullptr);
|
EXPECT_EQ(attr.value, nullptr);
|
||||||
EXPECT_TRUE(p->has_error());
|
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) {
|
TEST_F(ParserImplTest, Attribute_Compute) {
|
||||||
|
|
Loading…
Reference in New Issue