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/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index 1fb7e12..0af46aa 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -2134,7 +2134,7 @@
 {
     D3DUniform *targetUniform = mD3DUniforms[locationInfo.index];
     const int components      = targetUniform->typeInfo.componentCount;
-    unsigned int arrayElementOffset = locationInfo.flattenedArrayOffset;
+    const unsigned int arrayElementOffset = locationInfo.arrayIndex;
 
     if (targetUniform->typeInfo.type == uniformType)
     {
@@ -2174,7 +2174,7 @@
     {
         ASSERT(uniformType == GL_INT);
         size_t size = count * sizeof(T);
-        auto dest   = &targetUniform->mSamplerData[locationInfo.flattenedArrayOffset];
+        auto dest   = &targetUniform->mSamplerData[locationInfo.arrayIndex];
         if (memcmp(dest, v, size) != 0)
         {
             memcpy(dest, v, size);
@@ -2213,7 +2213,7 @@
     D3DUniform *targetUniform = getD3DUniformFromLocation(location);
 
     unsigned int elementCount = targetUniform->elementCount();
-    unsigned int arrayElementOffset = mState.getUniformLocations()[location].flattenedArrayOffset;
+    unsigned int arrayElementOffset = mState.getUniformLocations()[location].arrayIndex;
     unsigned int count =
         std::min(elementCount - arrayElementOffset, static_cast<unsigned int>(countIn));
 
@@ -2666,8 +2666,7 @@
     const gl::LinkedUniform &uniform         = mState.getUniforms()[locationInfo.index];
 
     const D3DUniform *targetUniform = getD3DUniformFromLocation(location);
-    const uint8_t *srcPointer       = targetUniform->getDataPtrToElement(
-        locationInfo.arrayIndices.empty() ? 0u : locationInfo.flattenedArrayOffset);
+    const uint8_t *srcPointer       = targetUniform->getDataPtrToElement(locationInfo.arrayIndex);
 
     if (gl::IsMatrixType(uniform.type))
     {