Split the Context and Renderer draw* to one per entry point.

BUG=angleproject:1136

Change-Id: Ic7ff9c23201e1fe03c5a2135be24d61cfe3d6268
Reviewed-on: https://chromium-review.googlesource.com/295232
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 40f4373..c131ef0 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -33,6 +33,27 @@
 #include "libANGLE/validationES.h"
 #include "libANGLE/renderer/Renderer.h"
 
+namespace
+{
+
+void MarkTransformFeedbackBufferUsage(gl::TransformFeedback *transformFeedback)
+{
+    if (transformFeedback->isActive() && !transformFeedback->isPaused())
+    {
+        for (size_t tfBufferIndex = 0; tfBufferIndex < transformFeedback->getIndexedBufferCount();
+             tfBufferIndex++)
+        {
+            const OffsetBindingPointer<gl::Buffer> &buffer =
+                transformFeedback->getIndexedBuffer(tfBufferIndex);
+            if (buffer.get() != nullptr)
+            {
+                buffer->onTransformFeedback();
+            }
+        }
+    }
+}
+}  // anonymous namespace
+
 namespace gl
 {
 
@@ -1248,37 +1269,67 @@
     return false;
 }
 
-Error Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
+Error Context::drawArrays(GLenum mode, GLint first, GLsizei count)
 {
     syncRendererState();
-    Error error = mRenderer->drawArrays(getData(), mode, first, count, instances);
+    Error error = mRenderer->drawArrays(getData(), mode, first, count);
     if (error.isError())
     {
         return error;
     }
 
-    TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
-    if (transformFeedback->isActive() && !transformFeedback->isPaused())
-    {
-        for (size_t tfBufferIndex = 0; tfBufferIndex < transformFeedback->getIndexedBufferCount(); tfBufferIndex++)
-        {
-            const OffsetBindingPointer<Buffer> &buffer = transformFeedback->getIndexedBuffer(tfBufferIndex);
-            if (buffer.get() != nullptr)
-            {
-                buffer->onTransformFeedback();
-            }
-        }
-    }
+    MarkTransformFeedbackBufferUsage(mState.getCurrentTransformFeedback());
 
     return Error(GL_NO_ERROR);
 }
 
-Error Context::drawElements(GLenum mode, GLsizei count, GLenum type,
-                            const GLvoid *indices, GLsizei instances,
+Error Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+{
+    syncRendererState();
+    Error error = mRenderer->drawArraysInstanced(getData(), mode, first, count, instanceCount);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    MarkTransformFeedbackBufferUsage(mState.getCurrentTransformFeedback());
+
+    return Error(GL_NO_ERROR);
+}
+
+Error Context::drawElements(GLenum mode,
+                            GLsizei count,
+                            GLenum type,
+                            const GLvoid *indices,
                             const RangeUI &indexRange)
 {
     syncRendererState();
-    return mRenderer->drawElements(getData(), mode, count, type, indices, instances, indexRange);
+    return mRenderer->drawElements(getData(), mode, count, type, indices, indexRange);
+}
+
+Error Context::drawElementsInstanced(GLenum mode,
+                                     GLsizei count,
+                                     GLenum type,
+                                     const GLvoid *indices,
+                                     GLsizei instances,
+                                     const RangeUI &indexRange)
+{
+    syncRendererState();
+    return mRenderer->drawElementsInstanced(getData(), mode, count, type, indices, instances,
+                                            indexRange);
+}
+
+Error Context::drawRangeElements(GLenum mode,
+                                 GLuint start,
+                                 GLuint end,
+                                 GLsizei count,
+                                 GLenum type,
+                                 const GLvoid *indices,
+                                 const RangeUI &indexRange)
+{
+    syncRendererState();
+    return mRenderer->drawRangeElements(getData(), mode, start, end, count, type, indices,
+                                        indexRange);
 }
 
 Error Context::flush()