Move GetUniform validation to the validation layer.

BUG=angle:571

Change-Id: Id1b7afb22d8bd52dbf7f95f4e8cac3fc8f798596
Reviewed-on: https://chromium-review.googlesource.com/212931
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 103d4ff..a2fea54 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -3014,23 +3014,13 @@
 
     if (context)
     {
-        if (program == 0)
+        if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params))
         {
-            return gl::error(GL_INVALID_VALUE);
+            return;
         }
 
-        gl::Program *programObject = context->getProgram(program);
-
-        if (!programObject || !programObject->isLinked())
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-        if (!programBinary)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
+        gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+        ASSERT(programBinary);
 
         if (!programBinary->getUniformfv(location, &bufSize, params))
         {
@@ -3047,23 +3037,13 @@
 
     if (context)
     {
-        if (program == 0)
+        if (!ValidateGetUniformfv(context, program, location, params))
         {
-            return gl::error(GL_INVALID_VALUE);
+            return;
         }
 
-        gl::Program *programObject = context->getProgram(program);
-
-        if (!programObject || !programObject->isLinked())
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-        if (!programBinary)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
+        gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+        ASSERT(programBinary);
 
         if (!programBinary->getUniformfv(location, NULL, params))
         {
@@ -3086,23 +3066,13 @@
 
     if (context)
     {
-        if (program == 0)
+        if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params))
         {
-            return gl::error(GL_INVALID_VALUE);
+            return;
         }
 
-        gl::Program *programObject = context->getProgram(program);
-
-        if (!programObject || !programObject->isLinked())
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-        if (!programBinary)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
+        gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+        ASSERT(programBinary);
 
         if (!programBinary->getUniformiv(location, &bufSize, params))
         {
@@ -3119,23 +3089,13 @@
 
     if (context)
     {
-        if (program == 0)
+        if (!ValidateGetUniformiv(context, program, location, params))
         {
-            return gl::error(GL_INVALID_VALUE);
+            return;
         }
 
-        gl::Program *programObject = context->getProgram(program);
-
-        if (!programObject || !programObject->isLinked())
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-        if (!programBinary)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
+        gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+        ASSERT(programBinary);
 
         if (!programBinary->getUniformiv(location, NULL, params))
         {
@@ -6251,28 +6211,13 @@
 
     if (context)
     {
-        if (context->getClientVersion() < 3)
+        if (!ValidateGetUniformuiv(context, program, location, params))
         {
-            return gl::error(GL_INVALID_OPERATION);
+            return;
         }
 
-        if (program == 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Program *programObject = context->getProgram(program);
-
-        if (!programObject || !programObject->isLinked())
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-        if (!programBinary)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
+        gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
+        ASSERT(programBinary);
 
         if (!programBinary->getUniformuiv(location, NULL, params))
         {