Fix setting array sizes on a constructor
Take any array sizes that have been explicitly specified in the shader
text into account, and only set the ones that are unsized according to
the arguments.
BUG=angleproject:2125
TEST=angle_unittests
Change-Id: I37d08a86c25f7cd4f3ce5689f2c9fad444e7d5ad
Reviewed-on: https://chromium-review.googlesource.com/738141
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index e9bc55b..ed81eb3 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -3485,8 +3485,10 @@
}
TIntermTyped *firstElement = arguments->at(0)->getAsTyped();
ASSERT(firstElement);
- type.setArraySize(type.getArraySizes().size() - 1u,
- static_cast<unsigned int>(arguments->size()));
+ if (type.getOutermostArraySize() == 0u)
+ {
+ type.sizeOutermostUnsizedArray(static_cast<unsigned int>(arguments->size()));
+ }
for (size_t i = 0; i < firstElement->getType().getArraySizes().size(); ++i)
{
if (type.getArraySizes()[i] == 0u)