Shader: Fix identifiers sanitization

This commit is contained in:
Jérôme Leclercq
2021-07-03 13:53:00 +02:00
parent f14db3f5e9
commit c42d18243b
2 changed files with 6 additions and 3 deletions

View File

@@ -724,8 +724,6 @@ namespace Nz::ShaderAst
auto clone = static_unique_pointer_cast<DeclareExternalStatement>(AstCloner::Clone(node));
for (auto& extVar : clone->externalVars)
{
SanitizeIdentifier(extVar.name);
extVar.type = ResolveType(extVar.type);
ExpressionType varType;
@@ -739,6 +737,8 @@ namespace Nz::ShaderAst
std::size_t varIndex = RegisterVariable(extVar.name, std::move(varType));
if (!clone->varIndex)
clone->varIndex = varIndex; //< First external variable index is node variable index
SanitizeIdentifier(extVar.name);
}
return clone;
@@ -777,7 +777,6 @@ namespace Nz::ShaderAst
clone->parameters = node.parameters;
clone->returnType = ResolveType(node.returnType);
SanitizeIdentifier(clone->name);
Context::FunctionData tempFuncData;
tempFuncData.stageType = node.entryStage;
@@ -842,6 +841,8 @@ namespace Nz::ShaderAst
targetFunc.calledByFunctions.UnboundedSet(funcIndex);
}
SanitizeIdentifier(clone->name);
return clone;
}