]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/resolve.cpp
Convert operands of shift operators to the same vector size
[libs/gl.git] / source / glsl / resolve.cpp
index 2b18c84b653bbbc1195f30a69c362137ec5754db..fec3cf143130a583c38a961b38b70087309b555e 100644 (file)
@@ -745,6 +745,17 @@ void ExpressionResolver::visit(BinaryExpression &binary, bool assign)
                if(!left_size || (left_size==1 && right_size!=1) || (left_size>1 && right_size!=1 && right_size!=left_size))
                        return;
 
+               /* If the left operand is a vector and right is scalar, convert the right
+               operand to a vector too. */
+               if(left_size>1 && right_size==1)
+               {
+                       BasicTypeDeclaration *vec_right = find_type(*elem_right, basic_left->kind, basic_left->size);
+                       if(!vec_right)
+                               return;
+
+                       convert_to(binary.right, *vec_right);
+               }
+
                type = basic_left;
                // Don't perform conversion even if the operands are of different sizes.
                compat = SAME_TYPE;