Shader: Add comments to surround modules
This commit is contained in:
@@ -231,6 +231,7 @@ namespace Nz::ShaderAst
|
||||
StatementPtr AstCloner::Clone(MultiStatement& node)
|
||||
{
|
||||
auto clone = std::make_unique<MultiStatement>();
|
||||
clone->sectionName = node.sectionName;
|
||||
clone->statements.reserve(node.statements.size());
|
||||
for (auto& statement : node.statements)
|
||||
clone->statements.push_back(CloneStatement(statement));
|
||||
|
||||
@@ -315,6 +315,8 @@ namespace Nz::ShaderAst
|
||||
|
||||
void AstSerializerBase::Serialize(MultiStatement& node)
|
||||
{
|
||||
Value(node.sectionName);
|
||||
|
||||
Container(node.statements);
|
||||
for (auto& statement : node.statements)
|
||||
Node(statement);
|
||||
|
||||
@@ -1389,6 +1389,8 @@ namespace Nz::ShaderAst
|
||||
if (!targetModule)
|
||||
throw AstError{ "module " + ModulePathAsString() + " not found" };
|
||||
|
||||
targetModule->rootNode->sectionName = "Module " + targetModule->metadata->moduleId.ToString();
|
||||
|
||||
std::string error;
|
||||
ModulePtr sanitizedModule = ShaderAst::Sanitize(*targetModule, m_context->options, &error);
|
||||
if (!sanitizedModule)
|
||||
@@ -1462,6 +1464,7 @@ namespace Nz::ShaderAst
|
||||
StatementPtr SanitizeVisitor::Clone(MultiStatement& node)
|
||||
{
|
||||
auto clone = std::make_unique<MultiStatement>();
|
||||
clone->sectionName = node.sectionName;
|
||||
clone->statements.reserve(node.statements.size());
|
||||
|
||||
std::vector<StatementPtr>* previousList = m_context->currentStatementList;
|
||||
|
||||
Reference in New Issue
Block a user