Changeset 252851 in webkit


Ignore:
Timestamp:
Nov 25, 2019 2:08:39 AM (4 years ago)
Author:
ChangSeok Oh
Message:

[GTK] Check EGL image extension by using native gl API in AcceleratedBackingStoreWayland
https://bugs.webkit.org/show_bug.cgi?id=204446

Reviewed by Carlos Garcia Campos.

This change is part of efforts bringing ANGLE backend for WebGL to the gtk port.
When ANGLE WebGL is enabled, we face a dilemma of choosing either Extensions3DANGLE
or Extensions3DOpenGL in AcceleratedBackingStoreWayland.cpp. Since they cannot
coexist, we chose Extensions3DANGLE even if what we really want is Extensions3DOepnGL.
We address this problem by directly checking egl image extension availability
via native GL API rather than relying on Extensions3D* classes in the file.

  • UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:

(WebKit::isEGLImageAvailable):
(WebKit::AcceleratedBackingStoreWayland::checkRequirements):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r252849 r252851  
     12019-11-25  ChangSeok Oh  <changseok@webkit.org>
     2
     3        [GTK] Check EGL image extension by using native gl API in AcceleratedBackingStoreWayland
     4        https://bugs.webkit.org/show_bug.cgi?id=204446
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        This change is part of efforts bringing ANGLE backend for WebGL to the gtk port.
     9        When ANGLE WebGL is enabled, we face a dilemma of choosing either Extensions3DANGLE
     10        or Extensions3DOpenGL in AcceleratedBackingStoreWayland.cpp. Since they cannot
     11        coexist, we chose Extensions3DANGLE even if what we really want is Extensions3DOepnGL.
     12        We address this problem by directly checking egl image extension availability
     13        via native GL API rather than relying on Extensions3D* classes in the file.
     14
     15        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
     16        (WebKit::isEGLImageAvailable):
     17        (WebKit::AcceleratedBackingStoreWayland::checkRequirements):
     18
    1192019-11-25  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp

    r252717 r252851  
    3939#include <WebCore/GLContext.h>
    4040
    41 #if USE(ANGLE)
    42 #include <WebCore/Extensions3DANGLE.h>
    43 #include <WebCore/OpenGLShims.h>
    44 #elif USE(OPENGL_ES)
     41#if USE(OPENGL_ES)
    4542#include <GLES2/gl2.h>
    4643#include <GLES2/gl2ext.h>
    47 #include <WebCore/Extensions3DOpenGLES.h>
    48 #else
    49 #include <WebCore/Extensions3DOpenGL.h>
     44#else
    5045#include <WebCore/OpenGLShims.h>
    5146#endif
     
    6762namespace WebKit {
    6863using namespace WebCore;
     64
     65bool isEGLImageAvailable(bool useIndexedGetString)
     66{
     67#if USE(OPENGL_ES)
     68    UNUSED_PARAM(useIndexedGetString);
     69#else
     70    if (useIndexedGetString) {
     71        GLint numExtensions = 0;
     72        ::glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
     73        for (GLint i = 0; i < numExtensions; ++i) {
     74            String extension = String(reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i)));
     75            if (extension == "GL_OES_EGL_image" || extension == "GL_OES_EGL_image_external")
     76                return true;
     77        }
     78    } else
     79#endif
     80    {
     81        String extensionsString = String(reinterpret_cast<const char*>(::glGetString(GL_EXTENSIONS)));
     82        for (auto& extension : extensionsString.split(' ')) {
     83            if (extension == "GL_OES_EGL_image" || extension == "GL_OES_EGL_image_external")
     84                return true;
     85        }
     86    }
     87
     88    return false;
     89}
    6990
    7091bool AcceleratedBackingStoreWayland::checkRequirements()
     
    82103            return false;
    83104
    84 #if USE(ANGLE)
    85         std::unique_ptr<Extensions3DANGLE> glExtensions = makeUnique<Extensions3DANGLE>(nullptr, GLContext::current()->version() >= 320);
    86 #elif USE(OPENGL_ES)
    87         std::unique_ptr<Extensions3DOpenGLES> glExtensions = makeUnique<Extensions3DOpenGLES>(nullptr,  false);
    88 #else
    89         std::unique_ptr<Extensions3DOpenGL> glExtensions = makeUnique<Extensions3DOpenGL>(nullptr, GLContext::current()->version() >= 320);
    90 #endif
    91         if (glExtensions->supports("GL_OES_EGL_image") || glExtensions->supports("GL_OES_EGL_image_external"))
     105#if USE(OPENGL_ES)
     106        if (isEGLImageAvailable(false))
     107#else
     108        if (isEGLImageAvailable(GLContext::current()->version() >= 320))
     109#endif
    92110            glImageTargetTexture2D = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"));
    93111    }
Note: See TracChangeset for help on using the changeset viewer.