Bug 1382185 - Check the status of MakeCurrent in GLContext.cpp. r=jgilbert
authorNicolas Silva <nsilva@mozilla.com>
Mon, 24 Jul 2017 12:24:14 +0200
changeset 419283 2a698a65f75938cf408d2fcc3d3135556e908624
parent 419282 451efff6cf90982653a0d469256b1b86281eed94
child 419284 b746e314d3d137ce61d49bc7d631bccada74227a
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1382185
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382185 - Check the status of MakeCurrent in GLContext.cpp. r=jgilbert
gfx/gl/GLContext.cpp
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -530,17 +530,19 @@ GLContext::InitWithPrefixImpl(const char
         END_SYMBOLS
     };
 
     if (!LoadGLSymbols(this, prefix, trygl, coreSymbols, "GL"))
         return false;
 
     ////////////////
 
-    MakeCurrent();
+    if (!MakeCurrent()) {
+        return false;
+    }
 
     const std::string versionStr = (const char*)fGetString(LOCAL_GL_VERSION);
     if (versionStr.find("OpenGL ES") == 0) {
         mProfile = ContextProfile::OpenGLES;
     }
 
     uint32_t majorVer, minorVer;
     if (!ParseVersion(versionStr, &majorVer, &minorVer)) {
@@ -2444,18 +2446,19 @@ GLContext::ReadTexImageHelper()
 }
 
 void
 GLContext::FlushIfHeavyGLCallsSinceLastFlush()
 {
     if (!mHeavyGLCallsSinceLastFlush) {
         return;
     }
-    MakeCurrent();
-    fFlush();
+    if (MakeCurrent()) {
+        fFlush();
+    }
 }
 
 /*static*/ bool
 GLContext::ShouldDumpExts()
 {
     return gfxEnv::GlDumpExtensions();
 }
 
@@ -2512,17 +2515,20 @@ SplitByChar(const nsACString& str, const
 void
 GLContext::Readback(SharedSurface* src, gfx::DataSourceSurface* dest)
 {
     MOZ_ASSERT(src && dest);
     MOZ_ASSERT(dest->GetSize() == src->mSize);
     MOZ_ASSERT(dest->GetFormat() == (src->mHasAlpha ? SurfaceFormat::B8G8R8A8
                                                     : SurfaceFormat::B8G8R8X8));
 
-    MakeCurrent();
+    if (!MakeCurrent()) {
+        gfxCriticalError() << "Failed to MakeCurrent in GLContext::Readback";
+        return;
+    }
 
     SharedSurface* prev = GetLockedSurface();
 
     const bool needsSwap = src != prev;
     if (needsSwap) {
         if (prev)
             prev->UnlockProd();
         src->LockProd();
@@ -2892,17 +2898,19 @@ GLContext::GetFB()
 }
 
 bool
 GLContext::InitOffscreen(const gfx::IntSize& size, const SurfaceCaps& caps)
 {
     if (!CreateScreenBuffer(size, caps))
         return false;
 
-    MakeCurrent();
+    if (!MakeCurrent()) {
+        return false;
+    }
     fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
     fScissor(0, 0, size.width, size.height);
     fViewport(0, 0, size.width, size.height);
 
     mCaps = mScreen->mCaps;
     MOZ_ASSERT(!mCaps.any);
 
     return true;