tint/resolver: Ensure that validation is done before CollectTextureSamplerPairs()
CollectTextureSamplerPairs() makes assumptions that the argument types are correct. If they're not, you can end up with NPEs. Bug: chromium:1327698 Change-Id: Ic9b14126c4b7129bb080f01c90f692b59cd1631e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91850 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
4faed86871
commit
4b04721075
|
@ -1553,6 +1553,14 @@ sem::Call* Resolver::FunctionCall(const ast::CallExpression* expr,
|
||||||
auto* call = builder_->create<sem::Call>(expr, target, std::move(args), current_statement_,
|
auto* call = builder_->create<sem::Call>(expr, target, std::move(args), current_statement_,
|
||||||
sem::Constant{}, has_side_effects);
|
sem::Constant{}, has_side_effects);
|
||||||
|
|
||||||
|
target->AddCallSite(call);
|
||||||
|
|
||||||
|
call->Behaviors() = arg_behaviors + target->Behaviors();
|
||||||
|
|
||||||
|
if (!validator_.FunctionCall(call, current_statement_)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (current_function_) {
|
if (current_function_) {
|
||||||
// Note: Requires called functions to be resolved first.
|
// Note: Requires called functions to be resolved first.
|
||||||
// This is currently guaranteed as functions must be declared before
|
// This is currently guaranteed as functions must be declared before
|
||||||
|
@ -1568,17 +1576,10 @@ sem::Call* Resolver::FunctionCall(const ast::CallExpression* expr,
|
||||||
current_function_->AddTransitivelyReferencedGlobal(var);
|
current_function_->AddTransitivelyReferencedGlobal(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: Validation *must* be performed before calling this method.
|
||||||
CollectTextureSamplerPairs(target, call->Arguments());
|
CollectTextureSamplerPairs(target, call->Arguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
target->AddCallSite(call);
|
|
||||||
|
|
||||||
call->Behaviors() = arg_behaviors + target->Behaviors();
|
|
||||||
|
|
||||||
if (!validator_.FunctionCall(call, current_statement_)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return call;
|
return call;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue