tint/resolver: Forbid workgroup pointer parameters

Fixed: tint:1721
Change-Id: I80a2cfc753f928facc165e1c8cd8c5af6c497550
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108701
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton
2022-11-09 20:11:43 +00:00
committed by Dawn LUCI CQ
parent 5ac2a365d9
commit 55a8eace75
5 changed files with 19 additions and 13 deletions

View File

@@ -1071,7 +1071,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTest,
TestParams{ast::AddressSpace::kIn, false},
TestParams{ast::AddressSpace::kOut, false},
TestParams{ast::AddressSpace::kUniform, false},
TestParams{ast::AddressSpace::kWorkgroup, true},
TestParams{ast::AddressSpace::kWorkgroup, false},
TestParams{ast::AddressSpace::kHandle, false},
TestParams{ast::AddressSpace::kStorage, false},
TestParams{ast::AddressSpace::kPrivate, true},

View File

@@ -853,8 +853,7 @@ bool Validator::Parameter(const ast::Function* func, const sem::Variable* var) c
if (auto* ref = var->Type()->As<sem::Pointer>()) {
auto address_space = ref->AddressSpace();
if (!(address_space == ast::AddressSpace::kFunction ||
address_space == ast::AddressSpace::kPrivate ||
address_space == ast::AddressSpace::kWorkgroup) &&
address_space == ast::AddressSpace::kPrivate) &&
IsValidationEnabled(decl->attributes, ast::DisabledValidation::kIgnoreAddressSpace)) {
std::stringstream ss;
ss << "function parameter of pointer type cannot be in '" << address_space