Store optimization level in program binaries and do not load those compiled with a different level.
Review URL: https://codereview.appspot.com/9427043


Conflicts:

	src/libGLESv2/renderer/Renderer9.cpp

git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2332 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index 33fb108..fa3c178 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -1440,6 +1440,14 @@
         return false;
     }
 
+    int compileFlags = 0;
+    stream.read(&compileFlags);
+    if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+    {
+        infoLog.append("Mismatched compilation flags.");
+        return false;
+    }
+
     for (int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
     {
         stream.read(&mLinkedAttribute[i].type);
@@ -1639,6 +1647,7 @@
 
     stream.write(GL_PROGRAM_BINARY_ANGLE);
     stream.write(VERSION_DWORD);
+    stream.write(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
 
     for (unsigned int i = 0; i < MAX_VERTEX_ATTRIBS; ++i)
     {