Fix bit shift compilation

Bit shifts compilation was failing when the types were a mismatch,
but shifting a uint by an int (or vice versa) is allowed, so types
may not match, and it's fine, as long as both are integer types.

Change-Id: I86c52a572625b1d09803b0a8b887a63756544101
Reviewed-on: https://swiftshader-review.googlesource.com/3887
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/Intermediate.cpp b/src/OpenGL/compiler/Intermediate.cpp
index ccb8d63..a0247b9 100644
--- a/src/OpenGL/compiler/Intermediate.cpp
+++ b/src/OpenGL/compiler/Intermediate.cpp
@@ -192,6 +192,7 @@
 //
 TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
 {
+    bool isBitShift = false;
     switch (op) {
         case EOpEqual:
         case EOpNotEqual:
@@ -234,10 +235,22 @@
                 return 0;
             }
             break;
+		case EOpBitShiftLeft:
+		case EOpBitShiftRight:
+		case EOpBitShiftLeftAssign:
+		case EOpBitShiftRightAssign:
+			// Unsigned can be bit-shifted by signed and vice versa, but we need to
+			// check that the basic type is an integer type.
+			isBitShift = true;
+			if(!IsInteger(left->getBasicType()) || !IsInteger(right->getBasicType()))
+			{
+				return 0;
+			}
+			break;
         default: break;
     }
 
-    if (left->getBasicType() != right->getBasicType())
+    if(!isBitShift && left->getBasicType() != right->getBasicType())
     {
         return 0;
     }
@@ -768,7 +781,12 @@
 
     // GLSL ES 2.0 does not support implicit type casting.
     // So the basic type should always match.
-    if (left->getBasicType() != right->getBasicType())
+	// GLSL ES 3.0 supports integer shift operands of different signedness.
+	if(op != EOpBitShiftLeft &&
+	   op != EOpBitShiftRight &&
+	   op != EOpBitShiftLeftAssign &&
+	   op != EOpBitShiftRightAssign &&
+	   left->getBasicType() != right->getBasicType())
     {
         return false;
     }