Shader: Add export attribute for structs ([export])

This commit is contained in:
Jérôme Leclercq
2022-03-04 18:26:18 +01:00
parent a2f4f3c802
commit ca83f363a3
6 changed files with 40 additions and 15 deletions

View File

@@ -148,6 +148,7 @@ namespace Nz::ShaderAst
{
auto clone = std::make_unique<DeclareStructStatement>();
clone->structIndex = node.structIndex;
clone->isExported = Clone(node.isExported);
clone->description.layout = Clone(node.description.layout);
clone->description.name = node.description.name;

View File

@@ -3,9 +3,9 @@
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Shader/Ast/AstSerializer.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <Nazara/Shader/Ast/AstExpressionVisitor.hpp>
#include <Nazara/Shader/Ast/AstStatementVisitor.hpp>
#include <Nazara/Shader/ShaderBuilder.hpp>
#include <Nazara/Shader/Debug.hpp>
namespace Nz::ShaderAst
@@ -249,6 +249,7 @@ namespace Nz::ShaderAst
void AstSerializerBase::Serialize(DeclareStructStatement& node)
{
OptVal(node.structIndex);
ExprValue(node.isExported);
Value(node.description.name);
ExprValue(node.description.layout);

View File

@@ -939,6 +939,9 @@ namespace Nz::ShaderAst
auto clone = static_unique_pointer_cast<DeclareStructStatement>(AstCloner::Clone(node));
if (clone->isExported.HasValue())
clone->isExported = ComputeExprValue(clone->isExported);
std::unordered_set<std::string> declaredMembers;
for (auto& member : clone->description.members)
{