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

Changeset 252717 in webkit


Ignore:
Timestamp:
Nov 20, 2019, 3:59:11 PM (7 years ago)
Author:
ChangSeok Oh
Message:

[GTK] Add ANGLE backend to GTK port
https://bugs.webkit.org/show_bug.cgi?id=199060

Reviewed by Žan Doberšek.

.:

This change brings ANGLE support for WebGL to GTK port. USE_ANGLE_WEBGL
is newly defined in OptionGTK.cmake, and turns on the USE_ANGLE_EGL flag.

  • Source/cmake/OptionsGTK.cmake: USE_ANGLE_WEBGL added.

Source/ThirdParty/ANGLE:

  • CMakeLists.txt: When USE_ANGLE_WEBGL is enabled, necessary glesv2 entry points headers are installed in the derived source directory. And then adjust-angle-include-path.sh is applied to change include paths in the entry points header files.
  • GLESv2.cmake: libglesv2_entry_points_headers is newly defined, which is a gathering of entry point headers of libGLESv2.
  • PlatformGTK.cmake: In this file, we append gl and glx related angle code as a build target. Since we want gl context and gles context simultaneously, we remove gl prototype calls from the generated libGLESv2 library. Instead, we invoke egl and gl calls of ANGLE via their non-prototype function names.
  • adjust-angle-include-paths.sh: sed is slightly different in unix and linux systems. In particular, its inplace option needs to be changed for better compatibility on linux.
  • include/CMakeLists.txt: ANGLE_WEBGL_HEADERS is newly defined. It gathers header files of ANGLE for WebGL support.

Source/WebCore:

This change aims to bring ANGLE support for WebGL to GTK port. The port
wants to have a gl context for texture mapper and a gles/egl context for webgl
simultaneously, we adopt the readPixel-copyToTexture approach for now because
sharing textures between the two different contextes is not a feasible direction.
Also, to avoid conflicts between gl and gles calls, we use non-prototype functions
of ANGLE for WebGL context (i.e., GraphicsContext3D). Although many combinations
of graphic configurations exist, only default configuration (Nicosia layers
running on ANGLE + GLX is supported. Other combinations like ANGLE + GLES or WPE
will be covered by following patches.

No new tests since no functionality changed.

  • Headers.cmake:
  • PlatformGTK.cmake:
  • SourcesGTK.txt:
  • platform/TextureMapper.cmake:
  • platform/graphics/ANGLEWebKitBridge.h:
  • platform/graphics/GLContext.cpp:
  • platform/graphics/GLContext.h:
  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/OpenGLShims.cpp:

(WebCore::initializeOpenGLShims):

  • platform/graphics/OpenGLShims.h:
  • platform/graphics/PlatformDisplay.cpp:
  • platform/graphics/angle/GraphicsContext3DANGLE.cpp:

(WebCore::GraphicsContext3D::reshapeFBOs):
(WebCore::GraphicsContext3D::prepareTexture):

  • platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.cpp: Added.

(Nicosia::GC3DANGLELayer::ANGLEContext::errorString):
(Nicosia::GC3DANGLELayer::ANGLEContext::lastErrorString):
(Nicosia::GC3DANGLELayer::ANGLEContext::createContext):
(Nicosia::GC3DANGLELayer::ANGLEContext::ANGLEContext):
(Nicosia::GC3DANGLELayer::ANGLEContext::~ANGLEContext):
(Nicosia::GC3DANGLELayer::ANGLEContext::makeContextCurrent):
(Nicosia::GC3DANGLELayer::ANGLEContext::platformContext):
(Nicosia::GC3DANGLELayer::GC3DANGLELayer):
(Nicosia::GC3DANGLELayer::~GC3DANGLELayer):
(Nicosia::GC3DANGLELayer::makeContextCurrent):
(Nicosia::GC3DANGLELayer::platformContext):

  • platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.h: Copied from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h.
  • platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:

(Nicosia::GC3DLayer::GC3DLayer):
(Nicosia::GC3DLayer::swapBuffersIfNeeded):

  • platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h:
  • platform/graphics/texmap/BitmapTextureGL.cpp:

(WebCore::BitmapTextureGL::setPendingContents):
(WebCore::BitmapTextureGL::updatePendingContents):

  • platform/graphics/texmap/BitmapTextureGL.h:
  • platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:

(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::~GraphicsContext3D):

  • platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:

(WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):

  • platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:

(WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer):

Source/WebKit:

  • UIProcess/API/glib/WebKitProtocolHandler.cpp: Extention3DANGLE is used instead where ANGLE for WebGL is enabled.
  • UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: Append gl extensions for ANGLE.

(WebKit::AcceleratedBackingStoreWayland::checkRequirements):

Source/WTF:

The GTK port uses TEXTURE_MAPPER that has a gl context for accelerated rendering,
and ANGLE has an egl context for WebGL. We want to make both live together
so an exception is made where TEXTURE_MAPPER is enabled.

  • wtf/Platform.h:
Location:
trunk
Files:
1 added
33 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r252682 r252717  
     12019-11-20  ChangSeok Oh  <changseok@webkit.org>
     2
     3        [GTK] Add ANGLE backend to GTK port
     4        https://bugs.webkit.org/show_bug.cgi?id=199060
     5
     6        Reviewed by Žan Doberšek.
     7
     8        This change brings ANGLE support for WebGL to GTK port. USE_ANGLE_WEBGL
     9        is newly defined in OptionGTK.cmake, and turns on the USE_ANGLE_EGL flag.
     10
     11        * Source/cmake/OptionsGTK.cmake: USE_ANGLE_WEBGL added.
     12
    1132019-11-19  Devin Rousso  <drousso@apple.com>
    214
  • trunk/Source/ThirdParty/ANGLE/CMakeLists.txt

    r251037 r252717  
    137137endif ()
    138138
     139if (USE_ANGLE_WEBGL)
     140    WEBKIT_COPY_FILES(LibGLESv2EntryPointsHeaders
     141        DESTINATION ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE
     142        FILES ${libglesv2_entry_points_headers}
     143        FLATTENED
     144    )
     145
     146    add_custom_command(
     147        OUTPUT ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE/angle.timestamp
     148        DEPENDS LibGLESv2EntryPointsHeaders ANGLEWebGLHeaders
     149        COMMAND BUILT_PRODUCTS_DIR=${ANGLE_FRAMEWORK_HEADERS_DIR}
     150            PUBLIC_HEADERS_FOLDER_PATH=ANGLE
     151            ${CMAKE_CURRENT_SOURCE_DIR}/adjust-angle-include-paths.sh
     152        VERBATIM
     153    )
     154    add_custom_target(ANGLE-webgl-headers
     155        DEPENDS ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE/angle.timestamp
     156    )
     157    add_dependencies(ANGLEFramework ANGLE-webgl-headers)
     158endif ()
     159
    139160if (COMPILER_IS_GCC_OR_CLANG)
    140161    WEBKIT_ADD_TARGET_CXX_FLAGS(ANGLE -Wno-cast-align
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r252246 r252717  
     12019-11-20  ChangSeok Oh  <changseok@webkit.org>
     2
     3        [GTK] Add ANGLE backend to GTK port
     4        https://bugs.webkit.org/show_bug.cgi?id=199060
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * CMakeLists.txt: When USE_ANGLE_WEBGL is enabled, necessary glesv2 entry points headers
     9          are installed in the derived source directory. And then adjust-angle-include-path.sh is applied
     10          to change include paths in the entry points header files.
     11        * GLESv2.cmake: libglesv2_entry_points_headers is newly defined, which is a gathering of
     12          entry point headers of libGLESv2.
     13        * PlatformGTK.cmake: In this file, we append gl and glx related angle code as a build target.
     14          Since we want gl context and gles context simultaneously, we remove gl prototype calls
     15          from the generated libGLESv2 library. Instead, we invoke egl and gl calls of ANGLE
     16          via their non-prototype function names.
     17        * adjust-angle-include-paths.sh: sed is slightly different in unix and linux systems.
     18          In particular, its inplace option needs to be changed for better compatibility on linux.
     19        * include/CMakeLists.txt: ANGLE_WEBGL_HEADERS is newly defined. It gathers header files of ANGLE
     20          for WebGL support.
     21
    1222019-11-08  Dean Jackson  <dino@apple.com>
    223
  • trunk/Source/ThirdParty/ANGLE/GLESv2.cmake

    r251037 r252717  
    11021102)
    11031103
     1104set(libglesv2_entry_points_headers
     1105    src/libGLESv2/entry_points_egl.h
     1106    src/libGLESv2/entry_points_gles_2_0_autogen.h
     1107    src/libGLESv2/entry_points_gles_3_0_autogen.h
     1108    src/libGLESv2/entry_points_gles_ext_autogen.h
     1109)
     1110
    11041111set(libglesv1_cm_sources
    11051112    src/libGLESv1_CM/libGLESv1_CM.cpp
  • trunk/Source/ThirdParty/ANGLE/PlatformGTK.cmake

    r250298 r252717  
    1414    list(APPEND ANGLE_DEFINITIONS USE_SYSTEM_EGL)
    1515endif ()
     16
     17if (USE_ANGLE_EGL)
     18    list(APPEND ANGLE_SOURCES
     19        ${angle_system_utils_sources_linux}
     20        ${angle_system_utils_sources_posix}
     21        ${libangle_gl_sources}
     22        ${libangle_gl_glx_sources}
     23    )
     24
     25    list(APPEND ANGLE_DEFINITIONS
     26        ANGLE_ENABLE_OPENGL
     27        ANGLE_USE_X11
     28    )
     29
     30    list(APPEND ANGLEGLESv2_LIBRARIES
     31        dl
     32        pthread
     33        X11
     34    )
     35
     36    string(REPLACE src/libGLESv2/libGLESv2_autogen.cpp "" libglesv2_sources "${libglesv2_sources}")
     37    string(REPLACE src/libEGL/libEGL.cpp "" libegl_sources "${libegl_sources}")
     38endif ()
     39
  • trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh

    r249823 r252717  
    2828fi
    2929
     30if [ $(uname) == "Linux" ]; then
     31    inplace_opt="-i"
     32else
     33    inplace_opt="-i ''"
     34fi
     35
    3036for i in $output_dir/*.h ; do
    3137    if [ ! -f $output_dir/angle.timestamp ] || [ $i -nt $output_dir/angle.timestamp ] ; then
     
    3844s/^#include [<"]export.h[>"]/#include <ANGLE\/export.h>/
    3945s/^#include "\(eglext_angle\|gl2ext_angle\|ShaderVars\).h"/#include <ANGLE\/\1.h>/
    40 ' -i "" $i
     46' $inplace_opt $i
    4147        echo Postprocessed ANGLE header3 $i
    4248    fi
  • trunk/Source/ThirdParty/ANGLE/include/CMakeLists.txt

    r245088 r252717  
    5050endif ()
    5151
     52if (USE_ANGLE_WEBGL)
     53    set(ANGLE_WEBGL_HEADERS
     54        export.h
     55        ${khr_headers}
     56        ${egl_headers}
     57        ${gles_headers}
     58        ${gles2_headers}
     59        ${gles3_headers}
     60    )
     61
     62    WEBKIT_COPY_FILES(ANGLEWebGLHeaders
     63        DESTINATION ${ANGLE_FRAMEWORK_HEADERS_DIR}/ANGLE
     64        FILES ${ANGLE_WEBGL_HEADERS}
     65        FLATTENED
     66    )
     67endif ()
     68
    5269# Cocoa expects headers in an ANGLE directory
    5370WEBKIT_COPY_FILES(GLSLANGHeaders
  • trunk/Source/WTF/ChangeLog

    r252687 r252717  
     12019-11-20  ChangSeok Oh  <changseok@webkit.org>
     2
     3        [GTK] Add ANGLE backend to GTK port
     4        https://bugs.webkit.org/show_bug.cgi?id=199060
     5
     6        Reviewed by Žan Doberšek.
     7
     8        The GTK port uses TEXTURE_MAPPER that has a gl context for accelerated rendering,
     9        and ANGLE has an egl context for WebGL. We want to make both live together
     10        so an exception is made where TEXTURE_MAPPER is enabled.
     11
     12        * wtf/Platform.h:
     13
    1142019-11-20  Fujii Hironori  <Hironori.Fujii@sony.com>
    215
  • trunk/Source/WTF/wtf/Platform.h

    r252595 r252717  
    11471147#endif
    11481148
    1149 #if (USE_ANGLE && (USE_OPENGL || USE_OPENGL_ES || (defined(USE_EGL) && USE_EGL)))
     1149#if (USE_ANGLE && (USE_OPENGL || USE_OPENGL_ES || (defined(USE_EGL) && USE_EGL))) && !USE(TEXTURE_MAPPER)
    11501150#error USE_ANGLE is incompatible with USE_OPENGL, USE_OPENGL_ES and USE_EGL
    11511151#endif
  • trunk/Source/WebCore/ChangeLog

    r252716 r252717  
     12019-11-20  ChangSeok Oh  <changseok@webkit.org>
     2
     3        [GTK] Add ANGLE backend to GTK port
     4        https://bugs.webkit.org/show_bug.cgi?id=199060
     5
     6        Reviewed by Žan Doberšek.
     7
     8        This change aims to bring ANGLE support for WebGL to GTK port. The port
     9        wants to have a gl context for texture mapper and a gles/egl context for webgl
     10        simultaneously, we adopt the readPixel-copyToTexture approach for now because
     11        sharing textures between the two different contextes is not a feasible direction.
     12        Also, to avoid conflicts between gl and gles calls, we use non-prototype functions
     13        of ANGLE for WebGL context (i.e., GraphicsContext3D). Although many combinations
     14        of graphic configurations exist, only default configuration (Nicosia layers
     15        running on ANGLE + GLX is supported. Other combinations like ANGLE + GLES or WPE
     16        will be covered by following patches.
     17
     18        No new tests since no functionality changed.
     19
     20        * Headers.cmake:
     21        * PlatformGTK.cmake:
     22        * SourcesGTK.txt:
     23        * platform/TextureMapper.cmake:
     24        * platform/graphics/ANGLEWebKitBridge.h:
     25        * platform/graphics/GLContext.cpp:
     26        * platform/graphics/GLContext.h:
     27        * platform/graphics/GraphicsContext3D.h:
     28        * platform/graphics/OpenGLShims.cpp:
     29        (WebCore::initializeOpenGLShims):
     30        * platform/graphics/OpenGLShims.h:
     31        * platform/graphics/PlatformDisplay.cpp:
     32        * platform/graphics/angle/GraphicsContext3DANGLE.cpp:
     33        (WebCore::GraphicsContext3D::reshapeFBOs):
     34        (WebCore::GraphicsContext3D::prepareTexture):
     35        * platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.cpp: Added.
     36        (Nicosia::GC3DANGLELayer::ANGLEContext::errorString):
     37        (Nicosia::GC3DANGLELayer::ANGLEContext::lastErrorString):
     38        (Nicosia::GC3DANGLELayer::ANGLEContext::createContext):
     39        (Nicosia::GC3DANGLELayer::ANGLEContext::ANGLEContext):
     40        (Nicosia::GC3DANGLELayer::ANGLEContext::~ANGLEContext):
     41        (Nicosia::GC3DANGLELayer::ANGLEContext::makeContextCurrent):
     42        (Nicosia::GC3DANGLELayer::ANGLEContext::platformContext):
     43        (Nicosia::GC3DANGLELayer::GC3DANGLELayer):
     44        (Nicosia::GC3DANGLELayer::~GC3DANGLELayer):
     45        (Nicosia::GC3DANGLELayer::makeContextCurrent):
     46        (Nicosia::GC3DANGLELayer::platformContext):
     47        * platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.h: Copied from Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h.
     48        * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
     49        (Nicosia::GC3DLayer::GC3DLayer):
     50        (Nicosia::GC3DLayer::swapBuffersIfNeeded):
     51        * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h:
     52        * platform/graphics/texmap/BitmapTextureGL.cpp:
     53        (WebCore::BitmapTextureGL::setPendingContents):
     54        (WebCore::BitmapTextureGL::updatePendingContents):
     55        * platform/graphics/texmap/BitmapTextureGL.h:
     56        * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
     57        (WebCore::GraphicsContext3D::create):
     58        (WebCore::GraphicsContext3D::GraphicsContext3D):
     59        (WebCore::GraphicsContext3D::~GraphicsContext3D):
     60        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
     61        (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
     62        * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
     63        (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer):
     64
    1652019-11-20  Zalan Bujtas  <zalan@apple.com>
    266
  • trunk/Source/WebCore/Headers.cmake

    r252393 r252717  
    11221122    platform/graphics/WindRule.h
    11231123
     1124    platform/graphics/angle/Extensions3DANGLE.h
     1125
    11241126    platform/graphics/cv/ImageTransferSessionVT.h
    11251127
  • trunk/Source/WebCore/PlatformGTK.cmake

    r251650 r252717  
    3636    "${WEBCORE_DIR}/platform/text/gtk"
    3737)
     38
     39if (USE_ANGLE_WEBGL)
     40    list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
     41        "${WEBCORE_DIR}/platform/graphics/angle"
     42    )
     43endif ()
    3844
    3945if (USE_WPE_RENDERER)
     
    118124endif ()
    119125
    120 if (USE_OPENGL_ES)
     126if (USE_OPENGL)
    121127    list(APPEND WebCore_SOURCES
    122         platform/graphics/opengl/Extensions3DOpenGLES.cpp
    123         platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
     128        platform/graphics/OpenGLShims.cpp
    124129    )
    125130endif ()
    126131
    127 if (USE_OPENGL)
     132if (USE_ANGLE_WEBGL)
    128133    list(APPEND WebCore_SOURCES
    129         platform/graphics/OpenGLShims.cpp
     134        platform/graphics/angle/Extensions3DANGLE.cpp
     135        platform/graphics/angle/GraphicsContext3DANGLE.cpp
     136        platform/graphics/angle/TemporaryANGLESetting.cpp
     137    )
     138else ()
     139    list(APPEND WebCore_SOURCES
     140        platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
     141        platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
     142        platform/graphics/opengl/TemporaryOpenGLSetting.cpp
     143    )
    130144
    131         platform/graphics/opengl/Extensions3DOpenGL.cpp
    132         platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
    133     )
     145    if (USE_OPENGL_ES)
     146        list(APPEND WebCore_SOURCES
     147            platform/graphics/opengl/Extensions3DOpenGLES.cpp
     148            platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp
     149        )
     150    endif ()
     151
     152    if (USE_OPENGL)
     153        list(APPEND WebCore_SOURCES
     154            platform/graphics/opengl/Extensions3DOpenGL.cpp
     155            platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
     156        )
     157    endif ()
    134158endif ()
    135159
  • trunk/Source/WebCore/SourcesGTK.txt

    r250596 r252717  
    9393platform/graphics/libwpe/PlatformDisplayLibWPE.cpp
    9494
    95 platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
    96 platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
    97 platform/graphics/opengl/TemporaryOpenGLSetting.cpp
    98 
    9995platform/graphics/opentype/OpenTypeVerticalData.cpp
    10096
  • trunk/Source/WebCore/platform/TextureMapper.cmake

    r248769 r252717  
    116116    )
    117117endif ()
     118
     119if (USE_ANGLE_WEBGL)
     120    list(APPEND WebCore_SOURCES
     121        platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.cpp
     122    )
     123endif ()
  • trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h

    r247841 r252717  
    3737#include <wtf/text/WTFString.h>
    3838
    39 #if PLATFORM(COCOA)
     39#if USE(ANGLE)
     40#include <ANGLE/gl2.h>
    4041
     42#elif PLATFORM(COCOA)
    4143#if USE(OPENGL_ES)
    4244#import <OpenGLES/ES2/glext.h>
    4345#elif USE(OPENGL)
    4446#include <OpenGL/gl.h>
    45 #elif USE(ANGLE)
    46 #include <ANGLE/gl2.h>
    4747#else
    4848#error Unsupported configuration
  • trunk/Source/WebCore/platform/graphics/GLContext.cpp

    r249909 r252717  
    2525#if USE(EGL)
    2626#include "GLContextEGL.h"
    27 #endif
    28 
    29 #if USE(LIBEPOXY)
    30 #include <epoxy/gl.h>
    31 #elif USE(OPENGL_ES)
    32 #include <GLES2/gl2.h>
    3327#endif
    3428
  • trunk/Source/WebCore/platform/graphics/GLContext.h

    r249909 r252717  
    2121#define GLContext_h
    2222
    23 #include "ANGLEWebKitBridge.h"
    2423#include "IntSize.h"
    2524#include "PlatformDisplay.h"
    2625#include <wtf/Noncopyable.h>
     26
     27#if USE(LIBEPOXY)
     28#include <epoxy/gl.h>
     29#elif USE(OPENGL_ES)
     30#include <GLES2/gl2.h>
     31#endif
    2732
    2833#if USE(EGL) && !PLATFORM(GTK)
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r252245 r252717  
    102102namespace WebCore {
    103103class Extensions3D;
    104 #if !PLATFORM(COCOA) && USE(OPENGL_ES)
     104#if USE(ANGLE)
     105class Extensions3DANGLE;
     106#elif !PLATFORM(COCOA) && USE(OPENGL_ES)
    105107class Extensions3DOpenGLES;
    106108#elif USE(OPENGL) || (PLATFORM(COCOA) && USE(OPENGL_ES))
    107109class Extensions3DOpenGL;
    108 #elif USE(ANGLE)
    109 class Extensions3DANGLE;
    110110#endif
    111111class HostWindow;
     
    14571457#endif // !USE(ANGLE)
    14581458
    1459 #if !PLATFORM(COCOA) && USE(OPENGL_ES)
     1459#if USE(ANGLE)
     1460    friend class Extensions3DANGLE;
     1461    std::unique_ptr<Extensions3DANGLE> m_extensions;
     1462#elif !PLATFORM(COCOA) && USE(OPENGL_ES)
    14601463    friend class Extensions3DOpenGLES;
    14611464    friend class Extensions3DOpenGLCommon;
     
    14651468    friend class Extensions3DOpenGLCommon;
    14661469    std::unique_ptr<Extensions3DOpenGL> m_extensions;
    1467 #elif USE(ANGLE)
    1468     friend class Extensions3DANGLE;
    1469     std::unique_ptr<Extensions3DANGLE> m_extensions;
    14701470#endif
    14711471
     
    14931493    GC3Duint m_internalColorFormat { 0 };
    14941494
    1495 #if USE(ANGLE)
     1495#if USE(ANGLE) && PLATFORM(COCOA)
    14961496    PlatformGraphicsContext3DSurface m_pbuffer;
    14971497#endif
  • trunk/Source/WebCore/platform/graphics/OpenGLShims.cpp

    r208997 r252717  
    163163    ASSIGN_FUNCTION_TABLE_ENTRY(glGetShaderiv, success);
    164164    ASSIGN_FUNCTION_TABLE_ENTRY(glGetShaderSource, success);
     165    ASSIGN_FUNCTION_TABLE_ENTRY(glGetString, success);
    165166    // glGetStringi is only available on OpenGL or GLES versions >= 3.0.
    166167    // Add it with _EXT so it doesn't cause an initialization failure on lower versions.
  • trunk/Source/WebCore/platform/graphics/OpenGLShims.h

    r247841 r252717  
    9999typedef void (GLAPIENTRY *glGetShaderivType) (GLuint, GLenum, GLint*);
    100100typedef void (GLAPIENTRY *glGetShaderSourceType) (GLuint, GLsizei, GLsizei*, char*);
     101typedef const GLubyte* (GLAPIENTRY *glGetStringType) (GLenum);
    101102typedef const GLubyte* (GLAPIENTRY *glGetStringiType) (GLenum, GLuint);
    102103typedef GLint (GLAPIENTRY *glGetUniformLocationType) (GLuint, const char*);
     
    206207    FUNCTION_TABLE_ENTRY(glGetShaderiv);
    207208    FUNCTION_TABLE_ENTRY(glGetShaderSource);
     209    FUNCTION_TABLE_ENTRY(glGetString);
    208210    FUNCTION_TABLE_ENTRY(glGetStringi);
    209211    FUNCTION_TABLE_ENTRY(glGetUniformfv);
     
    334336#define glGetShaderiv                          LOOKUP_GL_FUNCTION(glGetShaderiv)
    335337#define glGetShaderSource                      LOOKUP_GL_FUNCTION(glGetShaderSource)
     338#define glGetString                            LOOKUP_GL_FUNCTION(glGetString)
    336339#define glGetStringi                           LOOKUP_GL_FUNCTION(glGetStringi)
    337340#define glGetUniformfv                         LOOKUP_GL_FUNCTION(glGetUniformfv)
  • trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp

    r251122 r252717  
    5353#if PLATFORM(GTK) && PLATFORM(X11)
    5454#include <gdk/gdkx.h>
     55#if defined(None)
     56#undef None
     57#endif
    5558#endif
    5659
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp

    r252245 r252717  
    6969// would need more work to be included from WebCore.
    7070#define GL_MAX_SAMPLES_EXT 0x8D57
     71
     72#if USE(COORDINATED_GRAPHICS) && USE(TEXTURE_MAPPER)
     73#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
     74#define GL_FRAMEBUFFER_EXT 0x8D40
     75#endif
    7176
    7277namespace WebCore {
     
    192197    updateFramebufferTextureBackingStoreFromLayer();
    193198    gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ANGLE, m_texture, 0);
     199#elif PLATFORM(GTK)
     200    gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_texture);
     201    gl::TexImage2D(GL_TEXTURE_RECTANGLE_ANGLE, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
     202    gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ANGLE, m_texture, 0);
     203    if (m_compositorTexture) {
     204        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_compositorTexture);
     205        gl::TexImage2D(GL_TEXTURE_RECTANGLE_ANGLE, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
     206        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, 0);
     207        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_intermediateTexture);
     208        gl::TexImage2D(GL_TEXTURE_RECTANGLE_ANGLE, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
     209        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, 0);
     210    }
    194211#else
    195212#error FIXME: Port to non-Cocoa platforms.
     
    477494        resolveMultisamplingIfNecessary();
    478495
     496#if USE(COORDINATED_GRAPHICS)
     497    std::swap(m_texture, m_compositorTexture);
     498    std::swap(m_texture, m_intermediateTexture);
     499    gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     500    gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ANGLE, m_texture, 0);
    479501    gl::Flush();
     502
     503    if (m_state.boundFBO != m_fbo)
     504        gl::BindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
     505    else
     506        gl::BindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
     507#else
     508    gl::Flush();
     509#endif
    480510}
    481511
  • trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DANGLELayer.h

    r252716 r252717  
    11/*
    22 * Copyright (C) 2018 Metrological Group B.V.
    3  * Copyright (C) 2018 Igalia S.L.
     3 * Copyright (C) 2018, 2019 Igalia S.L.
    44 *
    55 * Redistribution and use in source and binary forms, with or without
     
    3131#if USE(NICOSIA) && USE(TEXTURE_MAPPER)
    3232
     33#include "GLContext.h"
    3334#include "GraphicsContext3D.h"
    34 #include "NicosiaContentLayerTextureMapperImpl.h"
     35#include "NicosiaGC3DLayer.h"
    3536#include <memory>
    3637
     38typedef void *EGLConfig;
     39typedef void *EGLContext;
     40typedef void *EGLDisplay;
     41typedef void *EGLSurface;
     42
    3743namespace WebCore {
     44class IntSize;
    3845class GLContext;
     46class PlatformDisplay;
    3947}
    4048
    4149namespace Nicosia {
    4250
    43 class GC3DLayer : public ContentLayerTextureMapperImpl::Client {
     51class GC3DANGLELayer final : public GC3DLayer {
    4452    WTF_MAKE_FAST_ALLOCATED;
    4553public:
    46     GC3DLayer(WebCore::GraphicsContext3D&, WebCore::GraphicsContext3D::RenderStyle);
    47     virtual ~GC3DLayer();
     54    class ANGLEContext {
     55        WTF_MAKE_NONCOPYABLE(ANGLEContext);
     56    public:
     57        static const char* errorString(int statusCode);
     58        static const char* lastErrorString();
    4859
    49     ContentLayer& contentLayer() const { return m_contentLayer; }
    50     bool makeContextCurrent();
    51     PlatformGraphicsContext3D platformContext();
     60        static std::unique_ptr<ANGLEContext> createContext();
     61        virtual ~ANGLEContext();
    5262
    53     void swapBuffersIfNeeded() override;
     63        bool makeContextCurrent();
     64#if ENABLE(GRAPHICS_CONTEXT_3D)
     65        PlatformGraphicsContext3D platformContext();
     66#endif
     67
     68    private:
     69        ANGLEContext(EGLDisplay, EGLContext, EGLSurface);
     70
     71        EGLDisplay m_display { nullptr };
     72        EGLContext m_context { nullptr };
     73        EGLSurface m_surface { nullptr };
     74    };
     75
     76    GC3DANGLELayer(WebCore::GraphicsContext3D&, WebCore::GraphicsContext3D::RenderStyle);
     77    virtual ~GC3DANGLELayer();
     78
     79    bool makeContextCurrent() override;
     80    PlatformGraphicsContext3D platformContext() override;
    5481
    5582private:
    56     WebCore::GraphicsContext3D& m_context;
    57     std::unique_ptr<WebCore::GLContext> m_glContext;
    58 
    59     Ref<ContentLayer> m_contentLayer;
     83    std::unique_ptr<ANGLEContext> m_angleContext;
    6084};
    6185
  • trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp

    r248846 r252717  
    3838#endif
    3939
     40#if USE(ANGLE)
     41#include "ImageBuffer.h"
     42#endif
     43
    4044#include "GLContext.h"
    4145
     
    4347
    4448using namespace WebCore;
     49
     50GC3DLayer::GC3DLayer(GraphicsContext3D& context)
     51    : m_context(context)
     52    , m_contentLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
     53{
     54}
    4555
    4656GC3DLayer::GC3DLayer(GraphicsContext3D& context, GraphicsContext3D::RenderStyle renderStyle)
     
    8393    m_context.prepareTexture();
    8494    IntSize textureSize(m_context.m_currentWidth, m_context.m_currentHeight);
    85     TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context.m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0);
     95    TextureMapperGL::Flags flags = m_context.m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0;
     96#if USE(ANGLE)
     97    std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(textureSize, Unaccelerated);
     98    if (!imageBuffer)
     99        return;
     100
     101    m_context.paintRenderingResultsToCanvas(imageBuffer.get());
     102    RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
     103    if (!image)
     104        return;
     105#else
     106    flags |= TextureMapperGL::ShouldFlipTexture;
     107#endif
    86108
    87109    {
    88110        auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_contentLayer->impl()).proxy();
     111#if USE(ANGLE)
     112        std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer;
     113        layerBuffer = proxy.getAvailableBuffer(textureSize, m_context.m_internalColorFormat);
     114        if (!layerBuffer) {
     115            auto texture = BitmapTextureGL::create(TextureMapperContextAttributes::get(), m_context.m_internalColorFormat);
     116            static_cast<BitmapTextureGL&>(texture.get()).setPendingContents(WTFMove(image));
     117            layerBuffer = makeUnique<TextureMapperPlatformLayerBuffer>(WTFMove(texture), flags);
     118        } else
     119            layerBuffer->textureGL().setPendingContents(WTFMove(image));
    89120
    90121        LockHolder holder(proxy.lock());
     122        proxy.pushNextBuffer(WTFMove(layerBuffer));
     123#else
     124        LockHolder holder(proxy.lock());
    91125        proxy.pushNextBuffer(makeUnique<TextureMapperPlatformLayerBuffer>(m_context.m_compositorTexture, textureSize, flags, m_context.m_internalColorFormat));
     126#endif
    92127    }
    93128
  • trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaGC3DLayer.h

    r248762 r252717  
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
     46    explicit GC3DLayer(WebCore::GraphicsContext3D&);
    4647    GC3DLayer(WebCore::GraphicsContext3D&, WebCore::GraphicsContext3D::RenderStyle);
     48
    4749    virtual ~GC3DLayer();
    4850
    4951    ContentLayer& contentLayer() const { return m_contentLayer; }
    50     bool makeContextCurrent();
    51     PlatformGraphicsContext3D platformContext();
     52    virtual bool makeContextCurrent();
     53    virtual PlatformGraphicsContext3D platformContext();
    5254
    5355    void swapBuffersIfNeeded() override;
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp

    r249110 r252717  
    2727#include "Extensions3D.h"
    2828#include "FilterOperations.h"
    29 #include "Image.h"
    3029#include "LengthFunctions.h"
    3130#include "NativeImage.h"
     
    169168    updateContents(imageData, targetRect, offset, bytesPerLine);
    170169}
     170
     171#if USE(ANGLE)
     172void BitmapTextureGL::setPendingContents(RefPtr<Image>&& image)
     173{
     174    m_pendingContents = image;
     175}
     176
     177void BitmapTextureGL::updatePendingContents(const IntRect& targetRect, const IntPoint& offset)
     178{
     179    if (!m_pendingContents)
     180        return;
     181
     182    if (!isValid()) {
     183        IntSize textureSize(m_pendingContents->size());
     184        reset(textureSize);
     185    }
     186    updateContents(m_pendingContents.get(), targetRect, offset);
     187}
     188#endif
    171189
    172190static unsigned getPassesRequiredForFilter(FilterOperation::OperationType type)
  • trunk/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h

    r229895 r252717  
    2727#include "ClipStack.h"
    2828#include "FilterOperation.h"
     29#include "Image.h"
    2930#include "IntSize.h"
    3031#include "TextureMapperContextAttributes.h"
     
    7879
    7980    void copyFromExternalTexture(GLuint textureID);
     81#if USE(ANGLE)
     82    void setPendingContents(RefPtr<Image>&&);
     83    void updatePendingContents(const IntRect& targetRect, const IntPoint& offset);
     84#endif
    8085
    8186    TextureMapperGL::Flags colorConvertFlags() const { return m_colorConvertFlags; }
     
    9499    TextureMapperContextAttributes m_contextAttributes;
    95100    TextureMapperGL::Flags m_colorConvertFlags { TextureMapperGL::NoFlag };
     101
     102#if USE(ANGLE)
     103    RefPtr<Image> m_pendingContents { nullptr };
     104#endif
    96105
    97106    void clearIfNeeded();
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp

    r248846 r252717  
    3838#include <ANGLE/ShaderLang.h>
    3939
    40 #if USE(LIBEPOXY)
     40#if USE(ANGLE)
     41#define EGL_EGL_PROTOTYPES 0
     42// Skip the inclusion of ANGLE's explicit context entry points for now.
     43#define GL_ANGLE_explicit_context
     44#define GL_ANGLE_explicit_context_gles1
     45typedef void* GLeglContext;
     46#include <ANGLE/egl.h>
     47#include <ANGLE/eglext.h>
     48#include <ANGLE/eglext_angle.h>
     49#include <ANGLE/entry_points_egl.h>
     50#include <ANGLE/entry_points_gles_2_0_autogen.h>
     51#include <ANGLE/entry_points_gles_ext_autogen.h>
     52#include <ANGLE/gl2ext.h>
     53#include <ANGLE/gl2ext_angle.h>
     54#if defined(Above)
     55#undef Above
     56#endif
     57#if defined(Below)
     58#undef Below
     59#endif
     60#if defined(None)
     61#undef None
     62#endif
     63#elif USE(LIBEPOXY)
    4164#include <epoxy/gl.h>
    4265#elif !USE(OPENGL_ES)
     
    4467#endif
    4568
    46 #if USE(OPENGL_ES)
     69#if USE(ANGLE)
     70#include "Extensions3DANGLE.h"
     71#elif USE(OPENGL_ES)
    4772#include "Extensions3DOpenGLES.h"
    4873#else
     
    5176
    5277#if USE(NICOSIA)
     78#if USE(ANGLE)
     79#include "NicosiaGC3DANGLELayer.h"
     80#else
    5381#include "NicosiaGC3DLayer.h"
     82#endif
    5483#endif
    5584
     
    72101    static bool success = true;
    73102    if (!initialized) {
    74 #if !USE(OPENGL_ES) && !USE(LIBEPOXY)
     103#if !USE(OPENGL_ES) && !USE(LIBEPOXY) && !USE(ANGLE)
    75104        success = initializeOpenGLShims();
    76105#endif
     
    102131}
    103132
     133#if USE(ANGLE)
     134GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle, GraphicsContext3D* sharedContext)
     135    : m_attrs(attributes)
     136{
     137    ASSERT_UNUSED(sharedContext, !sharedContext);
     138#if USE(NICOSIA)
     139    m_nicosiaLayer = WTF::makeUnique<Nicosia::GC3DANGLELayer>(*this, renderStyle);
     140#else
     141    m_texmapLayer = WTF::makeUnique<TextureMapperGC3DPlatformLayer>(*this, renderStyle);
     142#endif
     143    makeContextCurrent();
     144
     145
     146    validateAttributes();
     147
     148    if (renderStyle == RenderOffscreen) {
     149        // Create a texture to render into.
     150        gl::GenTextures(1, &m_texture);
     151        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_texture);
     152        gl::TexParameterf(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     153        gl::TexParameterf(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     154        gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     155        gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     156        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, 0);
     157
     158        // Create an FBO.
     159        gl::GenFramebuffers(1, &m_fbo);
     160        gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     161
     162#if USE(COORDINATED_GRAPHICS)
     163        gl::GenTextures(1, &m_compositorTexture);
     164        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_compositorTexture);
     165        gl::TexParameterf(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     166        gl::TexParameterf(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     167        gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     168        gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     169
     170        gl::GenTextures(1, &m_intermediateTexture);
     171        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_intermediateTexture);
     172        gl::TexParameterf(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     173        gl::TexParameterf(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     174        gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     175        gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     176
     177        gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, 0);
     178#endif
     179
     180        // Create a multisample FBO.
     181        if (m_attrs.antialias) {
     182            gl::GenFramebuffers(1, &m_multisampleFBO);
     183            gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
     184            m_state.boundFBO = m_multisampleFBO;
     185            gl::GenRenderbuffers(1, &m_multisampleColorBuffer);
     186            if (m_attrs.stencil || m_attrs.depth)
     187                gl::GenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     188        } else {
     189            // Bind canvas FBO.
     190            gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     191            m_state.boundFBO = m_fbo;
     192#if USE(OPENGL_ES)
     193            if (m_attrs.depth)
     194                gl::GenRenderbuffers(1, &m_depthBuffer);
     195            if (m_attrs.stencil)
     196                gl::GenRenderbuffers(1, &m_stencilBuffer);
     197#endif
     198            if (m_attrs.stencil || m_attrs.depth)
     199                gl::GenRenderbuffers(1, &m_depthStencilBuffer);
     200        }
     201    }
     202
     203    gl::ClearColor(0, 0, 0, 0);
     204}
     205#else
    104206GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle, GraphicsContext3D* sharedContext)
    105207    : m_attrs(attributes)
     
    226328    ::glClearColor(0, 0, 0, 0);
    227329}
    228 
     330#endif
     331
     332#if USE(ANGLE)
     333GraphicsContext3D::~GraphicsContext3D()
     334{
     335    makeContextCurrent();
     336    if (m_texture)
     337        gl::DeleteTextures(1, &m_texture);
     338#if USE(COORDINATED_GRAPHICS)
     339    if (m_compositorTexture)
     340        gl::DeleteTextures(1, &m_compositorTexture);
     341#endif
     342
     343    if (m_attrs.antialias) {
     344        gl::DeleteRenderbuffers(1, &m_multisampleColorBuffer);
     345        if (m_attrs.stencil || m_attrs.depth)
     346            gl::DeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     347        gl::DeleteFramebuffers(1, &m_multisampleFBO);
     348    } else if (m_attrs.stencil || m_attrs.depth) {
     349#if USE(OPENGL_ES)
     350        if (m_depthBuffer)
     351            glDeleteRenderbuffers(1, &m_depthBuffer);
     352
     353        if (m_stencilBuffer)
     354            glDeleteRenderbuffers(1, &m_stencilBuffer);
     355#endif
     356        if (m_depthStencilBuffer)
     357            gl::DeleteRenderbuffers(1, &m_depthStencilBuffer);
     358    }
     359    gl::DeleteFramebuffers(1, &m_fbo);
     360#if USE(COORDINATED_GRAPHICS)
     361    gl::DeleteTextures(1, &m_intermediateTexture);
     362#endif
     363
     364#if USE(CAIRO)
     365    if (m_vao)
     366        deleteVertexArray(m_vao);
     367#endif
     368
     369    auto* activeContext = activeContexts().takeLast([this](auto* it) {
     370        return it == this;
     371    });
     372    ASSERT_UNUSED(activeContext, !!activeContext);
     373}
     374#else
    229375GraphicsContext3D::~GraphicsContext3D()
    230376{
     
    263409#endif
    264410
    265     auto* activeContext = activeContexts().takeLast([this](auto* it) { return it == this; });
     411    auto* activeContext = activeContexts().takeLast([this](auto* it) {
     412        return it == this;
     413    });
    266414    ASSERT_UNUSED(activeContext, !!activeContext);
    267415}
     416#endif // USE(ANGLE)
    268417
    269418void GraphicsContext3D::setContextLostCallback(std::unique_ptr<ContextLostCallback>)
     
    320469}
    321470
    322 #if PLATFORM(GTK)
     471#if PLATFORM(GTK) && !USE(ANGLE)
    323472Extensions3D& GraphicsContext3D::getExtensions()
    324473{
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp

    r249474 r252717  
    9898        ASSERT(m_texture);
    9999        BitmapTextureGL* textureGL = static_cast<BitmapTextureGL*>(m_texture.get());
     100#if USE(ANGLE)
     101        textureGL->updatePendingContents(IntRect(IntPoint(), textureGL->contentSize()), IntPoint());
     102#endif
    100103        texmapGL.drawTexture(textureGL->id(), m_extraFlags | textureGL->colorConvertFlags(), textureGL->size(), targetRect, modelViewMatrix, opacity);
    101104        return;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp

    r248846 r252717  
    114114{
    115115    ASSERT(m_lock.isHeld());
     116#if USE(ANGLE)
     117    // When the newBuffer overwrites m_pendingBuffer that is not swapped yet,
     118    // the layer related to m_pendingBuffer is flickering since its texture is destroyed.
     119    if (m_pendingBuffer && m_pendingBuffer->hasManagedTexture())
     120        return;
     121#endif
    116122    m_pendingBuffer = WTFMove(newBuffer);
    117123    m_wasBufferDropped = false;
  • trunk/Source/WebKit/ChangeLog

    r252712 r252717  
     12019-11-20  ChangSeok Oh  <changseok@webkit.org>
     2
     3        [GTK] Add ANGLE backend to GTK port
     4        https://bugs.webkit.org/show_bug.cgi?id=199060
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * UIProcess/API/glib/WebKitProtocolHandler.cpp: Extention3DANGLE is used instead
     9          where ANGLE for WebGL is enabled.
     10        * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: Append gl extensions for ANGLE.
     11        (WebKit::AcceleratedBackingStoreWayland::checkRequirements):
     12
    1132019-11-20  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp

    r250898 r252717  
    6565#if USE(GLX)
    6666#include <GL/glx.h>
     67#include <WebCore/OpenGLShims.h>
    6768#endif
    6869
  • trunk/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp

    r249947 r252717  
    3939#include <WebCore/GLContext.h>
    4040
    41 #if USE(OPENGL_ES)
     41#if USE(ANGLE)
     42#include <WebCore/Extensions3DANGLE.h>
     43#include <WebCore/OpenGLShims.h>
     44#elif USE(OPENGL_ES)
    4245#include <GLES2/gl2.h>
    4346#include <GLES2/gl2ext.h>
     
    7982            return false;
    8083
    81 #if USE(OPENGL_ES)
     84#if USE(ANGLE)
     85        std::unique_ptr<Extensions3DANGLE> glExtensions = makeUnique<Extensions3DANGLE>(nullptr, GLContext::current()->version() >= 320);
     86#elif USE(OPENGL_ES)
    8287        std::unique_ptr<Extensions3DOpenGLES> glExtensions = makeUnique<Extensions3DOpenGLES>(nullptr,  false);
    8388#else
  • trunk/Source/cmake/OptionsGTK.cmake

    r252366 r252717  
    9191# Private options specific to the GTK port. Changing these options is
    9292# completely unsupported. They are intended for use only by WebKit developers.
     93WEBKIT_OPTION_DEFINE(USE_ANGLE_WEBGL "Whether to use ANGLE as WebGL backend." PRIVATE OFF)
    9394WEBKIT_OPTION_DEFINE(USE_OPENVR "Whether to use OpenVR as WebVR backend." PRIVATE OFF)
    9495
     
    101102WEBKIT_OPTION_DEPEND(ENABLE_GLES2 ENABLE_OPENGL)
    102103WEBKIT_OPTION_DEPEND(ENABLE_WEBGL ENABLE_OPENGL)
     104WEBKIT_OPTION_DEPEND(USE_ANGLE_WEBGL ENABLE_WEBGL)
    103105WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_OPENGL)
    104106WEBKIT_OPTION_DEPEND(USE_WPE_RENDERER ENABLE_WAYLAND_TARGET)
     
    307309endif ()
    308310
     311if (USE_ANGLE_WEBGL)
     312    SET_AND_EXPOSE_TO_BUILD(USE_ANGLE TRUE)
     313    SET_AND_EXPOSE_TO_BUILD(USE_ANGLE_EGL TRUE)
     314endif ()
     315
    309316if (ENABLE_SPELLCHECK)
    310317    find_package(Enchant)
Note: See TracChangeset for help on using the changeset viewer.