When applying vertex array objects, update the currently applied index buffer.

When binding a vertex array object, it was not changing the tracked index
buffer binding.  This was causing the buffer bindings to sometimes not be
updated between index and non-indexed draw calls.

Fixes:
 * Intermittent crashes in chromium startup.
 * conformance/rendering/many-draw-calls.html
 * conformance/rendering/framebuffer-switch.html
 * conformance/attribs/gl-bindAttribLocation-aliasing.html
 * conformance/attribs/gl-vertex-attrib-render.html
 * conformance/buffers/index-validation-verifies-too-many-indices.html

BUG=angleproject:883

Change-Id: I34ed1ebc65b339329c0f9ab9c28a392f552ed3d8
Reviewed-on: https://chromium-review.googlesource.com/273300
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/VertexArrayGL.cpp b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
index 48e0ddc..93a352e 100644
--- a/src/libANGLE/renderer/gl/VertexArrayGL.cpp
+++ b/src/libANGLE/renderer/gl/VertexArrayGL.cpp
@@ -103,7 +103,7 @@
 
 gl::Error VertexArrayGL::syncDrawState(GLint first, GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const
 {
-    mStateManager->bindVertexArray(mVertexArrayID);
+    mStateManager->bindVertexArray(mVertexArrayID, mAppliedElementArrayBuffer);
 
     // Check if any attributes need to be streamed, determines if the index range needs to be computed
     bool attributesNeedStreaming = doAttributesNeedStreaming();
@@ -404,4 +404,9 @@
     return mVertexArrayID;
 }
 
+GLuint VertexArrayGL::getAppliedElementArrayBufferID() const
+{
+    return mAppliedElementArrayBuffer;
+}
+
 }