Commit 81f891d0 by Olli Etuaho Committed by Commit Bot

Make sure ProgramGL stays usable after failed glProgramBinary

glProgramBinary may fail if the driver is incompatible with the binary that is being loaded. After this ANGLE falls back to recompiling the GLSL program from source, but this requires that the ProgramGL object used is still valid after a failed glProgramBinary call. Don't delete the GL program after a failed glProgramBinary call so that the fallback works as intended. BUG=angleproject:2751 Change-Id: I55c19d71414163b1cd9f898f304e4aa7052f6b16 Reviewed-on: https://chromium-review.googlesource.com/1160540Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent cb4ae446
...@@ -710,7 +710,7 @@ bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog) ...@@ -710,7 +710,7 @@ bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog)
mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus); mFunctions->getProgramiv(mProgramID, GL_LINK_STATUS, &linkStatus);
if (linkStatus == GL_FALSE) if (linkStatus == GL_FALSE)
{ {
// Linking failed, put the error into the info log // Linking or program binary loading failed, put the error into the info log.
GLint infoLogLength = 0; GLint infoLogLength = 0;
mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength); mFunctions->getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &infoLogLength);
...@@ -721,19 +721,18 @@ bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog) ...@@ -721,19 +721,18 @@ bool ProgramGL::checkLinkStatus(gl::InfoLog &infoLog)
std::vector<char> buf(infoLogLength); std::vector<char> buf(infoLogLength);
mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]); mFunctions->getProgramInfoLog(mProgramID, infoLogLength, nullptr, &buf[0]);
mFunctions->deleteProgram(mProgramID);
mProgramID = 0;
infoLog << buf.data(); infoLog << buf.data();
WARN() << "Program link failed unexpectedly: " << buf.data(); WARN() << "Program link or binary loading failed: " << buf.data();
} }
else else
{ {
WARN() << "Program link failed unexpectedly with no info log."; WARN() << "Program link or binary loading failed with no info log.";
} }
// TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case // This may happen under normal circumstances if we're loading program binaries and the
// driver or hardware has changed.
ASSERT(mProgramID != 0);
return false; return false;
} }
......
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