Source/WebCore/ChangeLog

 12019-08-23 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 NOBODY (OOPS!).
 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-21 Tim Horton <timothy_horton@apple.com>
248
349 [Mail] Tapping top of message scrolls back to copied text instead of top of the message

Source/WebCore/html/canvas/ANGLEInstancedArrays.cpp

2828#if ENABLE(WEBGL)
2929#include "ANGLEInstancedArrays.h"
3030
31 #if PLATFORM(GTK)
 31#if PLATFORM(GTK) || USE(ANGLE)
3232#include "Extensions3D.h"
3333#endif
3434

@@namespace WebCore {
3737ANGLEInstancedArrays::ANGLEInstancedArrays(WebGLRenderingContextBase& context)
3838 : WebGLExtension(context)
3939{
 40#if USE(ANGLE)
 41 context.graphicsContext3D()->getExtensions().ensureEnabled("GL_ANGLE_instanced_arrays");
 42#endif
4043}
4144
4245ANGLEInstancedArrays::~ANGLEInstancedArrays() = default;

@@WebGLExtension::ExtensionName ANGLEInstancedArrays::getName() const
4952bool ANGLEInstancedArrays::supported(WebGLRenderingContextBase& context)
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");
5663#else

Source/WebCore/html/canvas/WebGLCompressedTextureASTC.cpp

@@WebGLCompressedTextureASTC::WebGLCompressedTextureASTC(WebGLRenderingContextBase
3939 , m_isHDRSupported(context.graphicsContext3D()->getExtensions().supports("GL_KHR_texture_compression_astc_hdr"_s))
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);
4447 context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_ASTC_5x5_KHR);

Source/WebCore/html/canvas/WebGLCompressedTextureATC.cpp

@@namespace WebCore {
3636WebGLCompressedTextureATC::WebGLCompressedTextureATC(WebGLRenderingContextBase& context)
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);
4143 context.addCompressedTextureFormat(Extensions3D::COMPRESSED_ATC_RGBA_INTERPOLATED_ALPHA_AMD);

Source/WebCore/html/canvas/WebGLCompressedTexturePVRTC.cpp

@@namespace WebCore {
3737WebGLCompressedTexturePVRTC::WebGLCompressedTexturePVRTC(WebGLRenderingContextBase& context)
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);
4244 context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG);

Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp

@@namespace WebCore {
3737WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC(WebGLRenderingContextBase& context)
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);
4247 context.addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT);

@@WebGLExtension::ExtensionName WebGLCompressedTextureS3TC::getName() const
5358bool WebGLCompressedTextureS3TC::supported(WebGLRenderingContextBase& context)
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
6071} // namespace WebCore

Source/WebCore/html/canvas/WebGLDebugShaders.cpp

@@namespace WebCore {
3838WebGLDebugShaders::WebGLDebugShaders(WebGLRenderingContextBase& context)
3939 : WebGLExtension(context)
4040{
 41 context.graphicsContext3D()->getExtensions().ensureEnabled("GL_ANGLE_translated_shader_source");
4142}
4243
4344WebGLDebugShaders::~WebGLDebugShaders() = default;

Source/WebCore/html/canvas/WebGLDepthTexture.cpp

@@namespace WebCore {
3636WebGLDepthTexture::WebGLDepthTexture(WebGLRenderingContextBase& context)
3737 : WebGLExtension(context)
3838{
 39 context.graphicsContext3D()->getExtensions().ensureEnabled("GL_OES_depth_texture");
 40 context.graphicsContext3D()->getExtensions().ensureEnabled("GL_ARB_depth_texture");
3941}
4042
4143WebGLDepthTexture::~WebGLDepthTexture() = default;

Source/WebCore/html/canvas/WebGLDrawBuffers.cpp

@@namespace WebCore {
3535WebGLDrawBuffers::WebGLDrawBuffers(WebGLRenderingContextBase& context)
3636 : WebGLExtension(context)
3737{
 38 context.graphicsContext3D()->getExtensions().ensureEnabled("GL_EXT_draw_buffers");
3839}
3940
4041WebGLDrawBuffers::~WebGLDrawBuffers() = default;

@@WebGLExtension::ExtensionName WebGLDrawBuffers::getName() const
4647
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
5358void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GC3Denum>& buffers)

Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp

@@bool GraphicsContext3D::reshapeFBOs(const IntSize& size)
145145
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
151151 internalDepthStencilFormat = GL_DEPTH_COMPONENT16;

@@void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsi
392392
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;
404401 } else

@@void GraphicsContext3D::validateDepthStencil(const char* packedDepthStencilExten
409406 // FIXME: must adjust this when upgrading to WebGL 2.0 / OpenGL ES 3.0 support.
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}
414416

Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

@@GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
329329 contextAttributes.push_back(2);
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);
336334 // EGL_LOW_POWER_ANGLE is the default. Change to

@@GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
348346
349347 EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj);
350348
 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 size_t requiredExtensionCount = sizeof(requiredExtensions) / sizeof(requiredExtensions[0]);
 361 for (unsigned i = 0; i < requiredExtensionCount; ++i) {
 362 if (!extensions.supports(requiredExtensions[i])) {
 363 LOG(WebGL, "Missing required extension.");
 364 return;
 365 }
 366
 367 extensions.ensureEnabled(requiredExtensions[i]);
 368 }
 369
 370 size_t optionalExtensionCount = sizeof(optionalExtensions) / sizeof(optionalExtensions[0]);
 371 for (unsigned i = 0; i < optionalExtensionCount; ++i) {
 372 if (extensions.supports(optionalExtensions[i]))
 373 extensions.ensureEnabled(optionalExtensions[i]);
 374 }
 375
351376#endif // #elif USE(ANGLE)
352377
353378 validateAttributes();