Renderer/ShaderAst: Minor fixes relative to float/vec multiplication

This commit is contained in:
Lynix 2020-06-16 17:44:54 +02:00
parent 90abb52e4e
commit 9b911ac4bc
2 changed files with 14 additions and 2 deletions

View File

@ -122,12 +122,16 @@ namespace Nz::ShaderAst
switch (op) switch (op)
{ {
case ShaderAst::BinaryType::Add: case ShaderAst::BinaryType::Add:
case ShaderAst::BinaryType::Divide:
case ShaderAst::BinaryType::Multiply:
case ShaderAst::BinaryType::Substract: case ShaderAst::BinaryType::Substract:
exprType = left->GetExpressionType(); exprType = left->GetExpressionType();
break; break;
case ShaderAst::BinaryType::Divide:
case ShaderAst::BinaryType::Multiply:
//FIXME
exprType = static_cast<ExpressionType>(std::max(UnderlyingCast(left->GetExpressionType()), UnderlyingCast(right->GetExpressionType())));
break;
case ShaderAst::BinaryType::Equality: case ShaderAst::BinaryType::Equality:
exprType = ExpressionType::Boolean; exprType = ExpressionType::Boolean;
break; break;

View File

@ -102,6 +102,14 @@ namespace Nz::ShaderAst
{ {
switch (leftType) switch (leftType)
{ {
case ExpressionType::Float1:
{
if (Node::GetComponentType(rightType) != ExpressionType::Float1)
throw AstError{ "Left expression type is not compatible with right expression type" };
break;
}
case ExpressionType::Float2: case ExpressionType::Float2:
case ExpressionType::Float3: case ExpressionType::Float3:
case ExpressionType::Float4: case ExpressionType::Float4: