Add caps from the 6.29 table.

BUG=angle:658

Change-Id: I392f581b1aea445d60f507c1fa897c4348c1a137
Reviewed-on: https://chromium-review.googlesource.com/207371
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 73f4572..345d820 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -3720,8 +3720,18 @@
           "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)",
           n, shaders, binaryformat, binary, length);
 
-    // No binary shader formats are supported.
-    return gl::error(GL_INVALID_ENUM);
+    gl::Context* context = gl::getNonLostContext();
+    if (context)
+    {
+        const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats;
+        if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end())
+        {
+            return gl::error(GL_INVALID_ENUM);
+        }
+
+        // No binary shader formats are supported.
+        UNIMPLEMENTED();
+    }
 }
 
 void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
@@ -7982,12 +7992,10 @@
             return gl::error(GL_INVALID_OPERATION);
         }
 
-        if (!programBinary->save(binary, bufSize, length))
+        if (!programBinary->save(binaryFormat, binary, bufSize, length))
         {
             return gl::error(GL_INVALID_OPERATION);
         }
-
-        *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
     }
 }
 
@@ -8001,19 +8009,19 @@
 
     if (context)
     {
-        if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
+        const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats;
+        if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end())
         {
             return gl::error(GL_INVALID_ENUM);
         }
 
         gl::Program *programObject = context->getProgram(program);
-
         if (!programObject)
         {
             return gl::error(GL_INVALID_OPERATION);
         }
 
-        context->setProgramBinary(program, binary, length);
+        context->setProgramBinary(program, binaryFormat, binary, length);
     }
 }