Title: [283301] trunk/Source/WebCore
- Revision
- 283301
- Author
- [email protected]
- Date
- 2021-09-29 22:30:32 -0700 (Wed, 29 Sep 2021)
Log Message
GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
https://bugs.webkit.org/show_bug.cgi?id=230946
Patch by Kimmo Kinnunen <[email protected]> on 2021-09-29
Reviewed by Antti Koivisto.
For consistency, avoid crashing the GPUP mode when trying
to create GraphicsContextGLOpenGL when the ANGLE-shared dylib
is not present.
No new tests, refactor.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::isANGLEAvailable):
(WebCore::initializeEGLDisplay):
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
(WebCore::InitializeEGLDisplay): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (283300 => 283301)
--- trunk/Source/WebCore/ChangeLog 2021-09-30 05:27:45 UTC (rev 283300)
+++ trunk/Source/WebCore/ChangeLog 2021-09-30 05:30:32 UTC (rev 283301)
@@ -1,5 +1,26 @@
2021-09-29 Kimmo Kinnunen <[email protected]>
+ GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
+ https://bugs.webkit.org/show_bug.cgi?id=230946
+
+ Reviewed by Antti Koivisto.
+
+ For consistency, avoid crashing the GPUP mode when trying
+ to create GraphicsContextGLOpenGL when the ANGLE-shared dylib
+ is not present.
+
+ No new tests, refactor.
+
+ * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+ (WebCore::isANGLEAvailable):
+ (WebCore::initializeEGLDisplay):
+ (WebCore::GraphicsContextGLOpenGL::create):
+ (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
+ (WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
+ (WebCore::InitializeEGLDisplay): Deleted.
+
+2021-09-29 Kimmo Kinnunen <[email protected]>
+
Cocoa GraphicsContextGLOpenGL should be more robust in destruction
https://bugs.webkit.org/show_bug.cgi?id=230940
Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (283300 => 283301)
--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-09-30 05:27:45 UTC (rev 283300)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm 2021-09-30 05:30:32 UTC (rev 283301)
@@ -59,6 +59,11 @@
namespace WebCore {
+static bool isANGLEAvailable()
+{
+ return !!EGL_Initialize;
+}
+
// In isCurrentContextPredictable() == true case this variable is accessed in single-threaded manner.
// In isCurrentContextPredictable() == false case this variable is accessed from multiple threads but always sequentially
// and it always contains nullptr and nullptr is always written to it.
@@ -113,8 +118,13 @@
return false;
}
-static ScopedEGLDefaultDisplay InitializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
+static ScopedEGLDefaultDisplay initializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
{
+ if (!isANGLEAvailable()) {
+ WTFLogAlways("Failed to load ANGLE shared library.");
+ return { };
+ }
+
EGLint majorVersion = 0;
EGLint minorVersion = 0;
EGLDisplay display;
@@ -180,19 +190,8 @@
}
#endif
-static bool isANGLEAvailable()
-{
- return !!EGL_Initialize;
-}
-
RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attrs, HostWindow* hostWindow)
{
- // If ANGLE is not loaded, we can fail immediately.
- if (!isANGLEAvailable()) {
- WTFLogAlways("ANGLE shared library was not loaded. Can't make GraphicsContextGL.");
- return nullptr;
- }
-
// Make space for the incoming context if we're full.
GraphicsContextGLOpenGLManager::sharedManager().recycleContextIfNecessary();
if (GraphicsContextGLOpenGLManager::sharedManager().hasTooManyContexts())
@@ -245,7 +244,7 @@
}
#endif
- m_displayObj = InitializeEGLDisplay(attrs);
+ m_displayObj = initializeEGLDisplay(attrs);
if (!m_displayObj)
return;
@@ -519,7 +518,7 @@
return false;
if (currentContext == this)
return true;
- // Calling MakeCurrent is important to set volatile platform context. See InitializeEGLDisplay().
+ // Calling MakeCurrent is important to set volatile platform context. See initializeEGLDisplay().
if (!EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj))
return false;
if (isCurrentContextPredictable())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes