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

@@ -33,6 +33,7 @@ namespace Nz
DepthWrite, //< Depth write mode (function only) - has argument type
EarlyFragmentTests, //< Entry point (function only) - has argument on/off
Entry, //< Entry point (function only) - has argument type
Export, //< Exported (external block, function and struct only)
Layout, //< Struct layout (struct only) - has argument style
Location, //< Location (struct member only) - has argument index
LangVersion, //< NZSL version - has argument version string

View File

@@ -249,9 +249,9 @@ namespace Nz::ShaderAst
NodeType GetType() const override;
void Visit(AstStatementVisitor& visitor) override;
ExpressionValue<ExpressionType> type;
std::optional<std::size_t> constIndex;
std::string name;
ExpressionValue<ExpressionType> type;
ExpressionPtr expression;
};
@@ -262,11 +262,11 @@ namespace Nz::ShaderAst
struct ExternalVar
{
std::optional<std::size_t> varIndex;
std::string name;
ExpressionValue<UInt32> bindingIndex;
ExpressionValue<UInt32> bindingSet;
ExpressionValue<ExpressionType> type;
std::optional<std::size_t> varIndex;
std::string name;
};
ExpressionValue<UInt32> bindingSet;
@@ -284,15 +284,15 @@ namespace Nz::ShaderAst
ExpressionValue<ExpressionType> type;
};
ExpressionValue<DepthWriteMode> depthWrite;
ExpressionValue<bool> earlyFragmentTests;
ExpressionValue<ShaderStageType> entryStage;
ExpressionValue<ExpressionType> returnType;
std::optional<std::size_t> funcIndex;
std::optional<std::size_t> varIndex;
std::string name;
std::vector<Parameter> parameters;
std::vector<StatementPtr> statements;
ExpressionValue<DepthWriteMode> depthWrite;
ExpressionValue<bool> earlyFragmentTests;
ExpressionValue<ShaderStageType> entryStage;
ExpressionValue<ExpressionType> returnType;
};
struct NAZARA_SHADER_API DeclareOptionStatement : Statement
@@ -312,6 +312,7 @@ namespace Nz::ShaderAst
void Visit(AstStatementVisitor& visitor) override;
std::optional<std::size_t> structIndex;
ExpressionValue<bool> isExported;
StructDescription description;
};