Only store innermost array offset in VariableLocation
Separate entries will be generated for each innermost array of arrays
of arrays in the variable tables. Because of this VariableLocation
actually only needs to store the innermost array index.
BUG=angleproject:2125
TEST=angle_end2end_tests
Change-Id: Id1ee35b3cecfc011d96b58e43cf0b1cccbfed408
Reviewed-on: https://chromium-review.googlesource.com/741742
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index e150711..3ac1149 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -190,7 +190,7 @@
return static_cast<GLint>(location);
}
}
- if (variable.isArray() && variableLocation.arrayIndices[0] == arrayIndex &&
+ if (variable.isArray() && variableLocation.arrayIndex == arrayIndex &&
nameLengthWithoutArrayIndex + 3u == variable.name.length() &&
angle::BeginsWith(variable.name, name, nameLengthWithoutArrayIndex))
{
@@ -378,28 +378,16 @@
{
}
-VariableLocation::VariableLocation() : index(kUnused), flattenedArrayOffset(0u), ignored(false)
+VariableLocation::VariableLocation() : arrayIndex(0), index(kUnused), ignored(false)
{
}
VariableLocation::VariableLocation(unsigned int arrayIndex, unsigned int index)
- : arrayIndices(1, arrayIndex), index(index), flattenedArrayOffset(arrayIndex), ignored(false)
+ : arrayIndex(arrayIndex), index(index), ignored(false)
{
ASSERT(arrayIndex != GL_INVALID_INDEX);
}
-bool VariableLocation::areAllArrayIndicesZero() const
-{
- for (unsigned int arrayIndex : arrayIndices)
- {
- if (arrayIndex != 0)
- {
- return false;
- }
- }
- return true;
-}
-
void Program::Bindings::bindLocation(GLuint index, const std::string &name)
{
mBindings[name] = index;
@@ -2952,7 +2940,7 @@
std::vector<GLuint> *boundTextureUnits =
&mState.mSamplerBindings[samplerIndex].boundTextureUnits;
- std::copy(v, v + clampedCount, boundTextureUnits->begin() + locationInfo.flattenedArrayOffset);
+ std::copy(v, v + clampedCount, boundTextureUnits->begin() + locationInfo.arrayIndex);
// Invalidate the validation cache.
mCachedValidateSamplersResult.reset();
@@ -2971,8 +2959,7 @@
// OpenGL ES 3.0.4 spec pg 67: "Values for any array element that exceeds the highest array
// element index used, as reported by GetActiveUniform, will be ignored by the GL."
- unsigned int remainingElements =
- linkedUniform.elementCount() - locationInfo.flattenedArrayOffset;
+ unsigned int remainingElements = linkedUniform.elementCount() - locationInfo.arrayIndex;
GLsizei maxElementCount =
static_cast<GLsizei>(remainingElements * linkedUniform.getElementComponents());
@@ -3001,8 +2988,7 @@
// OpenGL ES 3.0.4 spec pg 67: "Values for any array element that exceeds the highest array
// element index used, as reported by GetActiveUniform, will be ignored by the GL."
- unsigned int remainingElements =
- linkedUniform.elementCount() - locationInfo.flattenedArrayOffset;
+ unsigned int remainingElements = linkedUniform.elementCount() - locationInfo.arrayIndex;
return std::min(count, static_cast<GLsizei>(remainingElements));
}