Update the draw calls to return Error objects.

BUG=angle:520

Change-Id: I3330ba2dbe095fc9460789822a938420a80a149f
Reviewed-on: https://chromium-review.googlesource.com/213823
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index a62e163..198c0ee 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -1343,7 +1343,12 @@
             return;
         }
 
-        context->drawArrays(mode, first, count, 0);
+        gl::Error error = context->drawArrays(mode, first, count, 0);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }
 
@@ -1359,7 +1364,12 @@
             return;
         }
 
-        context->drawArrays(mode, first, count, primcount);
+        gl::Error error = context->drawArrays(mode, first, count, primcount);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }
 
@@ -1377,7 +1387,12 @@
             return;
         }
 
-        context->drawElements(mode, count, type, indices, 0, indexRange);
+        gl::Error error = context->drawElements(mode, count, type, indices, 0, indexRange);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }
 
@@ -1395,7 +1410,12 @@
             return;
         }
 
-        context->drawElements(mode, count, type, indices, primcount, indexRange);
+        gl::Error error = context->drawElements(mode, count, type, indices, primcount, indexRange);
+        if (error.isError())
+        {
+            context->recordError(error);
+            return;
+        }
     }
 }