r?jrmuizel - Require initialization for egl.IsANGLE(). draft
authorJeff Gilbert <jdashg@gmail.com>
Wed, 20 Apr 2016 17:44:35 -0700
changeset 354504 e8427594f9a17e2e64648ebbb7a6d4ec856b9574
parent 354503 7d8a6715c31504d2c5f05803b2c1510d8e8adce3
child 519018 6e6019419c202397287b18b87dc1c36fca3b30ae
push id16095
push userjgilbert@mozilla.com
push dateThu, 21 Apr 2016 00:49:36 +0000
milestone48.0a1
r?jrmuizel - Require initialization for egl.IsANGLE(). From 34a6b4b4db28ebec0d0ceb021a418117a8c89444 Mon Sep 17 00:00:00 2001 --- gfx/gl/GLContextProviderEGL.cpp | 4 ++++ gfx/gl/GLLibraryEGL.h | 3 +++ 2 files changed, 7 insertions(+) MozReview-Commit-ID: 51HSlvRWiLf
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLLibraryEGL.h
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -973,16 +973,20 @@ GLContextProviderEGL::CreateHeadless(Cre
 
 // Under EGL, on Android, pbuffers are supported fine, though
 // often without the ability to texture from them directly.
 /*static*/ already_AddRefed<GLContext>
 GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
                                       const SurfaceCaps& minCaps,
                                       CreateContextFlags flags)
 {
+    bool forceEnableHardware = bool(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE);
+    if (!sEGLLibrary.EnsureInitialized(forceEnableHardware)) // Needed for IsANGLE().
+        return nullptr;
+
     bool canOffscreenUseHeadless = true;
     if (sEGLLibrary.IsANGLE()) {
         // ANGLE needs to use PBuffers.
         canOffscreenUseHeadless = false;
     }
 
     RefPtr<GLContext> gl;
     SurfaceCaps minOffscreenCaps = minCaps;
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -494,24 +494,27 @@ public:
         MOZ_ASSERT(mSymbols.fDupNativeFenceFDANDROID);
         BEFORE_GL_CALL;
         EGLint ret = mSymbols.fDupNativeFenceFDANDROID(dpy, sync);
         AFTER_GL_CALL;
         return ret;
     }
 
     EGLDisplay Display() {
+        MOZ_ASSERT(mInitialized);
         return mEGLDisplay;
     }
 
     bool IsANGLE() const {
+        MOZ_ASSERT(mInitialized);
         return mIsANGLE;
     }
 
     bool IsWARP() const {
+        MOZ_ASSERT(mInitialized);
         return mIsWARP;
     }
 
     bool HasKHRImageBase() {
         return IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base);
     }
 
     bool HasKHRImagePixmap() {