Fixed array constructors

Fixed first class array constructors by allowing basic type
arrays and structure arrays to be handled properly for the
EOpConstruct* operations.

This fixes all dEQP.functional.shaders.arrays.* tests.

Change-Id: I4fe99ec5256abf6483d3595890ba9c426abc97f8
Reviewed-on: https://swiftshader-review.googlesource.com/7351
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
index a15fb0f..645f490 100644
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -2076,7 +2076,23 @@
 		aggregateArguments->getSequence().push_back(arguments);
 	}
 
-	if(op == EOpConstructStruct)
+	if(type->isArray())
+	{
+		// GLSL ES 3.00 section 5.4.4: Each argument must be the same type as the element type of
+		// the array.
+		for(TIntermNode *&argNode : aggregateArguments->getSequence())
+		{
+			const TType &argType = argNode->getAsTyped()->getType();
+			// It has already been checked that the argument is not an array.
+			ASSERT(!argType.isArray());
+			if(!argType.sameElementType(*type))
+			{
+				error(line, "Array constructor argument has an incorrect type", "Error");
+				return false;
+			}
+		}
+	}
+	else if(op == EOpConstructStruct)
 	{
 		const TFieldList &fields = type->getStruct()->fields();
 		TIntermSequence &args = aggregateArguments->getSequence();