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

Changeset 249218 in webkit


Ignore:
Timestamp:
Aug 28, 2019, 1:34:19 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Create ANGLE EGL Context with all extensions disabled by default
https://bugs.webkit.org/show_bug.cgi?id=200900

Patch by Austin Eng <enga@chromium.org> on 2019-08-28
Reviewed by Alex Christensen.

In WebGL, extensions must be explicitly requested before they are enabled.
Fixes the following WebGL conformance tests with the ANGLE backend
LayoutTests/webgl/*/conformance/extensions/ext-blend-minmax.html
LayoutTests/webgl/*/conformance/extensions/ext-frag-depth.html
LayoutTests/webgl/*/conformance/extensions/ext-shader-texture-lod.html
LayoutTests/webgl/*/conformance/extensions/ext-sRGB.html
LayoutTests/webgl/*/conformance/extensions/oes-standard-derivatives.html
LayoutTests/webgl/*/conformance/extensions/oes-texture-float.html
LayoutTests/webgl/*/conformance/extensions/webgl-compressed-texture-s3tc.html
LayoutTests/webgl/*/conformance/glsl/misc/shader-with-dfdx.frag.html
LayoutTests/webgl/*/conformance/glsl/variables/glsl-built-ins.html
LayoutTests/webgl/*/conformance/textures/misc/texture-npot-video.html
LayoutTests/webgl/*/conformance/textures/misc/texture-npot.html

  • html/canvas/ANGLEInstancedArrays.cpp:

(WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays):
(WebCore::ANGLEInstancedArrays::supported):

  • html/canvas/WebGLCompressedTextureASTC.cpp:

(WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC):

  • html/canvas/WebGLCompressedTextureATC.cpp:

(WebCore::WebGLCompressedTextureATC::WebGLCompressedTextureATC):

  • html/canvas/WebGLCompressedTexturePVRTC.cpp:

(WebCore::WebGLCompressedTexturePVRTC::WebGLCompressedTexturePVRTC):

  • html/canvas/WebGLCompressedTextureS3TC.cpp:

(WebCore::WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC):
(WebCore::WebGLCompressedTextureS3TC::supported):

  • html/canvas/WebGLDebugShaders.cpp:

(WebCore::WebGLDebugShaders::WebGLDebugShaders):

  • html/canvas/WebGLDepthTexture.cpp:

(WebCore::WebGLDepthTexture::WebGLDepthTexture):

  • html/canvas/WebGLDrawBuffers.cpp:

(WebCore::WebGLDrawBuffers::WebGLDrawBuffers):
(WebCore::WebGLDrawBuffers::supported):

  • platform/graphics/angle/GraphicsContext3DANGLE.cpp:

(WebCore::GraphicsContext3D::reshapeFBOs):
(WebCore::GraphicsContext3D::validateDepthStencil):

  • platform/graphics/cocoa/GraphicsContext3DCocoa.mm:

(WebCore::GraphicsContext3D::GraphicsContext3D):

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249217 r249218  
     12019-08-28  Austin Eng  <enga@chromium.org>
     2
     3        Create ANGLE EGL Context with all extensions disabled by default
     4        https://bugs.webkit.org/show_bug.cgi?id=200900
     5
     6        Reviewed by Alex Christensen.
     7
     8        In WebGL, extensions must be explicitly requested before they are enabled.
     9        Fixes the following WebGL conformance tests with the ANGLE backend
     10        LayoutTests/webgl/*/conformance/extensions/ext-blend-minmax.html
     11        LayoutTests/webgl/*/conformance/extensions/ext-frag-depth.html
     12        LayoutTests/webgl/*/conformance/extensions/ext-shader-texture-lod.html
     13        LayoutTests/webgl/*/conformance/extensions/ext-sRGB.html
     14        LayoutTests/webgl/*/conformance/extensions/oes-standard-derivatives.html
     15        LayoutTests/webgl/*/conformance/extensions/oes-texture-float.html
     16        LayoutTests/webgl/*/conformance/extensions/webgl-compressed-texture-s3tc.html
     17        LayoutTests/webgl/*/conformance/glsl/misc/shader-with-dfdx.frag.html
     18        LayoutTests/webgl/*/conformance/glsl/variables/glsl-built-ins.html
     19        LayoutTests/webgl/*/conformance/textures/misc/texture-npot-video.html
     20        LayoutTests/webgl/*/conformance/textures/misc/texture-npot.html
     21
     22        * html/canvas/ANGLEInstancedArrays.cpp:
     23        (WebCore::ANGLEInstancedArrays::ANGLEInstancedArrays):
     24        (WebCore::ANGLEInstancedArrays::supported):
     25        * html/canvas/WebGLCompressedTextureASTC.cpp:
     26        (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC):
     27        * html/canvas/WebGLCompressedTextureATC.cpp:
     28        (WebCore::WebGLCompressedTextureATC::WebGLCompressedTextureATC):
     29        * html/canvas/WebGLCompressedTexturePVRTC.cpp:
     30        (WebCore::WebGLCompressedTexturePVRTC::WebGLCompressedTexturePVRTC):
     31        * html/canvas/WebGLCompressedTextureS3TC.cpp:
     32        (WebCore::WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC):
     33        (WebCore::WebGLCompressedTextureS3TC::supported):
     34        * html/canvas/WebGLDebugShaders.cpp:
     35        (WebCore::WebGLDebugShaders::WebGLDebugShaders):
     36        * html/canvas/WebGLDepthTexture.cpp:
     37        (WebCore::WebGLDepthTexture::WebGLDepthTexture):
     38        * html/canvas/WebGLDrawBuffers.cpp:
     39        (WebCore::WebGLDrawBuffers::WebGLDrawBuffers):
     40        (WebCore::WebGLDrawBuffers::supported):
     41        * platform/graphics/angle/GraphicsContext3DANGLE.cpp:
     42        (WebCore::GraphicsContext3D::reshapeFBOs):
     43        (WebCore::GraphicsContext3D::validateDepthStencil):
     44        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
     45        (WebCore::GraphicsContext3D::GraphicsContext3D):
     46
    1472019-08-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
    248
  • trunk/Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp

    r223728 r249218  
    2929#include "ANGLEInstancedArrays.h"
    3030
    31 #if PLATFORM(GTK)
     31#if PLATFORM(GTK) || USE(ANGLE)
    3232#include "Extensions3D.h"
    3333#endif
     
    3838    : WebGLExtension(context)
    3939{
     40#if USE(ANGLE)
     41    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_ANGLE_instanced_arrays");
     42#endif
    4043}
    4144
     
    5053{
    5154#if PLATFORM(COCOA)
     55#if USE(ANGLE)
     56    return context.graphicsContext3D()->getExtensions().supports("GL_ANGLE_instanced_arrays");
     57#else
    5258    UNUSED_PARAM(context);
    5359    return true;
     60#endif
    5461#elif PLATFORM(GTK)
    5562    return context.graphicsContext3D()->getExtensions().supports("GL_ANGLE_instanced_arrays");
  • trunk/Source/WebCore/html/canvas/WebGLCompressedTextureASTC.cpp

    r233122 r249218  
    4040    , m_isLDRSupported(context.graphicsContext3D()->getExtensions().supports("GL_KHR_texture_compression_astc_ldr"_s))
    4141{
     42    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_KHR_texture_compression_astc_hdr"_s);
     43    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_KHR_texture_compression_astc_ldr"_s);
     44
    4245    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_ASTC_4x4_KHR);
    4346    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_ASTC_5x4_KHR);
  • trunk/Source/WebCore/html/canvas/WebGLCompressedTextureATC.cpp

    r223728 r249218  
    3737    : WebGLExtension(context)
    3838{
     39    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_AMD_compressed_ATC_texture");
     40
    3941    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_ATC_RGB_AMD);
    4042    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_ATC_RGBA_EXPLICIT_ALPHA_AMD);
  • trunk/Source/WebCore/html/canvas/WebGLCompressedTexturePVRTC.cpp

    r223728 r249218  
    3838    : WebGLExtension(context)
    3939{
     40    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_IMG_texture_compression_pvrtc");
     41
    4042    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG);
    4143    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGB_PVRTC_2BPPV1_IMG);
  • trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp

    r223728 r249218  
    3838    : WebGLExtension(context)
    3939{
     40    auto& extensions = context.graphicsContext3D()->getExtensions();
     41    extensions.ensureEnabled("GL_EXT_texture_compression_dxt1");
     42    extensions.ensureEnabled("GL_ANGLE_texture_compression_dxt3");
     43    extensions.ensureEnabled("GL_ANGLE_texture_compression_dxt5");
     44
    4045    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT);
    4146    context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT);
     
    5459{
    5560    auto& extensions = context.graphicsContext3D()->getExtensions();
     61#if USE(ANGLE)
     62    return extensions.supports("GL_EXT_texture_compression_dxt1")
     63        && extensions.supports("GL_ANGLE_texture_compression_dxt3")
     64        && extensions.supports("GL_ANGLE_texture_compression_dxt5");
     65#else
    5666    return extensions.supports("GL_EXT_texture_compression_s3tc")
    5767        || extensions.supports("GL_EXT_texture_compression_dxt1");
     68#endif
    5869}
    5970
  • trunk/Source/WebCore/html/canvas/WebGLDebugShaders.cpp

    r223728 r249218  
    3939    : WebGLExtension(context)
    4040{
     41    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_ANGLE_translated_shader_source");
    4142}
    4243
  • trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp

    r223728 r249218  
    3737    : WebGLExtension(context)
    3838{
     39    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_OES_depth_texture");
     40    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_ARB_depth_texture");
    3941}
    4042
  • trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp

    r223728 r249218  
    3636    : WebGLExtension(context)
    3737{
     38    context.graphicsContext3D()->getExtensions().ensureEnabled("GL_EXT_draw_buffers");
    3839}
    3940
     
    4748bool WebGLDrawBuffers::supported(WebGLRenderingContextBase& context)
    4849{
     50#if USE(ANGLE)
     51    return context.graphicsContext3D()->getExtensions().supports("GL_EXT_draw_buffers");
     52#else
    4953    return context.graphicsContext3D()->getExtensions().supports("GL_EXT_draw_buffers")
    5054        && satisfiesWebGLRequirements(context);
     55#endif
    5156}
    5257
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp

    r248846 r249218  
    146146        Extensions3D& extensions = getExtensions();
    147147        // Use a 24 bit depth buffer where we know we have it.
    148         if (extensions.supports("GL_OES_packed_depth_stencil"))
     148        if (extensions.supports(packedDepthStencilExtensionName))
    149149            internalDepthStencilFormat = GL_DEPTH24_STENCIL8_OES;
    150150        else
     
    393393void GraphicsContext3D::validateDepthStencil(const char* packedDepthStencilExtension)
    394394{
    395     // Note there are no Extensions3D::ensureEnabled calls here. The ANGLE
    396     // backend currently assumes at a fairly deep level that
    397     // EGL_EXTENSIONS_ENABLED_ANGLE is set to true during context creation: for
    398     // the allocation of rectangular textures, etc.
    399395    Extensions3D& extensions = getExtensions();
    400396    if (m_attrs.stencil) {
    401397        if (extensions.supports(packedDepthStencilExtension)) {
     398            extensions.ensureEnabled(packedDepthStencilExtension);
    402399            // Force depth if stencil is true.
    403400            m_attrs.depth = true;
     
    410407        if (!extensions.supports("GL_ANGLE_framebuffer_multisample") || !extensions.supports("GL_ANGLE_framebuffer_blit") || !extensions.supports("GL_OES_rgb8_rgba8") || isGLES2Compliant())
    411408            m_attrs.antialias = false;
     409        else {
     410            extensions.ensureEnabled("GL_ANGLE_framebuffer_multisample");
     411            extensions.ensureEnabled("GL_ANGLE_framebuffer_blit");
     412            extensions.ensureEnabled("GL_OES_rgb8_rgba8");
     413        }
    412414    }
    413415}
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

    r248846 r249218  
    330330    contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
    331331    contextAttributes.push_back(EGL_TRUE);
    332     contextAttributes.push_back(EGL_EXTENSIONS_ENABLED_ANGLE);
    333     contextAttributes.push_back(EGL_TRUE);
    334332    if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) {
    335333        contextAttributes.push_back(EGL_POWER_PREFERENCE_ANGLE);
     
    348346
    349347    EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj);
     348
     349    static constexpr const char* requiredExtensions[] = {
     350        "GL_ANGLE_texture_rectangle", // For IOSurface-backed textures
     351        "GL_EXT_texture_format_BGRA8888", // For creating the EGL surface from an IOSurface
     352    };
     353
     354    static constexpr const char* optionalExtensions[] = {
     355        "GL_EXT_debug_marker",
     356    };
     357
     358    Extensions3D& extensions = getExtensions();
     359
     360    for (size_t i = 0; i < WTF_ARRAY_LENGTH(requiredExtensions); ++i) {
     361        if (!extensions.supports(requiredExtensions[i])) {
     362            LOG(WebGL, "Missing required extension.");
     363            return;
     364        }
     365
     366        extensions.ensureEnabled(requiredExtensions[i]);
     367    }
     368
     369    for (size_t i = 0; i < WTF_ARRAY_LENGTH(optionalExtensions); ++i) {
     370        if (extensions.supports(optionalExtensions[i]))
     371            extensions.ensureEnabled(optionalExtensions[i]);
     372    }
    350373
    351374#endif // #elif USE(ANGLE)
Note: See TracChangeset for help on using the changeset viewer.