Bug 1382185 - Consider un-forced MakeCurrent failures context-loss. - r=nical draft
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 21 Jul 2017 18:07:32 -0700
changeset 613468 2a209842fb03d05af4b9781f714884ab64f5872d
parent 613465 19b66dcfa7f6a12252252a4ef410e91f881c9805
child 638686 873f0bd9f4bd5995a5c184f1a674fa66999ca206
push id69812
push userbmo:jgilbert@mozilla.com
push dateSat, 22 Jul 2017 01:07:49 +0000
reviewersnical
bugs1382185
milestone56.0a1
Bug 1382185 - Consider un-forced MakeCurrent failures context-loss. - r=nical MozReview-Commit-ID: 41sxZPD313
gfx/gl/GLContext.cpp
--- 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