[tint] Remove current_function from ValidateStructure.
The ValidateStructure method only required the current pipeline stage. Pass that in directly instead of depending on current_function_. Bug: tint:1313 Change-Id: I13a429aa9d77c8c43fb82d2aa02b25e05b0e3a6c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87143 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
3dbeb8b7a5
commit
d382e20b00
|
@ -2477,7 +2477,10 @@ sem::Struct* Resolver::Structure(const ast::Struct* str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidateStructure(out)) {
|
auto stage = current_function_
|
||||||
|
? current_function_->Declaration()->PipelineStage()
|
||||||
|
: ast::PipelineStage::kNone;
|
||||||
|
if (!ValidateStructure(out, stage)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ class Resolver {
|
||||||
bool ValidateReturn(const ast::ReturnStatement* ret);
|
bool ValidateReturn(const ast::ReturnStatement* ret);
|
||||||
bool ValidateStatements(const ast::StatementList& stmts);
|
bool ValidateStatements(const ast::StatementList& stmts);
|
||||||
bool ValidateStorageTexture(const ast::StorageTexture* t);
|
bool ValidateStorageTexture(const ast::StorageTexture* t);
|
||||||
bool ValidateStructure(const sem::Struct* str);
|
bool ValidateStructure(const sem::Struct* str, ast::PipelineStage stage);
|
||||||
bool ValidateStructureConstructorOrCast(const ast::CallExpression* ctor,
|
bool ValidateStructureConstructorOrCast(const ast::CallExpression* ctor,
|
||||||
const sem::Struct* struct_type);
|
const sem::Struct* struct_type);
|
||||||
bool ValidateSwitch(const ast::SwitchStatement* s);
|
bool ValidateSwitch(const ast::SwitchStatement* s);
|
||||||
|
|
|
@ -2043,7 +2043,8 @@ bool Resolver::ValidateAlias(const ast::Alias* alias) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Resolver::ValidateStructure(const sem::Struct* str) {
|
bool Resolver::ValidateStructure(const sem::Struct* str,
|
||||||
|
ast::PipelineStage stage) {
|
||||||
auto name = builder_->Symbols().NameFor(str->Declaration()->name);
|
auto name = builder_->Symbols().NameFor(str->Declaration()->name);
|
||||||
if (sem::ParseBuiltinType(name) != sem::BuiltinType::kNone) {
|
if (sem::ParseBuiltinType(name) != sem::BuiltinType::kNone) {
|
||||||
AddError("'" + name + "' is a builtin and cannot be redeclared as a struct",
|
AddError("'" + name + "' is a builtin and cannot be redeclared as a struct",
|
||||||
|
@ -2099,9 +2100,6 @@ bool Resolver::ValidateStructure(const sem::Struct* str) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto stage = current_function_
|
|
||||||
? current_function_->Declaration()->PipelineStage()
|
|
||||||
: ast::PipelineStage::kNone;
|
|
||||||
if (auto* invariant = attr->As<ast::InvariantAttribute>()) {
|
if (auto* invariant = attr->As<ast::InvariantAttribute>()) {
|
||||||
invariant_attribute = invariant;
|
invariant_attribute = invariant;
|
||||||
} else if (auto* location = attr->As<ast::LocationAttribute>()) {
|
} else if (auto* location = attr->As<ast::LocationAttribute>()) {
|
||||||
|
|
Loading…
Reference in New Issue