Shader/EliminateUnusedPassVisitor: Fix function call

This commit is contained in:
Jérôme Leclercq 2022-02-27 18:43:02 +01:00
parent fbae413620
commit 0fe7f6b899
1 changed files with 13 additions and 3 deletions

View File

@ -61,16 +61,26 @@ namespace Nz::ShaderAst
void Visit(CallFunctionExpression& node) override
{
const auto& targetFuncType = GetExpressionType(node);
const auto& targetFuncType = GetExpressionType(*node.targetFunction);
assert(std::holds_alternative<FunctionType>(targetFuncType));
const auto& funcType = std::get<FunctionType>(targetFuncType);
assert(currentFunctionIndex);
if (currentVariableDeclIndex)
{
UsageSet& usageSet = Retrieve(variableUsages, *currentVariableDeclIndex);
usageSet.usedFunctions.UnboundedSet(funcType.funcIndex);
}
else
{
UsageSet& usageSet = Retrieve(functionUsages, *currentFunctionIndex);
usageSet.usedFunctions.UnboundedSet(funcType.funcIndex);
}
AstRecursiveVisitor::Visit(node);
}
void Visit(DeclareExternalStatement& node) override
{
for (const auto& externalVar : node.externalVars)