Modules are workings \o/

This commit is contained in:
Jérôme Leclercq
2022-03-08 20:26:02 +01:00
parent 83d26e209e
commit be9bdc4705
29 changed files with 742 additions and 256 deletions

View File

@@ -517,6 +517,8 @@ namespace Nz
else
targetAst = module.rootNode.get();
const ShaderAst::Module& targetModule = (sanitizedModule) ? *sanitizedModule : module;
ShaderAst::StatementPtr optimizedAst;
if (states.optimize)
{
@@ -542,6 +544,9 @@ namespace Nz
// Register all extended instruction sets
PreVisitor preVisitor(state.constantTypeCache, state.funcs);
for (const auto& importedModule : targetModule.importedModules)
importedModule.module->rootNode->Visit(preVisitor);
targetAst->Visit(preVisitor);
m_currentState->preVisitor = &preVisitor;
@@ -554,6 +559,9 @@ namespace Nz
func.funcId = AllocateResultId();
SpirvAstVisitor visitor(*this, state.instructions, state.funcs);
for (const auto& importedModule : targetModule.importedModules)
importedModule.module->rootNode->Visit(visitor);
targetAst->Visit(visitor);
AppendHeader();