[validation] Validate if entry point functions accept parameters

Bug: tint: 6
Change-Id: I7e9f50759e65ed6ef3dc25a6c004bec3dfbd4648
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/27122
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Sarah Mashayekhi 2020-08-24 16:03:36 +00:00 committed by Commit Bot service account
parent c3038ddfa6
commit f70065f622
2 changed files with 7 additions and 1 deletions

View File

@ -312,7 +312,7 @@ TEST_F(ValidateFunctionTest, EntryPointFunctionNotVoid_Fail) {
"12:34: v-0024: Entry point function must return void: 'vtx_main'");
}
TEST_F(ValidateFunctionTest, DISABLED_EntryPointFunctionWithParams_Fail) {
TEST_F(ValidateFunctionTest, EntryPointFunctionWithParams_Fail) {
// entry_point vertex as "func" = vtx_func
// fn vtx_func(a : i32) -> void { return; }
ast::type::I32Type i32;

View File

@ -76,6 +76,12 @@ bool ValidatorImpl::ValidateEntryPoints(const ast::EntryPointList& eps) {
ep_ptr->function_name() + "'");
return false;
}
if (func->params().size() != 0) {
set_error(ep_ptr->source(),
"v-0023: Entry point function must accept no parameters: '" +
ep_ptr->function_name() + "'");
return false;
}
}
return true;
}