From 7e17bfbfd9280bb5a98cd3d498a75b36eb853049 Mon Sep 17 00:00:00 2001 From: James Price Date: Wed, 10 Mar 2021 22:36:59 +0000 Subject: [PATCH] [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 Commit-Queue: Ben Clayton Reviewed-by: Ben Clayton --- src/validator/validator_function_test.cc | 42 ------------------------ src/validator/validator_impl.cc | 13 -------- 2 files changed, 55 deletions(-) diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc index eb212d91ce..137736934f 100644 --- a/src/validator/validator_function_test.cc +++ b/src/validator/validator_function_test.cc @@ -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(Expr(0)), - }, - ast::FunctionDecorationList{ - create(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::FunctionDecorationList{ - create(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)]] diff --git a/src/validator/validator_impl.cc b/src/validator/validator_impl.cc index ec46aa6c61..a75dc9eab7 100644 --- a/src/validator/validator_impl.cc +++ b/src/validator/validator_impl.cc @@ -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()) { - 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()) {