Store shader interface variables as per query spec
GLES 3.1 section 7.3.1.1 specifies how active variable entries should
be generated and how active variables are named. The specs for program
interface variable queries are built on top of this section.
ANGLE has already followed this spec for the most part for generating
variable lists in ProgramState, but now we also follow the naming spec
for arrays and include [0] at the end of the stored name.
This will make implementing arrays of arrays more straightforward.
Most logic for variable queries will just keep working as is when
arrays of arrays are added instead of needing more complex logic for
handling array indexing.
BUG=angleproject:2125
TEST=angle_end2end_tests
Change-Id: I3acd14253153e10bc312114b0303065da2efb506
Reviewed-on: https://chromium-review.googlesource.com/739826
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/libANGLE/MemoryProgramCache.cpp b/src/libANGLE/MemoryProgramCache.cpp
index c28e1be..1c0a453 100644
--- a/src/libANGLE/MemoryProgramCache.cpp
+++ b/src/libANGLE/MemoryProgramCache.cpp
@@ -316,15 +316,15 @@
}
unsigned int outputVarCount = stream.readInt<unsigned int>();
+ ASSERT(state->mOutputLocations.empty());
for (unsigned int outputIndex = 0; outputIndex < outputVarCount; ++outputIndex)
{
- int locationIndex = stream.readInt<int>();
VariableLocation locationData;
stream.readIntVector<unsigned int>(&locationData.arrayIndices);
stream.readInt(&locationData.index);
stream.readInt(&locationData.flattenedArrayOffset);
stream.readBool(&locationData.ignored);
- state->mOutputLocations[locationIndex] = locationData;
+ state->mOutputLocations.push_back(locationData);
}
unsigned int outputTypeCount = stream.readInt<unsigned int>();
@@ -481,13 +481,12 @@
}
stream.writeInt(state.getOutputLocations().size());
- for (const auto &outputPair : state.getOutputLocations())
+ for (const auto &outputVar : state.getOutputLocations())
{
- stream.writeInt(outputPair.first);
- stream.writeIntVector(outputPair.second.arrayIndices);
- stream.writeIntOrNegOne(outputPair.second.index);
- stream.writeInt(outputPair.second.flattenedArrayOffset);
- stream.writeInt(outputPair.second.ignored);
+ stream.writeIntVector(outputVar.arrayIndices);
+ stream.writeIntOrNegOne(outputVar.index);
+ stream.writeInt(outputVar.flattenedArrayOffset);
+ stream.writeInt(outputVar.ignored);
}
stream.writeInt(state.mOutputVariableTypes.size());