Commit a2c74985 by Jamie Madill Committed by Commit Bot

Don't load binaries across client versions.

BUG=angleproject:523 Change-Id: Id54033dce15f01a0f2891533172acd8b99896e12 Reviewed-on: https://chromium-review.googlesource.com/418240 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 92db6947
...@@ -39,6 +39,7 @@ struct TranslatedAttribute; ...@@ -39,6 +39,7 @@ struct TranslatedAttribute;
namespace gl namespace gl
{ {
struct Caps; struct Caps;
class Context;
class ContextState; class ContextState;
class ResourceManager; class ResourceManager;
class Shader; class Shader;
...@@ -266,8 +267,15 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -266,8 +267,15 @@ class Program final : angle::NonCopyable, public LabeledObject
Error link(const ContextState &data); Error link(const ContextState &data);
bool isLinked() const; bool isLinked() const;
Error loadBinary(GLenum binaryFormat, const void *binary, GLsizei length); Error loadBinary(const Context *context,
Error saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length) const; GLenum binaryFormat,
const void *binary,
GLsizei length);
Error saveBinary(const Context *context,
GLenum *binaryFormat,
void *binary,
GLsizei bufSize,
GLsizei *length) const;
GLint getBinaryLength() const; GLint getBinaryLength() const;
void setBinaryRetrievableHint(bool retrievable); void setBinaryRetrievableHint(bool retrievable);
bool getBinaryRetrievableHint() const; bool getBinaryRetrievableHint() const;
...@@ -392,9 +400,9 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -392,9 +400,9 @@ class Program final : angle::NonCopyable, public LabeledObject
bool linkUniformBlocks(InfoLog &infoLog, const Caps &caps); bool linkUniformBlocks(InfoLog &infoLog, const Caps &caps);
bool linkVaryings(InfoLog &infoLog, const Shader *vertexShader, const Shader *fragmentShader) const; bool linkVaryings(InfoLog &infoLog, const Shader *vertexShader, const Shader *fragmentShader) const;
bool validateVertexAndFragmentUniforms(InfoLog &infoLog) const; bool validateVertexAndFragmentUniforms(InfoLog &infoLog) const;
bool linkUniforms(gl::InfoLog &infoLog, const gl::Caps &caps, const Bindings &uniformBindings); bool linkUniforms(InfoLog &infoLog, const Caps &caps, const Bindings &uniformBindings);
bool indexUniforms(gl::InfoLog &infoLog, const gl::Caps &caps, const Bindings &uniformBindings); bool indexUniforms(InfoLog &infoLog, const Caps &caps, const Bindings &uniformBindings);
bool areMatchingInterfaceBlocks(gl::InfoLog &infoLog, bool areMatchingInterfaceBlocks(InfoLog &infoLog,
const sh::InterfaceBlock &vertexInterfaceBlock, const sh::InterfaceBlock &vertexInterfaceBlock,
const sh::InterfaceBlock &fragmentInterfaceBlock) const; const sh::InterfaceBlock &fragmentInterfaceBlock) const;
...@@ -420,7 +428,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -420,7 +428,7 @@ class Program final : angle::NonCopyable, public LabeledObject
std::vector<const sh::Varying *> getMergedVaryings() const; std::vector<const sh::Varying *> getMergedVaryings() const;
void linkOutputVariables(); void linkOutputVariables();
bool flattenUniformsAndCheckCapsForShader(const gl::Shader &shader, bool flattenUniformsAndCheckCapsForShader(const Shader &shader,
GLuint maxUniformComponents, GLuint maxUniformComponents,
GLuint maxTextureImageUnits, GLuint maxTextureImageUnits,
const std::string &componentsErrorMessage, const std::string &componentsErrorMessage,
...@@ -497,6 +505,6 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -497,6 +505,6 @@ class Program final : angle::NonCopyable, public LabeledObject
std::vector<GLenum> mTextureUnitTypesCache; std::vector<GLenum> mTextureUnitTypesCache;
RangeUI mSamplerUniformRange; RangeUI mSamplerUniformRange;
}; };
} } // namespace gl
#endif // LIBANGLE_PROGRAM_H_ #endif // LIBANGLE_PROGRAM_H_
...@@ -768,7 +768,7 @@ void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *l ...@@ -768,7 +768,7 @@ void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *l
Program *programObject = context->getProgram(program); Program *programObject = context->getProgram(program);
ASSERT(programObject != nullptr); ASSERT(programObject != nullptr);
Error error = programObject->saveBinary(binaryFormat, binary, bufSize, length); Error error = programObject->saveBinary(context, binaryFormat, binary, bufSize, length);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
...@@ -793,7 +793,7 @@ void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const voi ...@@ -793,7 +793,7 @@ void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const voi
Program *programObject = context->getProgram(program); Program *programObject = context->getProgram(program);
ASSERT(programObject != nullptr); ASSERT(programObject != nullptr);
Error error = programObject->loadBinary(binaryFormat, binary, length); Error error = programObject->loadBinary(context, binaryFormat, binary, length);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
......
...@@ -2423,7 +2423,7 @@ void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* leng ...@@ -2423,7 +2423,7 @@ void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* leng
Program *programObject = context->getProgram(program); Program *programObject = context->getProgram(program);
ASSERT(programObject != nullptr); ASSERT(programObject != nullptr);
Error error = programObject->saveBinary(binaryFormat, binary, bufSize, length); Error error = programObject->saveBinary(context, binaryFormat, binary, bufSize, length);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
...@@ -2448,7 +2448,7 @@ void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid ...@@ -2448,7 +2448,7 @@ void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid
Program *programObject = context->getProgram(program); Program *programObject = context->getProgram(program);
ASSERT(programObject != nullptr); ASSERT(programObject != nullptr);
Error error = programObject->loadBinary(binaryFormat, binary, length); Error error = programObject->loadBinary(context, binaryFormat, binary, length);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
......
...@@ -621,6 +621,7 @@ TEST_P(ProgramBinariesAcrossPlatforms, CreateAndReloadBinary) ...@@ -621,6 +621,7 @@ TEST_P(ProgramBinariesAcrossPlatforms, CreateAndReloadBinary)
destroyEGLWindow(&eglWindow); destroyEGLWindow(&eglWindow);
} }
// clang-format off
ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms, ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms,
// | Save the program | Load the program | Expected // | Save the program | Load the program | Expected
// | using these params | using these params | link result // | using these params | using these params | link result
...@@ -631,9 +632,6 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms, ...@@ -631,9 +632,6 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms,
PlatformsWithLinkResult(ES2_D3D11_FL9_3(), ES2_D3D11_FL9_3_WARP(), false ), // Switching from hardware to software shouldn't work for FL9 either PlatformsWithLinkResult(ES2_D3D11_FL9_3(), ES2_D3D11_FL9_3_WARP(), false ), // Switching from hardware to software shouldn't work for FL9 either
PlatformsWithLinkResult(ES2_D3D11(), ES2_D3D9(), false ), // Switching from D3D11 to D3D9 shouldn't work PlatformsWithLinkResult(ES2_D3D11(), ES2_D3D9(), false ), // Switching from D3D11 to D3D9 shouldn't work
PlatformsWithLinkResult(ES2_D3D9(), ES2_D3D11(), false ), // Switching from D3D9 to D3D11 shouldn't work PlatformsWithLinkResult(ES2_D3D9(), ES2_D3D11(), false ), // Switching from D3D9 to D3D11 shouldn't work
PlatformsWithLinkResult(ES2_D3D11(), ES3_D3D11(), true ) // Switching to newer client version should work PlatformsWithLinkResult(ES2_D3D11(), ES3_D3D11(), false ), // Switching to newer client version shouldn't work
// TODO: ANGLE issue 523
// Compiling a program with client version 3, saving the binary, then loading it with client version 2 should not work
// PlatformsWithLinkResult(ES3_D3D11(), ES2_D3D11(), false )
); );
// clang-format on
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