⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283301 in webkit


Ignore:
Timestamp:
Sep 29, 2021, 10:30:32 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
https://bugs.webkit.org/show_bug.cgi?id=230946

Patch by Kimmo Kinnunen <kkinnunen@apple.com> 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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r283299 r283301  
     12021-09-29  Kimmo Kinnunen  <kkinnunen@apple.com>
     2
     3        GPUP Cocoa GraphicsContextGLOpenGL should check for ANGLE presence
     4        https://bugs.webkit.org/show_bug.cgi?id=230946
     5
     6        Reviewed by Antti Koivisto.
     7
     8        For consistency, avoid crashing the GPUP mode when trying
     9        to create GraphicsContextGLOpenGL when the ANGLE-shared dylib
     10        is not present.
     11
     12        No new tests, refactor.
     13
     14        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
     15        (WebCore::isANGLEAvailable):
     16        (WebCore::initializeEGLDisplay):
     17        (WebCore::GraphicsContextGLOpenGL::create):
     18        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
     19        (WebCore::GraphicsContextGLOpenGL::makeContextCurrent):
     20        (WebCore::InitializeEGLDisplay): Deleted.
     21
    1222021-09-29  Kimmo Kinnunen  <kkinnunen@apple.com>
    223
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm

    r283299 r283301  
    6060namespace WebCore {
    6161
     62static bool isANGLEAvailable()
     63{
     64    return !!EGL_Initialize;
     65}
     66
    6267// In isCurrentContextPredictable() == true case this variable is accessed in single-threaded manner.
    6368// In isCurrentContextPredictable() == false case this variable is accessed from multiple threads but always sequentially
     
    114119}
    115120
    116 static ScopedEGLDefaultDisplay InitializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
    117 {
     121static ScopedEGLDefaultDisplay initializeEGLDisplay(const GraphicsContextGLAttributes& attrs)
     122{
     123    if (!isANGLEAvailable()) {
     124        WTFLogAlways("Failed to load ANGLE shared library.");
     125        return { };
     126    }
     127
    118128    EGLint majorVersion = 0;
    119129    EGLint minorVersion = 0;
     
    181191#endif
    182192
    183 static bool isANGLEAvailable()
    184 {
    185     return !!EGL_Initialize;
    186 }
    187 
    188193RefPtr<GraphicsContextGLOpenGL> GraphicsContextGLOpenGL::create(GraphicsContextGLAttributes attrs, HostWindow* hostWindow)
    189194{
    190     // If ANGLE is not loaded, we can fail immediately.
    191     if (!isANGLEAvailable()) {
    192         WTFLogAlways("ANGLE shared library was not loaded. Can't make GraphicsContextGL.");
    193         return nullptr;
    194     }
    195 
    196195    // Make space for the incoming context if we're full.
    197196    GraphicsContextGLOpenGLManager::sharedManager().recycleContextIfNecessary();
     
    246245#endif
    247246
    248     m_displayObj = InitializeEGLDisplay(attrs);
     247    m_displayObj = initializeEGLDisplay(attrs);
    249248    if (!m_displayObj)
    250249        return;
     
    520519    if (currentContext == this)
    521520        return true;
    522     // Calling MakeCurrent is important to set volatile platform context. See InitializeEGLDisplay().
     521    // Calling MakeCurrent is important to set volatile platform context. See initializeEGLDisplay().
    523522    if (!EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj))
    524523        return false;
Note: See TracChangeset for help on using the changeset viewer.