Add support for arrays of arrays to VariableLocation
Array indices are sorted so that the outermost index is in the back.
This is because we want to be consistent with future arrays of arrays
parsing code. In parsing we'll have a utility function to make a
TType object into an array, and there it's most natural to push the
new outermost sizes to the back of the vector.
Further patches will still be needed to parse arrays of arrays and
add support to arrays of arrays into the API.
BUG=angleproject:2125
TEST=angle_unittests, angle_end2end_tests
Change-Id: I6c88edabf68ae9dbd803ec6d20543016c408b702
Reviewed-on: https://chromium-review.googlesource.com/686414
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/MemoryProgramCache.cpp b/src/libANGLE/MemoryProgramCache.cpp
index 2ca4b56..c28e1be 100644
--- a/src/libANGLE/MemoryProgramCache.cpp
+++ b/src/libANGLE/MemoryProgramCache.cpp
@@ -238,8 +238,9 @@
uniformIndexIndex++)
{
VariableLocation variable;
- stream.readInt(&variable.element);
+ stream.readIntVector<unsigned int>(&variable.arrayIndices);
stream.readInt(&variable.index);
+ stream.readInt(&variable.flattenedArrayOffset);
stream.readBool(&variable.ignored);
state->mUniformLocations.push_back(variable);
@@ -319,8 +320,9 @@
{
int locationIndex = stream.readInt<int>();
VariableLocation locationData;
- stream.readInt(&locationData.element);
+ stream.readIntVector<unsigned int>(&locationData.arrayIndices);
stream.readInt(&locationData.index);
+ stream.readInt(&locationData.flattenedArrayOffset);
stream.readBool(&locationData.ignored);
state->mOutputLocations[locationIndex] = locationData;
}
@@ -427,8 +429,9 @@
stream.writeInt(state.getUniformLocations().size());
for (const auto &variable : state.getUniformLocations())
{
- stream.writeInt(variable.element);
+ stream.writeIntVector(variable.arrayIndices);
stream.writeIntOrNegOne(variable.index);
+ stream.writeInt(variable.flattenedArrayOffset);
stream.writeInt(variable.ignored);
}
@@ -481,8 +484,9 @@
for (const auto &outputPair : state.getOutputLocations())
{
stream.writeInt(outputPair.first);
- stream.writeIntOrNegOne(outputPair.second.element);
+ stream.writeIntVector(outputPair.second.arrayIndices);
stream.writeIntOrNegOne(outputPair.second.index);
+ stream.writeInt(outputPair.second.flattenedArrayOffset);
stream.writeInt(outputPair.second.ignored);
}