r?jrmuizel - Require initialization for egl.IsANGLE().
draft
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
--- 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() {