Add support for arrays of arrays in AST processing
Data concerning arrays of arrays is added in TType.
Parsing arrays of arrays and support for arrays of arrays in
TPublicType are still left to be implemented later.
ShaderVariable interface for arrays of arrays is also left to be
implemented later.
We rely on existing test coverage to make sure that arrays of arrays
are not accidentally exposed.
BUG=angleproject:2125
TEST=angle_unittests, angle_end2end_tests, angle_deqp_gles31_tests
Change-Id: Ie17d5ac9b8d33958e9126dc0fb40bf1c81ddeec9
Reviewed-on: https://chromium-review.googlesource.com/616146
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/CollectVariables.cpp b/src/compiler/translator/CollectVariables.cpp
index 5815940..abe4592 100644
--- a/src/compiler/translator/CollectVariables.cpp
+++ b/src/compiler/translator/CollectVariables.cpp
@@ -219,8 +219,9 @@
info->name = name;
info->mappedName = name;
info->type = GLVariableType(type);
- info->arraySize = type.isArray() ? type.getArraySize() : 0;
- info->precision = GLVariablePrecision(type);
+ ASSERT(!type.isArrayOfArrays());
+ info->arraySize = type.isArray() ? type.getOutermostArraySize() : 0;
+ info->precision = GLVariablePrecision(type);
}
void CollectVariablesTraverser::recordBuiltInVaryingUsed(const char *name,
@@ -511,7 +512,11 @@
}
variableOut->name = name.c_str();
variableOut->mappedName = HashName(name, mHashFunction).c_str();
- variableOut->arraySize = type.getArraySize();
+
+ // TODO(oetuaho@nvidia.com): Uniforms can be arrays of arrays, so this assert will need to be
+ // removed.
+ ASSERT(!type.isArrayOfArrays());
+ variableOut->arraySize = type.isArray() ? type.getOutermostArraySize() : 0;
}
Attribute CollectVariablesTraverser::recordAttribute(const TIntermSymbol &variable) const
@@ -581,7 +586,8 @@
interfaceBlock->mappedName = HashName(blockType->name().c_str(), mHashFunction).c_str();
interfaceBlock->instanceName =
(blockType->hasInstanceName() ? blockType->instanceName().c_str() : "");
- interfaceBlock->arraySize = interfaceBlockType.getArraySize();
+ ASSERT(!interfaceBlockType.isArrayOfArrays()); // Disallowed by GLSL ES 3.10 section 4.3.9
+ interfaceBlock->arraySize = interfaceBlockType.isArray() ? interfaceBlockType.getOutermostArraySize() : 0;
interfaceBlock->blockType = GetBlockType(interfaceBlockType.getQualifier());
if (interfaceBlock->blockType == BlockType::BLOCK_UNIFORM ||