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

@@ -737,6 +737,8 @@ namespace Nz
void GlslWriter::Visit(ShaderAst::BranchStatement& node)
{
assert(!node.isConst);
bool first = true;
for (const auto& statement : node.condStatements)
{
@@ -850,6 +852,11 @@ namespace Nz
}, node.value);
}
void GlslWriter::Visit(ShaderAst::DeclareConstStatement& /*node*/)
{
/* nothing to do */
}
void GlslWriter::Visit(ShaderAst::DeclareExternalStatement& node)
{
assert(node.varIndex);
@@ -1033,9 +1040,7 @@ namespace Nz
assert(node.varIndex);
RegisterVariable(*node.varIndex, node.varName);
Append(node.varType);
Append(" ");
Append(node.varName);
Append(node.varType, " ", node.varName);
if (node.initialExpression)
{
Append(" = ");