Fix "start" vertex being applied for instanced buffers.

In GLES, the start vertex only applies to non-instanced vertex
attributes.

BUG=angle:864
BUG=447140

Change-Id: Idd2afbfbd4c2e76e06b2704cc002fae26b353109
Reviewed-on: https://chromium-review.googlesource.com/239843
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Austin Kinross <aukinros@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 37a3633..d3eab8b 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -247,10 +247,13 @@
     unsigned int streamOffset = 0;
     unsigned int outputElementSize = 0;
 
+    // Instanced vertices do not apply the 'start' offset
+    GLint firstVertexIndex = (instances > 0 && attrib.divisor > 0 ? 0 : start);
+
     if (directStorage)
     {
         outputElementSize = ComputeVertexAttributeStride(attrib);
-        streamOffset = attrib.offset + outputElementSize * start;
+        streamOffset = attrib.offset + outputElementSize * firstVertexIndex;
     }
     else if (staticBuffer)
     {
@@ -275,7 +278,7 @@
         }
 
         unsigned int firstElementOffset = (attrib.offset / ComputeVertexAttributeStride(attrib)) * outputElementSize;
-        unsigned int startOffset = (instances == 0 || attrib.divisor == 0) ? start * outputElementSize : 0;
+        unsigned int startOffset = (instances == 0 || attrib.divisor == 0) ? firstVertexIndex * outputElementSize : 0;
         if (streamOffset + firstElementOffset + startOffset < streamOffset)
         {
             return gl::Error(GL_OUT_OF_MEMORY);
@@ -292,7 +295,8 @@
             return error;
         }
 
-        error = mStreamingBuffer->storeVertexAttributes(attrib, currentValue, start, totalCount, instances, &streamOffset);
+        error = mStreamingBuffer->storeVertexAttributes(attrib, currentValue, firstVertexIndex,
+                                                        totalCount, instances, &streamOffset);
         if (error.isError())
         {
             return error;