Shader: Add full support for scalar swizzle

This commit is contained in:
Jérôme Leclercq
2021-12-25 19:13:08 +01:00
parent ec3da7e3f5
commit f98ea6b0ca
5 changed files with 309 additions and 200 deletions

View File

@@ -84,7 +84,11 @@ namespace Nz::ShaderAst
void ShaderAstValueCategory::Visit(SwizzleExpression& node)
{
node.expression->Visit(*this);
// Swizzling more than a component on a primitive produces a rvalue (a.xxxx cannot be assigned)
if (IsPrimitiveType(GetExpressionType(node)) && node.componentCount > 1)
m_expressionCategory = ExpressionCategory::RValue;
else
node.expression->Visit(*this);
}
void ShaderAstValueCategory::Visit(VariableExpression& /*node*/)