Commit c46cc2f3 by Geoff Lang

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/303827Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 2b280922
...@@ -583,17 +583,15 @@ Error Program::loadBinary(GLenum binaryFormat, const void *binary, GLsizei lengt ...@@ -583,17 +583,15 @@ Error Program::loadBinary(GLenum binaryFormat, const void *binary, GLsizei lengt
#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED #if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
return Error(GL_NO_ERROR); return Error(GL_NO_ERROR);
#else #else
ASSERT(binaryFormat == mProgram->getBinaryFormat()); ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE);
if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
BinaryInputStream stream(binary, length);
GLenum format = stream.readInt<GLenum>();
if (format != mProgram->getBinaryFormat())
{ {
mInfoLog << "Invalid program binary format."; mInfoLog << "Invalid program binary format.";
return Error(GL_NO_ERROR); return Error(GL_NO_ERROR);
} }
BinaryInputStream stream(binary, length);
int majorVersion = stream.readInt<int>(); int majorVersion = stream.readInt<int>();
int minorVersion = stream.readInt<int>(); int minorVersion = stream.readInt<int>();
if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION) if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
...@@ -710,12 +708,11 @@ Error Program::saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, G ...@@ -710,12 +708,11 @@ Error Program::saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, G
{ {
if (binaryFormat) if (binaryFormat)
{ {
*binaryFormat = mProgram->getBinaryFormat(); *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
} }
BinaryOutputStream stream; BinaryOutputStream stream;
stream.writeInt(mProgram->getBinaryFormat());
stream.writeInt(ANGLE_MAJOR_VERSION); stream.writeInt(ANGLE_MAJOR_VERSION);
stream.writeInt(ANGLE_MINOR_VERSION); stream.writeInt(ANGLE_MINOR_VERSION);
stream.writeBytes(reinterpret_cast<const unsigned char*>(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE); stream.writeBytes(reinterpret_cast<const unsigned char*>(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE);
......
...@@ -35,7 +35,6 @@ class ProgramImpl : angle::NonCopyable ...@@ -35,7 +35,6 @@ class ProgramImpl : angle::NonCopyable
ProgramImpl(const gl::Program::Data &data) : mData(data) {} ProgramImpl(const gl::Program::Data &data) : mData(data) {}
virtual ~ProgramImpl() {} virtual ~ProgramImpl() {}
virtual GLenum getBinaryFormat() = 0;
virtual LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) = 0; virtual LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) = 0;
virtual gl::Error save(gl::BinaryOutputStream *stream) = 0; virtual gl::Error save(gl::BinaryOutputStream *stream) = 0;
......
...@@ -88,7 +88,6 @@ class ProgramD3D : public ProgramImpl ...@@ -88,7 +88,6 @@ class ProgramD3D : public ProgramImpl
bool usesGeometryShader() const; bool usesGeometryShader() const;
bool usesInstancedPointSpriteEmulation() const; bool usesInstancedPointSpriteEmulation() const;
GLenum getBinaryFormat() { return GL_PROGRAM_BINARY_ANGLE; }
LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream); LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream);
gl::Error save(gl::BinaryOutputStream *stream); gl::Error save(gl::BinaryOutputStream *stream);
......
...@@ -34,12 +34,6 @@ ProgramGL::~ProgramGL() ...@@ -34,12 +34,6 @@ ProgramGL::~ProgramGL()
mProgramID = 0; mProgramID = 0;
} }
GLenum ProgramGL::getBinaryFormat()
{
UNIMPLEMENTED();
return GLenum();
}
LinkResult ProgramGL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) LinkResult ProgramGL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -31,7 +31,6 @@ class ProgramGL : public ProgramImpl ...@@ -31,7 +31,6 @@ class ProgramGL : public ProgramImpl
StateManagerGL *stateManager); StateManagerGL *stateManager);
~ProgramGL() override; ~ProgramGL() override;
GLenum getBinaryFormat() override;
LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) override; LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) override;
gl::Error save(gl::BinaryOutputStream *stream) override; gl::Error save(gl::BinaryOutputStream *stream) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment