[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:
James Price 2021-03-10 22:36:59 +00:00 committed by Commit Bot service account
parent d9250a5a21
commit 7e17bfbfd9
2 changed files with 0 additions and 55 deletions

View File

@ -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)]]

View File

@ -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>()) {