Shader: Add AstExportVisitor

This commit is contained in:
Jérôme Leclercq
2022-03-04 18:32:31 +01:00
parent 073f1dc434
commit 7dab1d735f
3 changed files with 83 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/Ast/AstExportVisitor.hpp>
#include <stdexcept>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderAst
{
void AstExportVisitor::Visit(Statement& statement, const Callbacks& callbacks)
{
m_callbacks = &callbacks;
statement.Visit(*this);
}
void AstExportVisitor::Visit(DeclareStructStatement& node)
{
if (!node.isExported.HasValue() || !node.isExported.GetResultingValue())
return;
if (m_callbacks->onExportedStruct)
m_callbacks->onExportedStruct(node);
}
}