Shader: Implement const if and const values

This commit is contained in:
Jérôme Leclercq
2021-07-07 21:38:23 +02:00
parent d679eccb43
commit 1f6937ab1b
28 changed files with 315 additions and 60 deletions

View File

@@ -242,6 +242,7 @@ namespace Nz::ShaderAst
std::vector<ConditionalStatement> condStatements;
StatementPtr elseStatement;
bool isConst = false;
};
struct NAZARA_SHADER_API ConditionalStatement : Statement
@@ -253,6 +254,17 @@ namespace Nz::ShaderAst
StatementPtr statement;
};
struct NAZARA_SHADER_API DeclareConstStatement : Statement
{
NodeType GetType() const override;
void Visit(AstStatementVisitor& visitor) override;
std::optional<std::size_t> constIndex;
std::string name;
ExpressionPtr expression;
ExpressionType type;
};
struct NAZARA_SHADER_API DeclareExternalStatement : Statement
{
NodeType GetType() const override;