[validator] Remove obsolete rules and tests
Entry points are now allowed to have parameters and return types as part of the changes made in: https://github.com/gpuweb/gpuweb/pull/1426 Bug: tint:512 Change-Id: I20caa940f6d194f62ce1dfa5d247927c5b5a9628 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44080 Auto-Submit: James Price <jrprice@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
d9250a5a21
commit
7e17bfbfd9
|
@ -161,48 +161,6 @@ TEST_F(ValidateFunctionTest, FunctionNamesMustBeUnique_fail) {
|
|||
EXPECT_EQ(v.error(), "12:34 v-0016: function names must be unique 'func'");
|
||||
}
|
||||
|
||||
TEST_F(ValidateFunctionTest, Function_WithPipelineStage_NotVoid_Fail) {
|
||||
// [[stage(vertex)]]
|
||||
// fn vtx_main() -> i32 { return 0; }
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "vtx_main", ast::VariableList{},
|
||||
ty.i32(),
|
||||
ast::StatementList{
|
||||
create<ast::ReturnStatement>(Expr(0)),
|
||||
},
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||
});
|
||||
|
||||
ValidatorImpl& v = Build();
|
||||
|
||||
EXPECT_FALSE(v.Validate());
|
||||
EXPECT_EQ(v.error(),
|
||||
"12:34 v-0024: Entry point function must return void: 'vtx_main'");
|
||||
}
|
||||
|
||||
TEST_F(ValidateFunctionTest, Function_WithPipelineStage_WithParams_Fail) {
|
||||
// [[stage(vertex)]]
|
||||
// fn vtx_func(a : i32) -> void { return; }
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "vtx_func",
|
||||
ast::VariableList{Var("a", ty.i32(), ast::StorageClass::kNone)},
|
||||
ty.void_(),
|
||||
ast::StatementList{
|
||||
create<ast::ReturnStatement>(),
|
||||
},
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex),
|
||||
});
|
||||
|
||||
ValidatorImpl& v = Build();
|
||||
|
||||
EXPECT_FALSE(v.Validate());
|
||||
EXPECT_EQ(v.error(),
|
||||
"12:34 v-0023: Entry point function must accept no parameters: "
|
||||
"'vtx_func'");
|
||||
}
|
||||
|
||||
TEST_F(ValidateFunctionTest, PipelineStage_MustBeUnique_Fail) {
|
||||
// [[stage(fragment)]]
|
||||
// [[stage(vertex)]]
|
||||
|
|
|
@ -150,19 +150,6 @@ bool ValidatorImpl::ValidateEntryPoint(const ast::FunctionList& funcs) {
|
|||
for (auto* func : funcs) {
|
||||
if (func->IsEntryPoint()) {
|
||||
shader_is_present = true;
|
||||
if (!func->params().empty()) {
|
||||
add_error(func->source(), "v-0023",
|
||||
"Entry point function must accept no parameters: '" +
|
||||
program_->Symbols().NameFor(func->symbol()) + "'");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!func->return_type()->Is<type::Void>()) {
|
||||
add_error(func->source(), "v-0024",
|
||||
"Entry point function must return void: '" +
|
||||
program_->Symbols().NameFor(func->symbol()) + "'");
|
||||
return false;
|
||||
}
|
||||
auto stage_deco_count = 0;
|
||||
for (auto* deco : func->decorations()) {
|
||||
if (deco->Is<ast::StageDecoration>()) {
|
||||
|
|
Loading…
Reference in New Issue