Renderer/ShaderAst: Fix a few multiply/divide cases

This commit is contained in:
Lynix 2017-01-15 15:07:12 +01:00
parent fd5bf16a90
commit 832237c6d4
2 changed files with 13 additions and 1 deletions

View File

@ -95,7 +95,6 @@ namespace Nz
switch (op) switch (op)
{ {
case BinaryType::Add: case BinaryType::Add:
case BinaryType::Divide:
case BinaryType::Equality: case BinaryType::Equality:
case BinaryType::Substract: case BinaryType::Substract:
{ {
@ -104,13 +103,25 @@ namespace Nz
} }
case BinaryType::Multiply: case BinaryType::Multiply:
case BinaryType::Divide:
{ {
switch (leftType) switch (leftType)
{ {
case ExpressionType::Float2:
case ExpressionType::Float3:
case ExpressionType::Float4:
{
if (rightType != ExpressionType::Float1)
throw std::runtime_error("Left expression type is not compatible with right expression type");
break;
}
case ExpressionType::Mat4x4: case ExpressionType::Mat4x4:
{ {
switch (rightType) switch (rightType)
{ {
case ExpressionType::Float1:
case ExpressionType::Float4: case ExpressionType::Float4:
case ExpressionType::Mat4x4: case ExpressionType::Mat4x4:
break; break;

View File

@ -24,6 +24,7 @@ namespace Nz
m_currentState = nullptr; m_currentState = nullptr;
}); });
// Register global variables (uniforms, varying, ..)
node->Register(*this); node->Register(*this);
// Header // Header