ShaderNode: Handle vector component count at runtime

This commit is contained in:
Lynix
2020-05-31 18:39:28 +02:00
parent 2ecc624fe4
commit effd1b4552
28 changed files with 529 additions and 339 deletions

View File

@@ -200,6 +200,23 @@ namespace Nz::ShaderAst
visitor.Write(*this);
}
void Cast::Validate() const
{
unsigned int componentCount = 0;
unsigned int requiredComponents = GetComponentCount(exprType);
for (const auto& exprPtr : expressions)
{
if (!exprPtr)
break;
componentCount += GetComponentCount(exprPtr->GetExpressionType());
}
//TODO: AstParseError
if (componentCount != requiredComponents)
throw std::runtime_error("Component count doesn't match required component count");
}
ExpressionCategory SwizzleOp::GetExpressionCategory() const
{