Remove ProgramImpl::getBinaryFormat.
Because we only expose GL_ANGLE_program_binary, we're only allowed to use
the GL_PROGRAM_BINARY_ANGLE binary type. This should be enforced at the
GL level. If implementations wish to use multiple types of formats
internally, they are able to by writing those enums to their binaries.
BUG=angleproject:882
BUG=angleproject:1123
Change-Id: I43685958814e4333b7cef3952d92c1017dc885f8
Reviewed-on: https://chromium-review.googlesource.com/303827
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index 13277b3..48a8853 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -583,17 +583,15 @@
#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
return Error(GL_NO_ERROR);
#else
- ASSERT(binaryFormat == mProgram->getBinaryFormat());
-
- BinaryInputStream stream(binary, length);
-
- GLenum format = stream.readInt<GLenum>();
- if (format != mProgram->getBinaryFormat())
+ ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE);
+ if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
{
mInfoLog << "Invalid program binary format.";
return Error(GL_NO_ERROR);
}
+ BinaryInputStream stream(binary, length);
+
int majorVersion = stream.readInt<int>();
int minorVersion = stream.readInt<int>();
if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
@@ -710,12 +708,11 @@
{
if (binaryFormat)
{
- *binaryFormat = mProgram->getBinaryFormat();
+ *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
}
BinaryOutputStream stream;
- stream.writeInt(mProgram->getBinaryFormat());
stream.writeInt(ANGLE_MAJOR_VERSION);
stream.writeInt(ANGLE_MINOR_VERSION);
stream.writeBytes(reinterpret_cast<const unsigned char*>(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE);