Merge the ProgramBinary class into Program.

BUG=angle:731

Change-Id: I2ee97155841dc62f04bb71c1f2035d210fd3883c
Reviewed-on: https://chromium-review.googlesource.com/232694
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 695f94f..08ded1d 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -15,7 +15,8 @@
 #include "libANGLE/FramebufferAttachment.h"
 #include "libANGLE/formatutils.h"
 #include "libANGLE/Query.h"
-#include "libANGLE/ProgramBinary.h"
+#include "libANGLE/Program.h"
+#include "libANGLE/Uniform.h"
 #include "libANGLE/TransformFeedback.h"
 #include "libANGLE/VertexArray.h"
 #include "libANGLE/renderer/BufferImpl.h"
@@ -1058,8 +1059,8 @@
         return false;
     }
 
-    gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary();
-    if (!programBinary)
+    gl::Program *program = context->getState().getProgram();
+    if (!program)
     {
         context->recordError(Error(GL_INVALID_OPERATION));
         return false;
@@ -1071,13 +1072,13 @@
         return false;
     }
 
-    if (!programBinary->isValidUniformLocation(location))
+    if (!program->isValidUniformLocation(location))
     {
         context->recordError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
-    LinkedUniform *uniform = programBinary->getUniformByLocation(location);
+    LinkedUniform *uniform = program->getUniformByLocation(location);
 
     // attempting to write an array to a non-array uniform is an INVALID_OPERATION
     if (uniform->elementCount() == 1 && count > 1)
@@ -1461,14 +1462,14 @@
         return false;
     }
 
-    if (state.getCurrentProgramId() == 0)
+    gl::Program *program = state.getProgram();
+    if (!program)
     {
         context->recordError(Error(GL_INVALID_OPERATION));
         return false;
     }
 
-    gl::ProgramBinary *programBinary = state.getCurrentProgramBinary();
-    if (!programBinary->validateSamplers(NULL, context->getCaps()))
+    if (!program->validateSamplers(NULL, context->getCaps()))
     {
         context->recordError(Error(GL_INVALID_OPERATION));
         return false;
@@ -1479,7 +1480,7 @@
     for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
     {
         const VertexAttribute &attrib = vao->getVertexAttribute(attributeIndex);
-        bool attribActive = (programBinary->getSemanticIndex(attributeIndex) != -1);
+        bool attribActive = (program->getSemanticIndex(attributeIndex) != -1);
         if (attribActive && attrib.enabled)
         {
             gl::Buffer *buffer = attrib.buffer.get();
@@ -1573,13 +1574,13 @@
     // Verify there is at least one active attribute with a divisor of zero
     const gl::State& state = context->getState();
 
-    gl::ProgramBinary *programBinary = state.getCurrentProgramBinary();
+    gl::Program *program = state.getProgram();
 
     const VertexArray *vao = state.getVertexArray();
     for (int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
     {
         const VertexAttribute &attrib = vao->getVertexAttribute(attributeIndex);
-        bool active = (programBinary->getSemanticIndex(attributeIndex) != -1);
+        bool active = (program->getSemanticIndex(attributeIndex) != -1);
         if (active && attrib.divisor == 0)
         {
             return true;
@@ -1886,14 +1887,7 @@
         return false;
     }
 
-    gl::ProgramBinary *programBinary = programObject->getProgramBinary();
-    if (!programBinary)
-    {
-        context->recordError(Error(GL_INVALID_OPERATION));
-        return false;
-    }
-
-    if (!programBinary->isValidUniformLocation(location))
+    if (!programObject->isValidUniformLocation(location))
     {
         context->recordError(Error(GL_INVALID_OPERATION));
         return false;
@@ -1921,10 +1915,9 @@
 
     gl::Program *programObject = context->getProgram(program);
     ASSERT(programObject);
-    gl::ProgramBinary *programBinary = programObject->getProgramBinary();
 
     // sized queries -- ensure the provided buffer is large enough
-    LinkedUniform *uniform = programBinary->getUniformByLocation(location);
+    LinkedUniform *uniform = programObject->getUniformByLocation(location);
     size_t requiredBytes = VariableExternalSize(uniform->type);
     if (static_cast<size_t>(bufSize) < requiredBytes)
     {