Bug 1382185 - Consider un-forced MakeCurrent failures context-loss. - r=nical
MozReview-Commit-ID: 41sxZPD313
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -2915,30 +2915,38 @@ GetBytesPerTexel(GLenum format, GLenum t
bool
GLContext::MakeCurrent(bool aForce)
{
const auto fnMakeCurrent = [&]() {
if (IsDestroyed())
return false;
- if (mUseTLSIsCurrent && !aForce && sCurrentContext.get() == this) {
- MOZ_ASSERT(IsCurrent());
- return true;
+ if (!aForce) {
+ if (mContextLost)
+ return false;
+
+ if (mUseTLSIsCurrent && sCurrentContext.get() == this) {
+ MOZ_ASSERT(IsCurrent());
+ return true;
+ }
}
return MakeCurrentImpl(aForce);
};
const GLContext* currentContext;
if (fnMakeCurrent()) {
currentContext = this;
} else {
ClearMakeCurrent();
currentContext = nullptr;
+ if (!aForce) {
+ mContextLost = true;
+ }
}
#ifdef MOZ_GL_DEBUG
PR_SetThreadPrivate(sCurrentGLContextTLS, (void*)currentContext);
// XXX this assertion is disabled because it's triggering on Mac;
// we need to figure out why and reenable it.
#if 0