Move FBO check from applyRenderTarget to the API.

We would traverse the applyRenderTarget path from several entry
points, which could then trigger a GL error. In-line with our
validation refactoring, move all error checks prior to executing
any state logic.

BUG=angle:571

Change-Id: I51f5bcfa41be7cdba7771eb87d5a831fa622f984
Reviewed-on: https://chromium-review.googlesource.com/203772
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 0c08ac8..d8f8de8 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -7863,9 +7863,9 @@
 
         if (context)
         {
-            if (context->getClientVersion() < 3)
+            if (!ValidateClearBuffer(context))
             {
-                return gl::error(GL_INVALID_OPERATION);
+                return;
             }
 
             switch (buffer)
@@ -7906,9 +7906,9 @@
 
         if (context)
         {
-            if (context->getClientVersion() < 3)
+            if (!ValidateClearBuffer(context))
             {
-                return gl::error(GL_INVALID_OPERATION);
+                return;
             }
 
             switch (buffer)
@@ -7943,9 +7943,9 @@
 
         if (context)
         {
-            if (context->getClientVersion() < 3)
+            if (!ValidateClearBuffer(context))
             {
-                return gl::error(GL_INVALID_OPERATION);
+                return;
             }
 
             switch (buffer)
@@ -7986,9 +7986,9 @@
 
         if (context)
         {
-            if (context->getClientVersion() < 3)
+            if (!ValidateClearBuffer(context))
             {
-                return gl::error(GL_INVALID_OPERATION);
+                return;
             }
 
             switch (buffer)