Changeset 247315 in webkit


Ignore:
Timestamp:
Jul 10, 2019 11:43:02 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Hook up WebGL's back buffer in ANGLE backend on macOS
https://bugs.webkit.org/show_bug.cgi?id=198982

Patch by Kenneth Russell <kbr@chromium.org> on 2019-07-10
Reviewed by Alex Christensen.

Source/ThirdParty/ANGLE:

Add source files needed to implement and call ANGLE extensions, and
export headers necessary for those extensions. Update the script which
adjusts include paths to handle the new headers.

Cherry-pick fix for ANGLE bug crbug.com/angleproject/3669 to support
antialias:true for ANGLE-backed WebGL contexts.

  • ANGLE.xcodeproj/project.pbxproj:
  • adjust-angle-include-paths.sh:
  • src/libANGLE/FramebufferAttachment.cpp:

(gl::FramebufferAttachment::getTextureImageIndex const): Deleted.

  • src/libANGLE/FramebufferAttachment.h:

(gl::FramebufferAttachment::getTextureImageIndex const):

  • src/libANGLE/validationES2.cpp:

(gl::ValidateBlitFramebufferANGLE):

Source/WebCore:

Fix a few places which were accidentally calling desktop OpenGL rather
than ANGLE. Fix some calls which were using ANGLE's OpenGL ES 3.0
entry points rather than the OpenGL ES 2.0 extension APIs, causing
them to generate errors in WebGL 1.0's backend. Change
Extensions3DANGLE to use ANGLE's requestable extension mechanism.

Fix framebuffer setup when using ANGLE for WebGL 1.0 contexts, for
both antialias:true and false.

Remove ANGLEWebKitBridge in ANGLE backend. It interfered with the
correct operation of ANGLE's internal shader compiler, and was
unnecessary given the use of ANGLE. Remove all manual shader name
hashing and mapping in ANGLE backend.

Tested with parts of the WebGL conformance suite and the San
Angeles demo, which now runs properly with WebKit's ANGLE backend
for WebGL.

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::getProgramParameter):
(WebCore::WebGLRenderingContextBase::getUniformLocation):
(WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):

  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/angle/Extensions3DANGLE.cpp:

(WebCore::Extensions3DANGLE::Extensions3DANGLE):
(WebCore::Extensions3DANGLE::supports):
(WebCore::Extensions3DANGLE::ensureEnabled):
(WebCore::Extensions3DANGLE::isEnabled):
(WebCore::Extensions3DANGLE::getTranslatedShaderSourceANGLE):
(WebCore::Extensions3DANGLE::initializeAvailableExtensions):
(WebCore::Extensions3DANGLE::blitFramebuffer):
(WebCore::Extensions3DANGLE::renderbufferStorageMultisample):
(WebCore::Extensions3DANGLE::createVertexArrayOES):
(WebCore::Extensions3DANGLE::deleteVertexArrayOES):
(WebCore::Extensions3DANGLE::isVertexArrayOES):
(WebCore::Extensions3DANGLE::bindVertexArrayOES):
(WebCore::Extensions3DANGLE::supportsExtension):
(WebCore::Extensions3DANGLE::drawBuffersEXT):
(WebCore::Extensions3DANGLE::drawArraysInstanced):
(WebCore::Extensions3DANGLE::drawElementsInstanced):
(WebCore::Extensions3DANGLE::vertexAttribDivisor):

  • platform/graphics/angle/Extensions3DANGLE.h:
  • platform/graphics/angle/GraphicsContext3DANGLE.cpp:

(WebCore::GraphicsContext3D::validateAttributes):
(WebCore::GraphicsContext3D::reshapeFBOs):
(WebCore::GraphicsContext3D::attachDepthAndStencilBufferIfNeeded):
(WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
(WebCore::GraphicsContext3D::validateDepthStencil):
(WebCore::GraphicsContext3D::prepareTexture):
(WebCore::GraphicsContext3D::attachShader):
(WebCore::GraphicsContext3D::bindAttribLocation):
(WebCore::GraphicsContext3D::compileShader):
(WebCore::GraphicsContext3D::compileShaderDirect):
(WebCore::GraphicsContext3D::detachShader):
(WebCore::GraphicsContext3D::getActiveAttribImpl):
(WebCore::GraphicsContext3D::getActiveAttrib):
(WebCore::GraphicsContext3D::getActiveUniformImpl):
(WebCore::GraphicsContext3D::getActiveUniform):
(WebCore::GraphicsContext3D::getAttribLocation):
(WebCore::GraphicsContext3D::getAttribLocationDirect):
(WebCore::GraphicsContext3D::moveErrorsToSyntheticErrorList):
(WebCore::GraphicsContext3D::linkProgram):
(WebCore::GraphicsContext3D::shaderSource):
(WebCore::GraphicsContext3D::getUnmangledInfoLog):
(WebCore::GraphicsContext3D::getShaderiv):
(WebCore::GraphicsContext3D::getShaderInfoLog):
(WebCore::GraphicsContext3D::getUniformLocation):
(WebCore::GraphicsContext3D::createBuffer):
(WebCore::GraphicsContext3D::createFramebuffer):
(WebCore::GraphicsContext3D::createProgram):
(WebCore::GraphicsContext3D::createRenderbuffer):
(WebCore::GraphicsContext3D::createShader):
(WebCore::GraphicsContext3D::createTexture):
(WebCore::GraphicsContext3D::deleteBuffer):
(WebCore::GraphicsContext3D::deleteFramebuffer):
(WebCore::GraphicsContext3D::deleteProgram):
(WebCore::GraphicsContext3D::deleteRenderbuffer):
(WebCore::GraphicsContext3D::deleteShader):
(WebCore::GraphicsContext3D::deleteTexture):
(WebCore::GraphicsContext3D::synthesizeGLError):
(): Deleted.
(WebCore::setCurrentNameHashMapForShader): Deleted.
(WebCore::nameHashForShader): Deleted.
(WebCore::GraphicsContext3D::checkVaryingsPacking const): Deleted.
(WebCore::GraphicsContext3D::precisionsMatch const): Deleted.
(WebCore::generateHashedName): Deleted.
(WebCore::GraphicsContext3D::mappedSymbolInShaderSourceMap): Deleted.
(WebCore::GraphicsContext3D::mappedSymbolName): Deleted.
(WebCore::GraphicsContext3D::originalSymbolInShaderSourceMap): Deleted.
(WebCore::GraphicsContext3D::originalSymbolName): Deleted.
(WebCore::GraphicsContext3D::getNonBuiltInActiveSymbolCount): Deleted.
(WebCore::GraphicsContext3D::getShaderSource): Deleted.

  • platform/graphics/cocoa/GraphicsContext3DCocoa.mm:

(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::~GraphicsContext3D):
(WebCore::GraphicsContext3D::makeContextCurrent):
(WebCore::GraphicsContext3D::checkGPUStatus):
(WebCore::GraphicsContext3D::allocateIOSurfaceBackingStore):
(WebCore::GraphicsContext3D::updateFramebufferTextureBackingStoreFromLayer):

  • platform/graphics/cocoa/WebGLLayer.h:
  • platform/graphics/cocoa/WebGLLayer.mm:

(-[WebGLLayer initWithGraphicsContext3D:]):
(-[WebGLLayer copyImageSnapshotWithColorSpace:]):
(-[WebGLLayer display]):
(-[WebGLLayer setEGLDisplay:andConfig:]):
(-[WebGLLayer dealloc]):
(-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
(-[WebGLLayer bindFramebufferToNextAvailableSurface]):

Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj

    r246554 r247315  
    511511                5CB305021DE4164800D2C405 /* TransformFeedbackImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB304D81DE4164800D2C405 /* TransformFeedbackImpl.h */; };
    512512                5CB305031DE4164800D2C405 /* VertexArrayImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB304D91DE4164800D2C405 /* VertexArrayImpl.h */; };
    513                 5CB5E1A71DFB8AF600F90FC9 /* libEGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CB300B51DE39E6300D2C405 /* libEGL.cpp */; };
    514513                5CC7D457191024E4000B8C1F /* ValidateOutputs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D450191024E4000B8C1F /* ValidateOutputs.cpp */; };
    515514                5CC7D458191024E4000B8C1F /* ValidateOutputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D451191024E4000B8C1F /* ValidateOutputs.h */; };
     
    591590                5CCD81B51DBFEA5C006066B8 /* QualifierTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD819E1DBFEA5C006066B8 /* QualifierTypes.cpp */; };
    592591                5CCD81B61DBFEA5C006066B8 /* QualifierTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CCD819F1DBFEA5C006066B8 /* QualifierTypes.h */; };
     592                6E344AB122BC35C3001DDB2C /* entry_points_enum_autogen.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E344AAD22BC35C3001DDB2C /* entry_points_enum_autogen.h */; };
     593                6E344AB222BC35C3001DDB2C /* entry_points_gles_ext_autogen.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E344AAE22BC35C3001DDB2C /* entry_points_gles_ext_autogen.h */; settings = {ATTRIBUTES = (Public, ); }; };
     594                6E344AB322BC35C3001DDB2C /* entry_points_gles_ext_autogen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E344AAF22BC35C3001DDB2C /* entry_points_gles_ext_autogen.cpp */; };
     595                6E344AB622BC57C8001DDB2C /* entry_points_gles_1_0_autogen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E344AB422BC57C8001DDB2C /* entry_points_gles_1_0_autogen.cpp */; };
     596                6E344AB722BC57C8001DDB2C /* entry_points_gles_1_0_autogen.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E344AB522BC57C8001DDB2C /* entry_points_gles_1_0_autogen.h */; };
     597                6ED70A0C22CD630E008688CE /* gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ED70A0922CD630E008688CE /* gl.h */; settings = {ATTRIBUTES = (Public, ); }; };
     598                6ED70A0D22CD630E008688CE /* glext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ED70A0A22CD630E008688CE /* glext.h */; settings = {ATTRIBUTES = (Public, ); }; };
     599                6ED70A0E22CD630E008688CE /* glplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ED70A0B22CD630E008688CE /* glplatform.h */; settings = {ATTRIBUTES = (Public, ); }; };
     600                6ED70A1022CD6822008688CE /* glext_angle.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ED70A0F22CD6822008688CE /* glext_angle.h */; settings = {ATTRIBUTES = (Public, ); }; };
     601                6EE2FD2D22BAE99C001D369E /* eglext_angle.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE2FD2C22BAE99C001D369E /* eglext_angle.h */; settings = {ATTRIBUTES = (Public, ); }; };
     602                6EE2FD2F22BAE9CD001D369E /* gl2ext_angle.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE2FD2E22BAE9CD001D369E /* gl2ext_angle.h */; settings = {ATTRIBUTES = (Public, ); }; };
    593603                72309A56183C27DE00370B93 /* Tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72309A55183C27DB00370B93 /* Tokenizer.cpp */; settings = {COMPILER_FLAGS = "-Wno-unreachable-code"; }; };
    594604                72309A58183C27F300370B93 /* ExpressionParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72309A57183C27F100370B93 /* ExpressionParser.cpp */; settings = {COMPILER_FLAGS = "-Wno-unreachable-code"; }; };
     
    10501060                5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FlagStd140Structs.cpp; sourceTree = "<group>"; };
    10511061                5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlagStd140Structs.h; sourceTree = "<group>"; };
    1052                 5CB300B51DE39E6300D2C405 /* libEGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libEGL.cpp; sourceTree = "<group>"; };
    10531062                5CB300B81DE39E6300D2C405 /* resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = "<group>"; };
    10541063                5CB300BB1DE39E7500D2C405 /* entry_points_egl_ext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = entry_points_egl_ext.cpp; sourceTree = "<group>"; };
     
    12381247                5D7C59C61208C68B001C873E /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
    12391248                5D7C59C71208C68B001C873E /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
     1249                6E344AAD22BC35C3001DDB2C /* entry_points_enum_autogen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entry_points_enum_autogen.h; sourceTree = "<group>"; };
     1250                6E344AAE22BC35C3001DDB2C /* entry_points_gles_ext_autogen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entry_points_gles_ext_autogen.h; sourceTree = "<group>"; };
     1251                6E344AAF22BC35C3001DDB2C /* entry_points_gles_ext_autogen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = entry_points_gles_ext_autogen.cpp; sourceTree = "<group>"; };
     1252                6E344AB422BC57C8001DDB2C /* entry_points_gles_1_0_autogen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = entry_points_gles_1_0_autogen.cpp; sourceTree = "<group>"; };
     1253                6E344AB522BC57C8001DDB2C /* entry_points_gles_1_0_autogen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = entry_points_gles_1_0_autogen.h; sourceTree = "<group>"; };
     1254                6ED70A0922CD630E008688CE /* gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl.h; path = include/GLES/gl.h; sourceTree = "<group>"; };
     1255                6ED70A0A22CD630E008688CE /* glext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glext.h; path = include/GLES/glext.h; sourceTree = "<group>"; };
     1256                6ED70A0B22CD630E008688CE /* glplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glplatform.h; path = include/GLES/glplatform.h; sourceTree = "<group>"; };
     1257                6ED70A0F22CD6822008688CE /* glext_angle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glext_angle.h; path = include/GLES/glext_angle.h; sourceTree = "<group>"; };
     1258                6EE2FD2C22BAE99C001D369E /* eglext_angle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = eglext_angle.h; path = include/EGL/eglext_angle.h; sourceTree = "<group>"; };
     1259                6EE2FD2E22BAE9CD001D369E /* gl2ext_angle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gl2ext_angle.h; path = include/GLES2/gl2ext_angle.h; sourceTree = "<group>"; };
    12401260                72309A55183C27DB00370B93 /* Tokenizer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Tokenizer.cpp; sourceTree = "<group>"; };
    12411261                72309A57183C27F100370B93 /* ExpressionParser.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ExpressionParser.cpp; sourceTree = "<group>"; };
     
    15061526                                5C1BAAA61DFB6124002906BB /* egl.h */,
    15071527                                5C1BAAA71DFB6124002906BB /* eglext.h */,
     1528                                6EE2FD2C22BAE99C001D369E /* eglext_angle.h */,
    15081529                                5C1BAAA81DFB6124002906BB /* eglplatform.h */,
    15091530                        );
     
    15161537                                5C1BAA9E1DFB610E002906BB /* gl2.h */,
    15171538                                5C1BAA9F1DFB610E002906BB /* gl2ext.h */,
     1539                                6EE2FD2E22BAE9CD001D369E /* gl2ext_angle.h */,
    15181540                                5C1BAAA01DFB610E002906BB /* gl2platform.h */,
    15191541                        );
     
    16971719                        isa = PBXGroup;
    16981720                        children = (
    1699                                 5CB300B51DE39E6300D2C405 /* libEGL.cpp */,
    17001721                                5CB300B81DE39E6300D2C405 /* resource.h */,
    17011722                        );
     
    17101731                                5CB300BB1DE39E7500D2C405 /* entry_points_egl_ext.cpp */,
    17111732                                5CB300BC1DE39E7500D2C405 /* entry_points_egl_ext.h */,
     1733                                6E344AAD22BC35C3001DDB2C /* entry_points_enum_autogen.h */,
     1734                                6E344AB422BC57C8001DDB2C /* entry_points_gles_1_0_autogen.cpp */,
     1735                                6E344AB522BC57C8001DDB2C /* entry_points_gles_1_0_autogen.h */,
    17121736                                315EBE021FCE456200AC7A89 /* entry_points_gles_2_0_autogen.cpp */,
    17131737                                315EBDFE1FCE456100AC7A89 /* entry_points_gles_2_0_autogen.h */,
     
    17161740                                315EBE011FCE456100AC7A89 /* entry_points_gles_3_1_autogen.cpp */,
    17171741                                315EBDFF1FCE456100AC7A89 /* entry_points_gles_3_1_autogen.h */,
     1742                                6E344AAF22BC35C3001DDB2C /* entry_points_gles_ext_autogen.cpp */,
     1743                                6E344AAE22BC35C3001DDB2C /* entry_points_gles_ext_autogen.h */,
    17181744                                5CB300C71DE39E7500D2C405 /* global_state.cpp */,
    17191745                                5CB300C81DE39E7500D2C405 /* global_state.h */,
     
    20742100                        sourceTree = "<group>";
    20752101                };
     2102                6ED70A0822CD62E8008688CE /* GLES */ = {
     2103                        isa = PBXGroup;
     2104                        children = (
     2105                                6ED70A0922CD630E008688CE /* gl.h */,
     2106                                6ED70A0A22CD630E008688CE /* glext.h */,
     2107                                6ED70A0F22CD6822008688CE /* glext_angle.h */,
     2108                                6ED70A0B22CD630E008688CE /* glplatform.h */,
     2109                        );
     2110                        name = GLES;
     2111                        sourceTree = "<group>";
     2112                };
    20762113                A08C3CD816D6CB35003F0B83 /* third_party */ = {
    20772114                        isa = PBXGroup;
     
    21052142                        children = (
    21062143                                5C1BAA931DFB60E2002906BB /* EGL */,
     2144                                6ED70A0822CD62E8008688CE /* GLES */,
    21072145                                5C1BAA941DFB60EA002906BB /* GLES2 */,
    21082146                                5C1BAA951DFB60EF002906BB /* GLES3 */,
     
    22702308                                5C1BAAAA1DFB6124002906BB /* egl.h in Headers */,
    22712309                                5C1BAAAB1DFB6124002906BB /* eglext.h in Headers */,
     2310                                6EE2FD2D22BAE99C001D369E /* eglext_angle.h in Headers */,
    22722311                                5CB304E31DE4164800D2C405 /* EGLImplFactory.h in Headers */,
    22732312                                5C1BAAAC1DFB6124002906BB /* eglplatform.h in Headers */,
     
    22782317                                5CB304981DE4157B00D2C405 /* entry_points_egl.h in Headers */,
    22792318                                5CB304961DE4157B00D2C405 /* entry_points_egl_ext.h in Headers */,
     2319                                6E344AB122BC35C3001DDB2C /* entry_points_enum_autogen.h in Headers */,
     2320                                6E344AB722BC57C8001DDB2C /* entry_points_gles_1_0_autogen.h in Headers */,
    22802321                                315EBE061FCE456200AC7A89 /* entry_points_gles_2_0_autogen.h in Headers */,
    22812322                                315EBE051FCE456200AC7A89 /* entry_points_gles_3_0_autogen.h in Headers */,
    22822323                                315EBE071FCE456200AC7A89 /* entry_points_gles_3_1_autogen.h in Headers */,
     2324                                6E344AB222BC35C3001DDB2C /* entry_points_gles_ext_autogen.h in Headers */,
    22832325                                5C1DBDEB1B0438D300235552 /* Error.h in Headers */,
    22842326                                315EBDE91FCE452D00AC7A89 /* ErrorStrings.h in Headers */,
     
    23132355                                5CB3012A1DE39F1A00D2C405 /* functionsgl_typedefs.h in Headers */,
    23142356                                5CCD59942284FC400018F2D8 /* generatemip.h in Headers */,
     2357                                6ED70A0C22CD630E008688CE /* gl.h in Headers */,
    23152358                                5C1BAAA21DFB610E002906BB /* gl2.h in Headers */,
    23162359                                5C1BAAA31DFB610E002906BB /* gl2ext.h in Headers */,
     2360                                6EE2FD2F22BAE9CD001D369E /* gl2ext_angle.h in Headers */,
    23172361                                5C1BAAA41DFB610E002906BB /* gl2platform.h in Headers */,
    23182362                                5C1BAA9A1DFB60FF002906BB /* gl3.h in Headers */,
     
    23222366                                5CCD59602284F7960018F2D8 /* GLES1Renderer.h in Headers */,
    23232367                                5CCD59622284F7960018F2D8 /* GLES1State.h in Headers */,
     2368                                6ED70A0D22CD630E008688CE /* glext.h in Headers */,
     2369                                6ED70A1022CD6822008688CE /* glext_angle.h in Headers */,
    23242370                                5CB304EC1DE4164800D2C405 /* GLImplFactory.h in Headers */,
    23252371                                5CB304A21DE4157B00D2C405 /* global_state.h in Headers */,
     2372                                6ED70A0E22CD630E008688CE /* glplatform.h in Headers */,
    23262373                                31012E2D18B97B9B0039062F /* glslang.h in Headers */,
    23272374                                31012E3218B97B9B0039062F /* glslang_tab.h in Headers */,
     
    26842731                                5C1BAAB51DFB6F54002906BB /* entry_points_egl.cpp in Sources */,
    26852732                                5C1BAAB61DFB6F58002906BB /* entry_points_egl_ext.cpp in Sources */,
     2733                                6E344AB622BC57C8001DDB2C /* entry_points_gles_1_0_autogen.cpp in Sources */,
    26862734                                315EBE0A1FCE456200AC7A89 /* entry_points_gles_2_0_autogen.cpp in Sources */,
    26872735                                315EBE081FCE456200AC7A89 /* entry_points_gles_3_0_autogen.cpp in Sources */,
    26882736                                315EBE091FCE456200AC7A89 /* entry_points_gles_3_1_autogen.cpp in Sources */,
     2737                                6E344AB322BC35C3001DDB2C /* entry_points_gles_ext_autogen.cpp in Sources */,
    26892738                                5C1DBDEA1B0438D300235552 /* Error.cpp in Sources */,
    26902739                                315EBDEF1FCE452D00AC7A89 /* es3_copy_conversion_table_autogen.cpp in Sources */,
     
    27372786                                315EBD9C1FCE443600AC7A89 /* IsASTDepthBelowLimit.cpp in Sources */,
    27382787                                A264F8B616974DED006FAA5A /* Lexer.cpp in Sources */,
    2739                                 5CB5E1A71DFB8AF600F90FC9 /* libEGL.cpp in Sources */,
    27402788                                5CB304EF1DE4164800D2C405 /* load_functions_table_autogen.cpp in Sources */,
    27412789                                5CCD59952284FC400018F2D8 /* loadimage.cpp in Sources */,
  • trunk/Source/ThirdParty/ANGLE/ChangeLog

    r246892 r247315  
     12019-07-10  Kenneth Russell  <kbr@chromium.org>
     2
     3        Hook up WebGL's back buffer in ANGLE backend on macOS
     4        https://bugs.webkit.org/show_bug.cgi?id=198982
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add source files needed to implement and call ANGLE extensions, and
     9        export headers necessary for those extensions. Update the script which
     10        adjusts include paths to handle the new headers.
     11
     12        Cherry-pick fix for ANGLE bug crbug.com/angleproject/3669 to support
     13        antialias:true for ANGLE-backed WebGL contexts.
     14
     15        * ANGLE.xcodeproj/project.pbxproj:
     16        * adjust-angle-include-paths.sh:
     17        * src/libANGLE/FramebufferAttachment.cpp:
     18        (gl::FramebufferAttachment::getTextureImageIndex const): Deleted.
     19        * src/libANGLE/FramebufferAttachment.h:
     20        (gl::FramebufferAttachment::getTextureImageIndex const):
     21        * src/libANGLE/validationES2.cpp:
     22        (gl::ValidateBlitFramebufferANGLE):
     23
    1242019-06-27  Beth Dakin  <bdakin@apple.com>
    225
  • trunk/Source/ThirdParty/ANGLE/adjust-angle-include-paths.sh

    r246842 r247315  
    3232        sed -e '
    3333s/^#include <EGL\/\(.*\)>/#include <ANGLE\/\1>/
     34s/^#include <GLES\/\(.*\)>/#include <ANGLE\/\1>/
    3435s/^#include <GLES2\/\(.*\)>/#include <ANGLE\/\1>/
    3536s/^#include <GLES3\/\(.*\)>/#include <ANGLE\/\1>/
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp

    r245088 r247315  
    179179}
    180180
    181 const ImageIndex &FramebufferAttachment::getTextureImageIndex() const
    182 {
    183     ASSERT(type() == GL_TEXTURE);
    184     return mTarget.textureIndex();
    185 }
    186 
    187181TextureTarget FramebufferAttachment::cubeMapFace() const
    188182{
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h

    r245088 r247315  
    217217};
    218218
     219inline const ImageIndex &FramebufferAttachment::getTextureImageIndex() const
     220{
     221    ASSERT(type() == GL_TEXTURE);
     222    return mTarget.textureIndex();
     223}
     224
    219225inline Extents FramebufferAttachment::getSize() const
    220226{
  • trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.cpp

    r245088 r247315  
    25732573        {
    25742574            if (!(readColorAttachment->type() == GL_TEXTURE &&
    2575                   readColorAttachment->getTextureImageIndex().getType() == TextureType::_2D) &&
     2575                  (readColorAttachment->getTextureImageIndex().getType() == TextureType::_2D ||
     2576                   readColorAttachment->getTextureImageIndex().getType() == TextureType::Rectangle)) &&
    25762577                readColorAttachment->type() != GL_RENDERBUFFER &&
    25772578                readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
     
    25902591                {
    25912592                    if (!(attachment->type() == GL_TEXTURE &&
    2592                           attachment->getTextureImageIndex().getType() == TextureType::_2D) &&
     2593                          (attachment->getTextureImageIndex().getType() == TextureType::_2D ||
     2594                           attachment->getTextureImageIndex().getType() == TextureType::Rectangle)) &&
    25932595                        attachment->type() != GL_RENDERBUFFER &&
    25942596                        attachment->type() != GL_FRAMEBUFFER_DEFAULT)
  • trunk/Source/WebCore/ChangeLog

    r247313 r247315  
     12019-07-10  Kenneth Russell  <kbr@chromium.org>
     2
     3        Hook up WebGL's back buffer in ANGLE backend on macOS
     4        https://bugs.webkit.org/show_bug.cgi?id=198982
     5
     6        Reviewed by Alex Christensen.
     7
     8        Fix a few places which were accidentally calling desktop OpenGL rather
     9        than ANGLE. Fix some calls which were using ANGLE's OpenGL ES 3.0
     10        entry points rather than the OpenGL ES 2.0 extension APIs, causing
     11        them to generate errors in WebGL 1.0's backend. Change
     12        Extensions3DANGLE to use ANGLE's requestable extension mechanism.
     13
     14        Fix framebuffer setup when using ANGLE for WebGL 1.0 contexts, for
     15        both antialias:true and false.
     16
     17        Remove ANGLEWebKitBridge in ANGLE backend. It interfered with the
     18        correct operation of ANGLE's internal shader compiler, and was
     19        unnecessary given the use of ANGLE. Remove all manual shader name
     20        hashing and mapping in ANGLE backend.
     21
     22        Tested with parts of the WebGL conformance suite and the San
     23        Angeles demo, which now runs properly with WebKit's ANGLE backend
     24        for WebGL.
     25
     26        * html/canvas/WebGLRenderingContextBase.cpp:
     27        (WebCore::WebGLRenderingContextBase::getProgramParameter):
     28        (WebCore::WebGLRenderingContextBase::getUniformLocation):
     29        (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
     30        * platform/graphics/GraphicsContext3D.h:
     31        * platform/graphics/angle/Extensions3DANGLE.cpp:
     32        (WebCore::Extensions3DANGLE::Extensions3DANGLE):
     33        (WebCore::Extensions3DANGLE::supports):
     34        (WebCore::Extensions3DANGLE::ensureEnabled):
     35        (WebCore::Extensions3DANGLE::isEnabled):
     36        (WebCore::Extensions3DANGLE::getTranslatedShaderSourceANGLE):
     37        (WebCore::Extensions3DANGLE::initializeAvailableExtensions):
     38        (WebCore::Extensions3DANGLE::blitFramebuffer):
     39        (WebCore::Extensions3DANGLE::renderbufferStorageMultisample):
     40        (WebCore::Extensions3DANGLE::createVertexArrayOES):
     41        (WebCore::Extensions3DANGLE::deleteVertexArrayOES):
     42        (WebCore::Extensions3DANGLE::isVertexArrayOES):
     43        (WebCore::Extensions3DANGLE::bindVertexArrayOES):
     44        (WebCore::Extensions3DANGLE::supportsExtension):
     45        (WebCore::Extensions3DANGLE::drawBuffersEXT):
     46        (WebCore::Extensions3DANGLE::drawArraysInstanced):
     47        (WebCore::Extensions3DANGLE::drawElementsInstanced):
     48        (WebCore::Extensions3DANGLE::vertexAttribDivisor):
     49        * platform/graphics/angle/Extensions3DANGLE.h:
     50        * platform/graphics/angle/GraphicsContext3DANGLE.cpp:
     51        (WebCore::GraphicsContext3D::validateAttributes):
     52        (WebCore::GraphicsContext3D::reshapeFBOs):
     53        (WebCore::GraphicsContext3D::attachDepthAndStencilBufferIfNeeded):
     54        (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
     55        (WebCore::GraphicsContext3D::validateDepthStencil):
     56        (WebCore::GraphicsContext3D::prepareTexture):
     57        (WebCore::GraphicsContext3D::attachShader):
     58        (WebCore::GraphicsContext3D::bindAttribLocation):
     59        (WebCore::GraphicsContext3D::compileShader):
     60        (WebCore::GraphicsContext3D::compileShaderDirect):
     61        (WebCore::GraphicsContext3D::detachShader):
     62        (WebCore::GraphicsContext3D::getActiveAttribImpl):
     63        (WebCore::GraphicsContext3D::getActiveAttrib):
     64        (WebCore::GraphicsContext3D::getActiveUniformImpl):
     65        (WebCore::GraphicsContext3D::getActiveUniform):
     66        (WebCore::GraphicsContext3D::getAttribLocation):
     67        (WebCore::GraphicsContext3D::getAttribLocationDirect):
     68        (WebCore::GraphicsContext3D::moveErrorsToSyntheticErrorList):
     69        (WebCore::GraphicsContext3D::linkProgram):
     70        (WebCore::GraphicsContext3D::shaderSource):
     71        (WebCore::GraphicsContext3D::getUnmangledInfoLog):
     72        (WebCore::GraphicsContext3D::getShaderiv):
     73        (WebCore::GraphicsContext3D::getShaderInfoLog):
     74        (WebCore::GraphicsContext3D::getUniformLocation):
     75        (WebCore::GraphicsContext3D::createBuffer):
     76        (WebCore::GraphicsContext3D::createFramebuffer):
     77        (WebCore::GraphicsContext3D::createProgram):
     78        (WebCore::GraphicsContext3D::createRenderbuffer):
     79        (WebCore::GraphicsContext3D::createShader):
     80        (WebCore::GraphicsContext3D::createTexture):
     81        (WebCore::GraphicsContext3D::deleteBuffer):
     82        (WebCore::GraphicsContext3D::deleteFramebuffer):
     83        (WebCore::GraphicsContext3D::deleteProgram):
     84        (WebCore::GraphicsContext3D::deleteRenderbuffer):
     85        (WebCore::GraphicsContext3D::deleteShader):
     86        (WebCore::GraphicsContext3D::deleteTexture):
     87        (WebCore::GraphicsContext3D::synthesizeGLError):
     88        (): Deleted.
     89        (WebCore::setCurrentNameHashMapForShader): Deleted.
     90        (WebCore::nameHashForShader): Deleted.
     91        (WebCore::GraphicsContext3D::checkVaryingsPacking const): Deleted.
     92        (WebCore::GraphicsContext3D::precisionsMatch const): Deleted.
     93        (WebCore::generateHashedName): Deleted.
     94        (WebCore::GraphicsContext3D::mappedSymbolInShaderSourceMap): Deleted.
     95        (WebCore::GraphicsContext3D::mappedSymbolName): Deleted.
     96        (WebCore::GraphicsContext3D::originalSymbolInShaderSourceMap): Deleted.
     97        (WebCore::GraphicsContext3D::originalSymbolName): Deleted.
     98        (WebCore::GraphicsContext3D::getNonBuiltInActiveSymbolCount): Deleted.
     99        (WebCore::GraphicsContext3D::getShaderSource): Deleted.
     100        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
     101        (WebCore::GraphicsContext3D::GraphicsContext3D):
     102        (WebCore::GraphicsContext3D::~GraphicsContext3D):
     103        (WebCore::GraphicsContext3D::makeContextCurrent):
     104        (WebCore::GraphicsContext3D::checkGPUStatus):
     105        (WebCore::GraphicsContext3D::allocateIOSurfaceBackingStore):
     106        (WebCore::GraphicsContext3D::updateFramebufferTextureBackingStoreFromLayer):
     107        * platform/graphics/cocoa/WebGLLayer.h:
     108        * platform/graphics/cocoa/WebGLLayer.mm:
     109        (-[WebGLLayer initWithGraphicsContext3D:]):
     110        (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
     111        (-[WebGLLayer display]):
     112        (-[WebGLLayer setEGLDisplay:andConfig:]):
     113        (-[WebGLLayer dealloc]):
     114        (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
     115        (-[WebGLLayer bindFramebufferToNextAvailableSurface]):
     116
    11172019-07-10  Youenn Fablet  <youenn@apple.com>
    2118
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r243887 r247315  
    26762676    case GraphicsContext3D::ACTIVE_ATTRIBUTES:
    26772677    case GraphicsContext3D::ACTIVE_UNIFORMS:
     2678#if USE(ANGLE)
     2679        m_context->getProgramiv(objectOrZero(program), pname, &value);
     2680#else
    26782681        m_context->getNonBuiltInActiveSymbolCount(objectOrZero(program), pname, &value);
     2682#endif // USE(ANGLE)
    26792683        return value;
    26802684    default:
     
    29952999
    29963000    GC3Dint activeUniforms = 0;
     3001#if USE(ANGLE)
     3002    m_context->getProgramiv(objectOrZero(program), GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);
     3003#else
    29973004    m_context->getNonBuiltInActiveSymbolCount(objectOrZero(program), GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);
     3005#endif
    29983006    for (GC3Dint i = 0; i < activeUniforms; i++) {
    29993007        ActiveInfo info;
     
    32093217    RefPtr<WebGLShader> vertexShader = program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
    32103218    RefPtr<WebGLShader> fragmentShader = program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
    3211     if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid() || !m_context->precisionsMatch(objectOrZero(vertexShader.get()), objectOrZero(fragmentShader.get())) || !m_context->checkVaryingsPacking(objectOrZero(vertexShader.get()), objectOrZero(fragmentShader.get()))) {
     3219    if (!vertexShader || !vertexShader->isValid() || !fragmentShader || !fragmentShader->isValid()) {
    32123220        program->setLinkStatus(false);
    32133221        return false;
    32143222    }
     3223
     3224#if !USE(ANGLE)
     3225    if (!m_context->precisionsMatch(objectOrZero(vertexShader.get()), objectOrZero(fragmentShader.get()))
     3226        || !m_context->checkVaryingsPacking(objectOrZero(vertexShader.get()), objectOrZero(fragmentShader.get()))) {
     3227        program->setLinkStatus(false);
     3228        return false;
     3229    }
     3230#endif
    32153231
    32163232    m_context->linkProgram(objectOrZero(program));
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r246554 r247315  
    7272#if USE(ANGLE)
    7373typedef void* PlatformGraphicsContext3D;
     74typedef void* PlatformGraphicsContext3DDisplay;
     75typedef void* PlatformGraphicsContext3DSurface;
     76typedef void* PlatformGraphicsContext3DConfig;
    7477#endif // USE(ANGLE)
    7578
     
    10551058    void getInteger64v(GC3Denum pname, GC3Dint64* value);
    10561059    void getProgramiv(Platform3DObject program, GC3Denum pname, GC3Dint* value);
     1060#if !USE(ANGLE)
    10571061    void getNonBuiltInActiveSymbolCount(Platform3DObject program, GC3Denum pname, GC3Dint* value);
     1062#endif // !USE(ANGLE)
    10581063    String getProgramInfoLog(Platform3DObject);
    10591064    String getUnmangledInfoLog(Platform3DObject[2], GC3Dsizei, const String&);
     
    10621067    String getShaderInfoLog(Platform3DObject);
    10631068    void getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType, GC3Dint* range, GC3Dint* precision);
     1069#if !USE(ANGLE)
    10641070    String getShaderSource(Platform3DObject);
     1071#endif // !USE(ANGLE)
    10651072    String getString(GC3Denum name);
    10661073    void getTexParameterfv(GC3Denum target, GC3Denum pname, GC3Dfloat* value);
     
    11281135    void useProgram(Platform3DObject);
    11291136    void validateProgram(Platform3DObject);
     1137#if !USE(ANGLE)
    11301138    bool checkVaryingsPacking(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
    11311139    bool precisionsMatch(Platform3DObject vertexShader, Platform3DObject fragmentShader) const;
     1140#endif
    11321141
    11331142    void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
     
    11861195    void updateFramebufferTextureBackingStoreFromLayer();
    11871196    void updateCGLContext();
     1197#endif
     1198
     1199#if USE(ANGLE) && PLATFORM(MAC)
     1200    void allocateIOSurfaceBackingStore(IntSize);
     1201    void updateFramebufferTextureBackingStoreFromLayer();
    11881202#endif
    11891203#endif // PLATFORM(COCOA)
     
    13631377    RetainPtr<WebGLLayer> m_webGLLayer;
    13641378    PlatformGraphicsContext3D m_contextObj { nullptr };
    1365 #endif
     1379#if USE(ANGLE)
     1380    PlatformGraphicsContext3DDisplay m_displayObj { nullptr };
     1381#endif // USE(ANGLE)
     1382#endif // PLATFORM(COCOA)
    13661383
    13671384#if PLATFORM(WIN) && USE(CA)
     
    13971414    };
    13981415
     1416#if !USE(ANGLE)
    13991417    // FIXME: Shaders are never removed from this map, even if they and their program are deleted.
    14001418    // This is bad, and it also relies on the fact we never reuse Platform3DObject numbers.
     
    14351453
    14361454    std::unique_ptr<ShaderNameHash> nameHashMapForShaders;
     1455#endif // !USE(ANGLE)
    14371456
    14381457#if !PLATFORM(COCOA) && USE(OPENGL_ES)
     
    14541473    Vector<Vector<float>> m_vertexArray;
    14551474
     1475#if !USE(ANGLE)
    14561476    ANGLEWebKitBridge m_compiler;
     1477#endif
    14571478
    14581479    GC3Duint m_texture { 0 };
     
    14691490    bool m_layerComposited { false };
    14701491    GC3Duint m_internalColorFormat { 0 };
     1492
     1493#if USE(ANGLE)
     1494    PlatformGraphicsContext3DSurface m_pbuffer;
     1495#endif
    14711496
    14721497    struct GraphicsContext3DState {
  • trunk/Source/WebCore/platform/graphics/angle/Extensions3DANGLE.cpp

    r246554 r247315  
    3333#include <ANGLE/entry_points_gles_2_0_autogen.h>
    3434#include <ANGLE/entry_points_gles_3_0_autogen.h>
     35// Skip the inclusion of ANGLE's explicit context entry points for now.
     36#define GL_ANGLE_explicit_context
     37#define GL_ANGLE_explicit_context_gles1
     38typedef void* GLeglContext;
     39#include <ANGLE/entry_points_gles_ext_autogen.h>
    3540
    3641// Note: this file can't be compiled in the same unified source file
     
    5257    // FIXME: ideally, remove this initialization altogether. ANGLE
    5358    // subsumes the responsibility for graphics driver workarounds.
    54     m_vendor = String(reinterpret_cast<const char*>(::glGetString(GL_VENDOR)));
    55     m_renderer = String(reinterpret_cast<const char*>(::glGetString(GL_RENDERER)));
     59    m_vendor = String(reinterpret_cast<const char*>(gl::GetString(GL_VENDOR)));
     60    m_renderer = String(reinterpret_cast<const char*>(gl::GetString(GL_RENDERER)));
    5661
    5762    Vector<String> vendorComponents = m_vendor.convertToASCIILowercase().split(' ');
     
    7378        initializeAvailableExtensions();
    7479
    75     // We explicitly do not support this extension until
    76     // we fix the following bug:
    77     // https://bugs.webkit.org/show_bug.cgi?id=149734
    78     // FIXME: given that ANGLE is in use, rewrite this in terms of
    79     // ANGLE queries and enable this extension.
    80     if (name == "GL_ANGLE_translated_shader_source")
    81         return false;
    82 
    8380    return supportsExtension(name);
    8481}
     
    8683void Extensions3DANGLE::ensureEnabled(const String& name)
    8784{
    88     if (name == "GL_OES_standard_derivatives") {
    89         // Enable support in ANGLE (if not enabled already).
    90         ANGLEWebKitBridge& compiler = m_context->m_compiler;
    91         ShBuiltInResources ANGLEResources = compiler.getResources();
    92         if (!ANGLEResources.OES_standard_derivatives) {
    93             ANGLEResources.OES_standard_derivatives = 1;
    94             compiler.setResources(ANGLEResources);
    95         }
    96     } else if (name == "GL_EXT_draw_buffers") {
    97         // Enable support in ANGLE (if not enabled already).
    98         ANGLEWebKitBridge& compiler = m_context->m_compiler;
    99         ShBuiltInResources ANGLEResources = compiler.getResources();
    100         if (!ANGLEResources.EXT_draw_buffers) {
    101             ANGLEResources.EXT_draw_buffers = 1;
    102             m_context->getIntegerv(Extensions3D::MAX_DRAW_BUFFERS_EXT, &ANGLEResources.MaxDrawBuffers);
    103             compiler.setResources(ANGLEResources);
    104         }
    105     } else if (name == "GL_EXT_shader_texture_lod") {
    106         // Enable support in ANGLE (if not enabled already).
    107         ANGLEWebKitBridge& compiler = m_context->m_compiler;
    108         ShBuiltInResources ANGLEResources = compiler.getResources();
    109         if (!ANGLEResources.EXT_shader_texture_lod) {
    110             ANGLEResources.EXT_shader_texture_lod = 1;
    111             compiler.setResources(ANGLEResources);
    112         }
    113     } else if (name == "GL_EXT_frag_depth") {
    114         // Enable support in ANGLE (if not enabled already).
    115         ANGLEWebKitBridge& compiler = m_context->m_compiler;
    116         ShBuiltInResources ANGLEResources = compiler.getResources();
    117         if (!ANGLEResources.EXT_frag_depth) {
    118             ANGLEResources.EXT_frag_depth = 1;
    119             compiler.setResources(ANGLEResources);
    120         }
     85    // Enable support in ANGLE (if not enabled already).
     86    if (m_requestableExtensions.contains(name) && !m_enabledExtensions.contains(name)) {
     87        m_context->makeContextCurrent();
     88        gl::RequestExtensionANGLE(name.ascii().data());
     89        m_enabledExtensions.add(name);
    12190    }
    12291}
     
    12493bool Extensions3DANGLE::isEnabled(const String& name)
    12594{
    126     if (name == "GL_OES_standard_derivatives") {
    127         ANGLEWebKitBridge& compiler = m_context->m_compiler;
    128         return compiler.getResources().OES_standard_derivatives;
    129     }
    130     return supports(name);
     95    return m_availableExtensions.contains(name) || m_enabledExtensions.contains(name);
    13196}
    13297
     
    138103String Extensions3DANGLE::getTranslatedShaderSourceANGLE(Platform3DObject shader)
    139104{
    140     // FIXME: port to use ANGLE's implementation directly.
    141     ASSERT(shader);
    142     int GLshaderType;
    143     ANGLEShaderType shaderType;
    144 
    145     ANGLEWebKitBridge& compiler = m_context->m_compiler;
    146 
    147     m_context->getShaderiv(shader, GraphicsContext3D::SHADER_TYPE, &GLshaderType);
    148 
    149     if (GLshaderType == GraphicsContext3D::VERTEX_SHADER)
    150         shaderType = SHADER_TYPE_VERTEX;
    151     else if (GLshaderType == GraphicsContext3D::FRAGMENT_SHADER)
    152         shaderType = SHADER_TYPE_FRAGMENT;
    153     else
    154         return emptyString(); // Invalid shader type.
    155 
    156     HashMap<Platform3DObject, GraphicsContext3D::ShaderSourceEntry>::iterator result = m_context->m_shaderSourceMap.find(shader);
    157 
    158     if (result == m_context->m_shaderSourceMap.end())
     105    int sourceLength = 0;
     106    m_context->getShaderiv(shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &sourceLength);
     107    if (!sourceLength)
    159108        return emptyString();
    160 
    161     GraphicsContext3D::ShaderSourceEntry& entry = result->value;
    162 
    163     String translatedShaderSource;
    164     String shaderInfoLog;
    165     uint64_t extraCompileOptions = SH_CLAMP_INDIRECT_ARRAY_BOUNDS | SH_UNFOLD_SHORT_CIRCUIT | SH_INIT_OUTPUT_VARIABLES | SH_ENFORCE_PACKING_RESTRICTIONS | SH_LIMIT_EXPRESSION_COMPLEXITY | SH_LIMIT_CALL_STACK_DEPTH | SH_INITIALIZE_UNINITIALIZED_LOCALS;
    166 
    167     if (m_requiresBuiltInFunctionEmulation)
    168         extraCompileOptions |= SH_EMULATE_ABS_INT_FUNCTION;
    169 
    170     Vector<std::pair<ANGLEShaderSymbolType, sh::ShaderVariable>> symbols;
    171     bool isValid = compiler.compileShaderSource(entry.source.utf8().data(), shaderType, translatedShaderSource, shaderInfoLog, symbols, extraCompileOptions);
    172 
    173     entry.log = shaderInfoLog;
    174     entry.isValid = isValid;
    175 
    176     for (const std::pair<ANGLEShaderSymbolType, sh::ShaderVariable>& pair : symbols) {
    177         const std::string& name = pair.second.name;
    178         entry.symbolMap(pair.first).set(String(name.c_str(), name.length()), pair.second);
    179     }
    180 
    181     if (!isValid)
     109    Vector<GLchar> name(sourceLength); // GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE includes null termination.
     110    int returnedLength = 0;
     111    gl::GetTranslatedShaderSourceANGLE(shader, sourceLength, &returnedLength, name.data());
     112    if (!returnedLength)
    182113        return emptyString();
    183 
    184     return translatedShaderSource;
     114    ASSERT(returnedLength == sourceLength);
     115    return String(name.data(), returnedLength);
    185116}
    186117
     
    191122        gl::GetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
    192123        for (GLint i = 0; i < numExtensions; ++i)
    193             m_availableExtensions.add(glGetStringi(GL_EXTENSIONS, i));
     124            m_availableExtensions.add(gl::GetStringi(GL_EXTENSIONS, i));
     125        gl::GetIntegerv(GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE, &numExtensions);
     126        for (GLint i = 0; i < numExtensions; ++i)
     127            m_requestableExtensions.add(gl::GetStringi(GL_REQUESTABLE_EXTENSIONS_ANGLE, i));
    194128    } else {
    195129        String extensionsString = getExtensions();
    196130        for (auto& extension : extensionsString.split(' '))
    197131            m_availableExtensions.add(extension);
     132        extensionsString = String(reinterpret_cast<const char*>(gl::GetString(GL_REQUESTABLE_EXTENSIONS_ANGLE)));
     133        for (auto& extension : extensionsString.split(' '))
     134            m_requestableExtensions.add(extension);
    198135    }
    199136    m_initializedAvailableExtensions = true;
     
    218155{
    219156    // FIXME: consider adding support for APPLE_framebuffer_multisample.
    220     gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
     157    gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
    221158}
    222159
    223160void Extensions3DANGLE::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
    224161{
    225     gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
     162    gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
    226163}
    227164
     
    230167    m_context->makeContextCurrent();
    231168    GLuint array = 0;
    232     gl::GenVertexArrays(1, &array);
     169    gl::GenVertexArraysOES(1, &array);
    233170    return array;
    234171}
     
    240177
    241178    m_context->makeContextCurrent();
    242     gl::DeleteVertexArrays(1, &array);
     179    gl::DeleteVertexArraysOES(1, &array);
    243180}
    244181
     
    249186
    250187    m_context->makeContextCurrent();
    251     return gl::IsVertexArray(array);
     188    return gl::IsVertexArrayOES(array);
    252189}
    253190
     
    255192{
    256193    m_context->makeContextCurrent();
    257     gl::BindVertexArray(array);
     194    gl::BindVertexArrayOES(array);
    258195}
    259196
     
    278215bool Extensions3DANGLE::supportsExtension(const String& name)
    279216{
    280     return m_availableExtensions.contains(name);
     217    return m_availableExtensions.contains(name) || m_requestableExtensions.contains(name);
    281218}
    282219
    283220void Extensions3DANGLE::drawBuffersEXT(GC3Dsizei n, const GC3Denum* bufs)
    284221{
    285     gl::DrawBuffers(n, bufs);
     222    gl::DrawBuffersEXT(n, bufs);
    286223}
    287224
     
    289226{
    290227    m_context->makeContextCurrent();
    291     gl::DrawArraysInstanced(mode, first, count, primcount);
     228    gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
    292229}
    293230
     
    295232{
    296233    m_context->makeContextCurrent();
    297     gl::DrawElementsInstanced(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
     234    gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
    298235}
    299236
     
    301238{
    302239    m_context->makeContextCurrent();
    303     gl::VertexAttribDivisor(index, divisor);
     240    gl::VertexAttribDivisorANGLE(index, divisor);
    304241}
    305242
  • trunk/Source/WebCore/platform/graphics/angle/Extensions3DANGLE.h

    r246554 r247315  
    8585    bool m_initializedAvailableExtensions;
    8686    HashSet<String> m_availableExtensions;
     87    HashSet<String> m_requestableExtensions;
     88    HashSet<String> m_enabledExtensions;
    8789
    8890    // Weak pointer back to GraphicsContext3D.
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContext3DANGLE.cpp

    r246554 r247315  
    5353#endif
    5454
     55// Skip the inclusion of ANGLE's explicit context entry points for now.
     56#define GL_ANGLE_explicit_context
     57#define GL_ANGLE_explicit_context_gles1
     58typedef void* GLeglContext;
    5559#include <ANGLE/entry_points_gles_2_0_autogen.h>
    5660#include <ANGLE/entry_points_gles_3_0_autogen.h>
     61#include <ANGLE/entry_points_gles_ext_autogen.h>
     62#include <ANGLE/gl2ext.h>
     63#include <ANGLE/gl2ext_angle.h>
    5764
    5865// Note: this file can't be compiled in the same unified source file
     
    6471
    6572namespace WebCore {
     73
     74static const char* packedDepthStencilExtensionName = "GL_OES_packed_depth_stencil";
    6675
    6776void GraphicsContext3D::releaseShaderCompiler()
     
    116125void GraphicsContext3D::validateAttributes()
    117126{
    118     validateDepthStencil("GL_EXT_packed_depth_stencil");
     127    validateDepthStencil(packedDepthStencilExtensionName);
    119128}
    120129
     
    138147        // Use a 24 bit depth buffer where we know we have it.
    139148        if (extensions.supports("GL_OES_packed_depth_stencil"))
    140             internalDepthStencilFormat = GL_DEPTH24_STENCIL8;
     149            internalDepthStencilFormat = GL_DEPTH24_STENCIL8_OES;
    141150        else
    142151            internalDepthStencilFormat = GL_DEPTH_COMPONENT16;
     
    146155    if (m_attrs.antialias) {
    147156        GLint maxSampleCount;
    148         gl::GetIntegerv(GL_MAX_SAMPLES_EXT, &maxSampleCount);
     157        gl::GetIntegerv(GL_MAX_SAMPLES_ANGLE, &maxSampleCount);
    149158        // Using more than 4 samples is slow on some hardware and is unlikely to
    150159        // produce a significantly better result.
     
    152161        gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
    153162        gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer);
    154         gl::RenderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_RGBA8, width, height);
     163        getExtensions().renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, GL_RGBA8, width, height);
    155164        gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
    156165        if (m_attrs.stencil || m_attrs.depth) {
    157166            gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
    158             gl::RenderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height);
    159             if (m_attrs.stencil)
    160                 gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
    161             if (m_attrs.depth)
    162                 gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
     167            getExtensions().renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height);
     168            // WebGL 1.0's rules state that combined depth/stencil renderbuffers
     169            // have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT point.
     170            if (!isGLES2Compliant() && internalDepthStencilFormat == GL_DEPTH24_STENCIL8_OES)
     171                gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
     172            else {
     173                if (m_attrs.stencil)
     174                    gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
     175                if (m_attrs.depth)
     176                    gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
     177            }
    163178        }
    164179        gl::BindRenderbuffer(GL_RENDERBUFFER, 0);
    165         if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
     180        if (gl::CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
    166181            // FIXME: cleanup.
    167182            notImplemented();
     
    175190
    176191#if PLATFORM(MAC)
    177     // FIXME: implement back buffer path using ANGLE and pbuffers.
    178     // allocateIOSurfaceBackingStore(IntSize(width, height));
    179     // updateFramebufferTextureBackingStoreFromLayer();
    180     // gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ARB, m_texture, 0);
     192    allocateIOSurfaceBackingStore(IntSize(width, height));
     193    updateFramebufferTextureBackingStoreFromLayer();
     194    gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE_ANGLE, m_texture, 0);
    181195#elif PLATFORM(IOS_FAMILY)
    182196    // FIXME (kbr): implement iOS path, ideally using glFramebufferTexture2DMultisample.
     
    185199    // setRenderbufferStorageFromDrawable(m_currentWidth, m_currentHeight);
    186200#else
    187 #error Unknown platform
     201#error Unknown Cocoa platform
    188202#endif
    189203#else
    190     gl::BindTexture(GL_TEXTURE_2D, m_texture);
    191     gl::TexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
    192     gl::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0);
    193 
    194 #if USE(COORDINATED_GRAPHICS)
    195     if (m_compositorTexture) {
    196         gl::BindTexture(GL_TEXTURE_2D, m_compositorTexture);
    197         gl::TexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
    198         gl::BindTexture(GL_TEXTURE_2D, 0);
    199         gl::BindTexture(GL_TEXTURE_2D, m_intermediateTexture);
    200         gl::TexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
    201         gl::BindTexture(GL_TEXTURE_2D, 0);
    202     }
    203 #endif
     204
     205#error Must port to non-Cocoa platforms
     206
    204207#endif // PLATFORM(COCOA)
    205208
     
    224227        gl::BindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
    225228        gl::RenderbufferStorage(GL_RENDERBUFFER, internalDepthStencilFormat, width, height);
    226         if (m_attrs.stencil)
    227             gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
    228         if (m_attrs.depth)
    229             gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
     229        // WebGL 1.0's rules state that combined depth/stencil renderbuffers
     230        // have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT point.
     231        if (!isGLES2Compliant() && internalDepthStencilFormat == GL_DEPTH24_STENCIL8_OES)
     232            gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
     233        else {
     234            if (m_attrs.stencil)
     235                gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
     236            if (m_attrs.depth)
     237                gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
     238        }
    230239        gl::BindRenderbuffer(GL_RENDERBUFFER, 0);
    231240    }
    232241
    233     if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
     242    if (gl::CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
    234243        // FIXME: cleanup
    235244        notImplemented();
     
    241250    TemporaryANGLESetting scopedScissor(GL_SCISSOR_TEST, GL_FALSE);
    242251    TemporaryANGLESetting scopedDither(GL_DITHER, GL_FALSE);
    243     TemporaryANGLESetting scopedDepth(GL_DEPTH_TEST, GL_FALSE);
    244     TemporaryANGLESetting scopedStencil(GL_STENCIL_TEST, GL_FALSE);
     252
     253    GLint boundFrameBuffer;
     254    gl::GetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFrameBuffer);
     255    gl::BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_multisampleFBO);
     256    gl::BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_fbo);
    245257
    246258    // FIXME: figure out more efficient solution for iOS.
    247259    IntRect resolveRect = rect;
    248     if (rect.isEmpty())
     260    // When using an ES 2.0 context, the full framebuffer must always be
     261    // resolved; partial blits are not allowed.
     262    if (!isGLES2Compliant() || rect.isEmpty())
    249263        resolveRect = IntRect(0, 0, m_currentWidth, m_currentHeight);
    250264
    251     gl::BlitFramebuffer(resolveRect.x(), resolveRect.y(), resolveRect.maxX(), resolveRect.maxY(), resolveRect.x(), resolveRect.y(), resolveRect.maxX(), resolveRect.maxY(), GL_COLOR_BUFFER_BIT, GL_LINEAR);
     265    gl::BlitFramebufferANGLE(resolveRect.x(), resolveRect.y(), resolveRect.maxX(), resolveRect.maxY(), resolveRect.x(), resolveRect.y(), resolveRect.maxX(), resolveRect.maxY(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
     266    gl::BindFramebuffer(GL_FRAMEBUFFER, boundFrameBuffer);
    252267}
    253268
     
    376391// The contents of GraphicsContext3DOpenGLCommon follow, ported to use ANGLE.
    377392
    378 static ThreadSpecific<ShaderNameHash*>& getCurrentNameHashMapForShader()
    379 {
    380     static std::once_flag onceFlag;
    381     static ThreadSpecific<ShaderNameHash*>* sharedNameHash;
    382     std::call_once(onceFlag, [] {
    383         sharedNameHash = new ThreadSpecific<ShaderNameHash*>;
    384     });
    385 
    386     return *sharedNameHash;
    387 }
    388 
    389 static void setCurrentNameHashMapForShader(ShaderNameHash* shaderNameHash)
    390 {
    391     *getCurrentNameHashMapForShader() = shaderNameHash;
    392 }
    393 
    394 // Hash function used by the ANGLE translator/compiler to do
    395 // symbol name mangling. Since this is a static method, before
    396 // calling compileShader we set currentNameHashMapForShader
    397 // to point to the map kept by the current instance of GraphicsContext3D.
    398 
    399 static uint64_t nameHashForShader(const char* name, size_t length)
    400 {
    401     if (!length)
    402         return 0;
    403 
    404     CString nameAsCString = CString(name);
    405 
    406     // Look up name in our local map.
    407     ShaderNameHash*& currentNameHashMapForShader = *getCurrentNameHashMapForShader();
    408     ShaderNameHash::iterator findResult = currentNameHashMapForShader->find(nameAsCString);
    409     if (findResult != currentNameHashMapForShader->end())
    410         return findResult->value;
    411 
    412     unsigned hashValue = nameAsCString.hash();
    413 
    414     // Convert the 32-bit hash from CString::hash into a 64-bit result
    415     // by shifting then adding the size of our table. Overflow would
    416     // only be a problem if we're already hashing to the same value (and
    417     // we're hoping that over the lifetime of the context we
    418     // don't have that many symbols).
    419 
    420     uint64_t result = hashValue;
    421     result = (result << 32) + (currentNameHashMapForShader->size() + 1);
    422 
    423     currentNameHashMapForShader->set(nameAsCString, result);
    424     return result;
    425 }
    426 
    427393void GraphicsContext3D::validateDepthStencil(const char* packedDepthStencilExtension)
    428394{
     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.
    429399    Extensions3D& extensions = getExtensions();
    430400    if (m_attrs.stencil) {
    431401        if (extensions.supports(packedDepthStencilExtension)) {
    432             extensions.ensureEnabled(packedDepthStencilExtension);
    433402            // Force depth if stencil is true.
    434403            m_attrs.depth = true;
    435404        } else
    436405            m_attrs.stencil = false;
     406
    437407    }
    438408    if (m_attrs.antialias) {
    439         if (!extensions.supports("GL_ANGLE_framebuffer_multisample") || isGLES2Compliant())
     409        // FIXME: must adjust this when upgrading to WebGL 2.0 / OpenGL ES 3.0 support.
     410        if (!extensions.supports("GL_ANGLE_framebuffer_multisample") || !extensions.supports("GL_ANGLE_framebuffer_blit") || !extensions.supports("GL_OES_rgb8_rgba8") || isGLES2Compliant())
    440411            m_attrs.antialias = false;
    441         else
    442             extensions.ensureEnabled("GL_ANGLE_framebuffer_multisample");
    443412    }
    444413}
     
    514483    makeContextCurrent();
    515484
    516 #if !USE(COORDINATED_GRAPHICS)
    517     TemporaryANGLESetting scopedScissor(GL_SCISSOR_TEST, GL_FALSE);
    518     TemporaryANGLESetting scopedDither(GL_DITHER, GL_FALSE);
    519 #endif
    520 
    521485    if (m_attrs.antialias)
    522486        resolveMultisamplingIfNecessary();
    523487
    524 #if USE(COORDINATED_GRAPHICS)
    525     std::swap(m_texture, m_compositorTexture);
    526     std::swap(m_texture, m_intermediateTexture);
    527     gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
    528     gl::FramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture, 0);
    529     glFlush();
    530 
    531     if (m_state.boundFBO != m_fbo)
    532         gl::BindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
    533     else
    534         gl::BindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo);
    535     return;
    536 #endif
    537 
    538     gl::ActiveTexture(GL_TEXTURE0);
    539     gl::BindTexture(GL_TEXTURE_2D, m_state.boundTarget(GL_TEXTURE0) == GL_TEXTURE_2D ? m_state.boundTexture(GL_TEXTURE0) : 0);
    540     gl::ActiveTexture(m_state.activeTextureUnit);
    541     if (m_state.boundFBO != m_fbo)
    542         gl::BindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO);
    543488    gl::Flush();
    544489}
     
    652597}
    653598
    654 bool GraphicsContext3D::checkVaryingsPacking(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
    655 {
    656     ASSERT(m_shaderSourceMap.contains(vertexShader));
    657     ASSERT(m_shaderSourceMap.contains(fragmentShader));
    658     const auto& vertexEntry = m_shaderSourceMap.find(vertexShader)->value;
    659     const auto& fragmentEntry = m_shaderSourceMap.find(fragmentShader)->value;
    660 
    661     HashMap<String, sh::ShaderVariable> combinedVaryings;
    662     for (const auto& vertexSymbol : vertexEntry.varyingMap) {
    663         const String& symbolName = vertexSymbol.key;
    664         // The varying map includes variables for each index of an array variable.
    665         // We only want a single variable to represent the array.
    666         if (symbolName.endsWith("]"))
    667             continue;
    668 
    669         // Don't count built in varyings.
    670         if (symbolName == "gl_FragCoord" || symbolName == "gl_FrontFacing" || symbolName == "gl_PointCoord")
    671             continue;
    672 
    673         const auto& fragmentSymbol = fragmentEntry.varyingMap.find(symbolName);
    674         if (fragmentSymbol != fragmentEntry.varyingMap.end())
    675             combinedVaryings.add(symbolName, fragmentSymbol->value);
    676     }
    677 
    678     size_t numVaryings = combinedVaryings.size();
    679     if (!numVaryings)
    680         return true;
    681 
    682     std::vector<sh::ShaderVariable> variables;
    683     variables.reserve(combinedVaryings.size());
    684     for (const auto& varyingSymbol : combinedVaryings.values())
    685         variables.push_back(varyingSymbol);
    686 
    687     GC3Dint maxVaryingVectors = 0;
    688     gl::GetIntegerv(MAX_VARYING_VECTORS, &maxVaryingVectors);
    689     return sh::CheckVariablesWithinPackingLimits(maxVaryingVectors, variables);
    690 }
    691 
    692 bool GraphicsContext3D::precisionsMatch(Platform3DObject vertexShader, Platform3DObject fragmentShader) const
    693 {
    694     ASSERT(m_shaderSourceMap.contains(vertexShader));
    695     ASSERT(m_shaderSourceMap.contains(fragmentShader));
    696     const auto& vertexEntry = m_shaderSourceMap.find(vertexShader)->value;
    697     const auto& fragmentEntry = m_shaderSourceMap.find(fragmentShader)->value;
    698 
    699     HashMap<String, sh::GLenum> vertexSymbolPrecisionMap;
    700 
    701     for (const auto& entry : vertexEntry.uniformMap) {
    702         const std::string& mappedName = entry.value.mappedName;
    703         vertexSymbolPrecisionMap.add(String(mappedName.c_str(), mappedName.length()), entry.value.precision);
    704     }
    705 
    706     for (const auto& entry : fragmentEntry.uniformMap) {
    707         const std::string& mappedName = entry.value.mappedName;
    708         const auto& vertexSymbol = vertexSymbolPrecisionMap.find(String(mappedName.c_str(), mappedName.length()));
    709         if (vertexSymbol != vertexSymbolPrecisionMap.end() && vertexSymbol->value != entry.value.precision)
    710             return false;
    711     }
    712 
    713     return true;
    714 }
    715 
    716599IntSize GraphicsContext3D::getInternalFramebufferSize() const
    717600{
     
    731614    ASSERT(shader);
    732615    makeContextCurrent();
    733     m_shaderProgramSymbolCountMap.remove(program);
    734616    gl::AttachShader(program, shader);
    735617}
     
    739621    ASSERT(program);
    740622    makeContextCurrent();
    741 
    742     String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, name);
    743     LOG(WebGL, "::bindAttribLocation is mapping %s to %s", name.utf8().data(), mappedName.utf8().data());
    744     gl::BindAttribLocation(program, index, mappedName.utf8().data());
     623    gl::BindAttribLocation(program, index, name.utf8().data());
    745624}
    746625
     
    915794    ASSERT(shader);
    916795    makeContextCurrent();
    917 
    918     // Turn on name mapping. Due to the way ANGLE name hashing works, we
    919     // point a global hashmap to the map owned by this context.
    920     ShBuiltInResources ANGLEResources = m_compiler.getResources();
    921     ShHashFunction64 previousHashFunction = ANGLEResources.HashFunction;
    922     ANGLEResources.HashFunction = nameHashForShader;
    923 
    924     if (!nameHashMapForShaders)
    925         nameHashMapForShaders = std::make_unique<ShaderNameHash>();
    926     setCurrentNameHashMapForShader(nameHashMapForShaders.get());
    927     m_compiler.setResources(ANGLEResources);
    928 
    929     String translatedShaderSource = m_extensions->getTranslatedShaderSourceANGLE(shader);
    930 
    931     ANGLEResources.HashFunction = previousHashFunction;
    932     m_compiler.setResources(ANGLEResources);
    933     setCurrentNameHashMapForShader(nullptr);
    934 
    935     if (!translatedShaderSource.length())
    936         return;
    937 
    938     const CString& translatedShaderCString = translatedShaderSource.utf8();
    939     const char* translatedShaderPtr = translatedShaderCString.data();
    940     int translatedShaderLength = translatedShaderCString.length();
    941 
    942     LOG(WebGL, "--- begin original shader source ---\n%s\n--- end original shader source ---\n", getShaderSource(shader).utf8().data());
    943     LOG(WebGL, "--- begin translated shader source ---\n%s\n--- end translated shader source ---", translatedShaderPtr);
    944 
    945     gl::ShaderSource(shader, 1, &translatedShaderPtr, &translatedShaderLength);
    946 
    947     ::glCompileShader(shader);
    948 
    949     int compileStatus;
    950 
    951     gl::GetShaderiv(shader, COMPILE_STATUS, &compileStatus);
    952 
    953     ShaderSourceMap::iterator result = m_shaderSourceMap.find(shader);
    954     GraphicsContext3D::ShaderSourceEntry& entry = result->value;
    955 
    956     // Populate the shader log
    957     GLint length = 0;
    958     gl::GetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
    959 
    960     if (length) {
    961         GLsizei size = 0;
    962         Vector<GLchar> info(length);
    963         gl::GetShaderInfoLog(shader, length, &size, info.data());
    964 
    965         Platform3DObject shaders[2] = { shader, 0 };
    966         entry.log = getUnmangledInfoLog(shaders, 1, String(info.data(), size));
    967     }
    968 
    969     if (compileStatus != GL_TRUE) {
    970         entry.isValid = false;
    971         LOG(WebGL, "Error: shader translator produced a shader that OpenGL would not compile.");
    972     }
     796    gl::CompileShader(shader);
    973797}
    974798
    975799void GraphicsContext3D::compileShaderDirect(Platform3DObject shader)
    976800{
    977     ASSERT(shader);
    978     makeContextCurrent();
    979 
    980     HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader);
    981 
    982     if (result == m_shaderSourceMap.end())
    983         return;
    984 
    985     ShaderSourceEntry& entry = result->value;
    986 
    987     const CString& shaderSourceCString = entry.source.utf8();
    988     const char* shaderSourcePtr = shaderSourceCString.data();
    989     int shaderSourceLength = shaderSourceCString.length();
    990 
    991     LOG(WebGL, "--- begin direct shader source ---\n%s\n--- end direct shader source ---\n", shaderSourcePtr);
    992 
    993     gl::ShaderSource(shader, 1, &shaderSourcePtr, &shaderSourceLength);
    994 
    995     gl::CompileShader(shader);
    996 
    997     int compileStatus;
    998 
    999     gl::GetShaderiv(shader, COMPILE_STATUS, &compileStatus);
    1000 
    1001     if (compileStatus == GL_TRUE) {
    1002         entry.isValid = true;
    1003         LOG(WebGL, "Direct compilation of shader succeeded.");
    1004     } else {
    1005         entry.isValid = false;
    1006         LOG(WebGL, "Error: direct compilation of shader failed.");
    1007     }
     801    compileShader(shader);
    1008802}
    1009803
     
    1055849    ASSERT(shader);
    1056850    makeContextCurrent();
    1057     m_shaderProgramSymbolCountMap.remove(program);
    1058851    gl::DetachShader(program, shader);
    1059852}
     
    1151944        return false;
    1152945
    1153     String originalName = originalSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, String(name.data(), nameLength));
    1154 
    1155 #ifndef NDEBUG
    1156     String uniformName(name.data(), nameLength);
    1157     LOG(WebGL, "Program %d is mapping active attribute %d from '%s' to '%s'", program, index, uniformName.utf8().data(), originalName.utf8().data());
    1158 #endif
    1159 
    1160     info.name = originalName;
     946    info.name = String(name.data(), nameLength);
    1161947    info.type = type;
    1162948    info.size = size;
     
    1166952bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, GC3Duint index, ActiveInfo& info)
    1167953{
    1168     GC3Dint symbolCount;
    1169     auto result = m_shaderProgramSymbolCountMap.find(program);
    1170     if (result == m_shaderProgramSymbolCountMap.end()) {
    1171         getNonBuiltInActiveSymbolCount(program, GraphicsContext3D::ACTIVE_ATTRIBUTES, &symbolCount);
    1172         result = m_shaderProgramSymbolCountMap.find(program);
    1173     }
    1174 
    1175     ActiveShaderSymbolCounts& symbolCounts = result->value;
    1176     GC3Duint rawIndex = (index < symbolCounts.filteredToActualAttributeIndexMap.size()) ? symbolCounts.filteredToActualAttributeIndexMap[index] : -1;
    1177 
    1178     return getActiveAttribImpl(program, rawIndex, info);
     954    return getActiveAttribImpl(program, index, info);
    1179955}
    1180956
     
    1198974        return false;
    1199975
    1200     String originalName = originalSymbolName(program, SHADER_SYMBOL_TYPE_UNIFORM, String(name.data(), nameLength));
    1201 
    1202 #ifndef NDEBUG
    1203     String uniformName(name.data(), nameLength);
    1204     LOG(WebGL, "Program %d is mapping active uniform %d from '%s' to '%s'", program, index, uniformName.utf8().data(), originalName.utf8().data());
    1205 #endif
    1206 
    1207     info.name = originalName;
     976    info.name = String(name.data(), nameLength);
    1208977    info.type = type;
    1209978    info.size = size;
     
    1213982bool GraphicsContext3D::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info)
    1214983{
    1215     GC3Dint symbolCount;
    1216     auto result = m_shaderProgramSymbolCountMap.find(program);
    1217     if (result == m_shaderProgramSymbolCountMap.end()) {
    1218         getNonBuiltInActiveSymbolCount(program, GraphicsContext3D::ACTIVE_UNIFORMS, &symbolCount);
    1219         result = m_shaderProgramSymbolCountMap.find(program);
    1220     }
    1221    
    1222     ActiveShaderSymbolCounts& symbolCounts = result->value;
    1223     GC3Duint rawIndex = (index < symbolCounts.filteredToActualUniformIndexMap.size()) ? symbolCounts.filteredToActualUniformIndexMap[index] : -1;
    1224    
    1225     return getActiveUniformImpl(program, rawIndex, info);
     984    return getActiveUniformImpl(program, index, info);
    1226985}
    1227986
     
    1236995}
    1237996
    1238 static String generateHashedName(const String& name)
    1239 {
    1240     if (name.isEmpty())
    1241         return name;
    1242     uint64_t number = nameHashForShader(name.utf8().data(), name.length());
    1243     StringBuilder builder;
    1244     builder.appendLiteral("webgl_");
    1245     appendUnsignedAsHex(number, builder, Lowercase);
    1246     return builder.toString();
    1247 }
    1248 
    1249 Optional<String> GraphicsContext3D::mappedSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType symbolType, const String& name)
    1250 {
    1251     auto result = m_shaderSourceMap.find(shader);
    1252     if (result == m_shaderSourceMap.end())
    1253         return WTF::nullopt;
    1254 
    1255     const auto& symbolMap = result->value.symbolMap(symbolType);
    1256     auto symbolEntry = symbolMap.find(name);
    1257     if (symbolEntry == symbolMap.end())
    1258         return WTF::nullopt;
    1259 
    1260     auto& mappedName = symbolEntry->value.mappedName;
    1261     return String(mappedName.c_str(), mappedName.length());
    1262 }
    1263 
    1264 String GraphicsContext3D::mappedSymbolName(Platform3DObject program, ANGLEShaderSymbolType symbolType, const String& name)
    1265 {
    1266     GC3Dsizei count = 0;
    1267     Platform3DObject shaders[2] = { };
    1268     getAttachedShaders(program, 2, &count, shaders);
    1269 
    1270     for (GC3Dsizei i = 0; i < count; ++i) {
    1271         auto mappedName = mappedSymbolInShaderSourceMap(shaders[i], symbolType, name);
    1272         if (mappedName)
    1273             return mappedName.value();
    1274     }
    1275 
    1276     // We might have detached or deleted the shaders after linking.
    1277     auto result = m_linkedShaderMap.find(program);
    1278     if (result != m_linkedShaderMap.end()) {
    1279         auto linkedShaders = result->value;
    1280         auto mappedName = mappedSymbolInShaderSourceMap(linkedShaders.first, symbolType, name);
    1281         if (mappedName)
    1282             return mappedName.value();
    1283         mappedName = mappedSymbolInShaderSourceMap(linkedShaders.second, symbolType, name);
    1284         if (mappedName)
    1285             return mappedName.value();
    1286     }
    1287 
    1288     if (symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE && !name.isEmpty()) {
    1289         // Attributes are a special case: they may be requested before any shaders have been compiled,
    1290         // and aren't even required to be used in any shader program.
    1291         if (!nameHashMapForShaders)
    1292             nameHashMapForShaders = std::make_unique<ShaderNameHash>();
    1293         setCurrentNameHashMapForShader(nameHashMapForShaders.get());
    1294 
    1295         auto generatedName = generateHashedName(name);
    1296 
    1297         setCurrentNameHashMapForShader(nullptr);
    1298 
    1299         m_possiblyUnusedAttributeMap.set(generatedName, name);
    1300 
    1301         return generatedName;
    1302     }
    1303 
    1304     return name;
    1305 }
    1306 
    1307 Optional<String> GraphicsContext3D::originalSymbolInShaderSourceMap(Platform3DObject shader, ANGLEShaderSymbolType symbolType, const String& name)
    1308 {
    1309     auto result = m_shaderSourceMap.find(shader);
    1310     if (result == m_shaderSourceMap.end())
    1311         return WTF::nullopt;
    1312 
    1313     const auto& symbolMap = result->value.symbolMap(symbolType);
    1314     for (const auto& symbolEntry : symbolMap) {
    1315         if (name == symbolEntry.value.mappedName.c_str())
    1316             return symbolEntry.key;
    1317     }
    1318     return WTF::nullopt;
    1319 }
    1320 
    1321 String GraphicsContext3D::originalSymbolName(Platform3DObject program, ANGLEShaderSymbolType symbolType, const String& name)
    1322 {
    1323     GC3Dsizei count;
    1324     Platform3DObject shaders[2];
    1325     getAttachedShaders(program, 2, &count, shaders);
    1326    
    1327     for (GC3Dsizei i = 0; i < count; ++i) {
    1328         auto originalName = originalSymbolInShaderSourceMap(shaders[i], symbolType, name);
    1329         if (originalName)
    1330             return originalName.value();
    1331     }
    1332 
    1333     // We might have detached or deleted the shaders after linking.
    1334     auto result = m_linkedShaderMap.find(program);
    1335     if (result != m_linkedShaderMap.end()) {
    1336         auto linkedShaders = result->value;
    1337         auto originalName = originalSymbolInShaderSourceMap(linkedShaders.first, symbolType, name);
    1338         if (originalName)
    1339             return originalName.value();
    1340         originalName = originalSymbolInShaderSourceMap(linkedShaders.second, symbolType, name);
    1341         if (originalName)
    1342             return originalName.value();
    1343     }
    1344 
    1345     if (symbolType == SHADER_SYMBOL_TYPE_ATTRIBUTE && !name.isEmpty()) {
    1346         // Attributes are a special case: they may be requested before any shaders have been compiled,
    1347         // and aren't even required to be used in any shader program.
    1348 
    1349         const auto& cached = m_possiblyUnusedAttributeMap.find(name);
    1350         if (cached != m_possiblyUnusedAttributeMap.end())
    1351             return cached->value;
    1352     }
    1353 
    1354     return name;
    1355 }
    1356 
    1357 String GraphicsContext3D::mappedSymbolName(Platform3DObject shaders[2], size_t count, const String& name)
    1358 {
    1359     for (size_t symbolType = 0; symbolType <= static_cast<size_t>(SHADER_SYMBOL_TYPE_VARYING); ++symbolType) {
    1360         for (size_t i = 0; i < count; ++i) {
    1361             ShaderSourceMap::iterator result = m_shaderSourceMap.find(shaders[i]);
    1362             if (result == m_shaderSourceMap.end())
    1363                 continue;
    1364            
    1365             const ShaderSymbolMap& symbolMap = result->value.symbolMap(static_cast<enum ANGLEShaderSymbolType>(symbolType));
    1366             for (const auto& symbolEntry : symbolMap) {
    1367                 if (name == symbolEntry.value.mappedName.c_str())
    1368                     return symbolEntry.key;
    1369             }
    1370         }
    1371     }
    1372     return name;
    1373 }
    1374 
    1375997int GraphicsContext3D::getAttribLocation(Platform3DObject program, const String& name)
    1376998{
     
    13801002    makeContextCurrent();
    13811003
    1382     String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, name);
    1383     LOG(WebGL, "gl::GetAttribLocation is mapping %s to %s", name.utf8().data(), mappedName.utf8().data());
    1384     return gl::GetAttribLocation(program, mappedName.utf8().data());
     1004    return gl::GetAttribLocation(program, name.utf8().data());
    13851005}
    13861006
    13871007int GraphicsContext3D::getAttribLocationDirect(Platform3DObject program, const String& name)
    13881008{
    1389     if (!program)
    1390         return -1;
    1391 
    1392     makeContextCurrent();
    1393 
    1394     return gl::GetAttribLocation(program, name.utf8().data());
     1009    return getAttribLocation(program, name);
    13951010}
    13961011
     
    14091024    // Otherwise, we would just loop until we got NO_ERROR.
    14101025    for (unsigned i = 0; i < 100; ++i) {
    1411         GC3Denum error = glGetError();
     1026        GC3Denum error = gl::GetError();
    14121027        if (error == NO_ERROR)
    14131028            break;
     
    15151130    ASSERT(program);
    15161131    makeContextCurrent();
    1517 
    1518     GC3Dsizei count = 0;
    1519     Platform3DObject shaders[2] = { };
    1520     getAttachedShaders(program, 2, &count, shaders);
    1521 
    1522     if (count == 2)
    1523         m_linkedShaderMap.set(program, std::make_pair(shaders[0], shaders[1]));
    1524 
    15251132    gl::LinkProgram(program);
    15261133}
     
    15561163    makeContextCurrent();
    15571164
    1558     ShaderSourceEntry entry;
    1559 
    1560     entry.source = string;
    1561 
    1562     m_shaderSourceMap.set(shader, entry);
     1165    const CString& shaderSourceCString = string.utf8();
     1166    const char* shaderSourcePtr = shaderSourceCString.data();
     1167    int shaderSourceLength = shaderSourceCString.length();
     1168    gl::ShaderSource(shader, 1, &shaderSourcePtr, &shaderSourceLength);
    15631169}
    15641170
     
    18791485}
    18801486
    1881 void GraphicsContext3D::getNonBuiltInActiveSymbolCount(Platform3DObject program, GC3Denum pname, GC3Dint* value)
    1882 {
    1883     ASSERT(ACTIVE_ATTRIBUTES == pname || ACTIVE_UNIFORMS == pname);
    1884     if (!value)
    1885         return;
    1886 
    1887     makeContextCurrent();
    1888     const auto& result = m_shaderProgramSymbolCountMap.find(program);
    1889     if (result != m_shaderProgramSymbolCountMap.end()) {
    1890         *value = result->value.countForType(pname);
    1891         return;
    1892     }
    1893 
    1894     m_shaderProgramSymbolCountMap.set(program, ActiveShaderSymbolCounts());
    1895     ActiveShaderSymbolCounts& symbolCounts = m_shaderProgramSymbolCountMap.find(program)->value;
    1896 
    1897     // Retrieve the active attributes, build a filtered count, and a mapping of
    1898     // our internal attributes indexes to the real unfiltered indexes inside OpenGL.
    1899     GC3Dint attributeCount = 0;
    1900     gl::GetProgramiv(program, ACTIVE_ATTRIBUTES, &attributeCount);
    1901     for (GC3Dint i = 0; i < attributeCount; ++i) {
    1902         ActiveInfo info;
    1903         getActiveAttribImpl(program, i, info);
    1904         if (info.name.startsWith("gl_"))
    1905             continue;
    1906 
    1907         symbolCounts.filteredToActualAttributeIndexMap.append(i);
    1908     }
    1909    
    1910     // Do the same for uniforms.
    1911     GC3Dint uniformCount = 0;
    1912     gl::GetProgramiv(program, ACTIVE_UNIFORMS, &uniformCount);
    1913     for (GC3Dint i = 0; i < uniformCount; ++i) {
    1914         ActiveInfo info;
    1915         getActiveUniformImpl(program, i, info);
    1916         if (info.name.startsWith("gl_"))
    1917             continue;
    1918        
    1919         symbolCounts.filteredToActualUniformIndexMap.append(i);
    1920     }
    1921    
    1922     *value = symbolCounts.countForType(pname);
    1923 }
    1924 
    19251487String GraphicsContext3D::getUnmangledInfoLog(Platform3DObject shaders[2], GC3Dsizei count, const String& log)
    19261488{
     1489    UNUSED_PARAM(shaders);
     1490    UNUSED_PARAM(count);
    19271491    LOG(WebGL, "Original ShaderInfoLog:\n%s", log.utf8().data());
    19281492
    1929     JSC::Yarr::RegularExpression regExp("webgl_[0123456789abcdefABCDEF]+");
    1930 
    19311493    StringBuilder processedLog;
    1932    
     1494
    19331495    // ANGLE inserts a "#extension" line into the shader source that
    19341496    // causes a warning in some compilers. There is no point showing
     
    19371499    static const NeverDestroyed<String> angleWarning { "WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported\n"_s };
    19381500    int startFrom = log.startsWith(angleWarning) ? angleWarning.get().length() : 0;
    1939     int matchedLength = 0;
    1940 
    1941     do {
    1942         int start = regExp.match(log, startFrom, &matchedLength);
    1943         if (start == -1)
    1944             break;
    1945 
    1946         processedLog.append(log.substring(startFrom, start - startFrom));
    1947         startFrom = start + matchedLength;
    1948 
    1949         const String& mangledSymbol = log.substring(start, matchedLength);
    1950         const String& mappedSymbol = mappedSymbolName(shaders, count, mangledSymbol);
    1951         LOG(WebGL, "Demangling: %s to %s", mangledSymbol.utf8().data(), mappedSymbol.utf8().data());
    1952         processedLog.append(mappedSymbol);
    1953     } while (startFrom < static_cast<int>(log.length()));
    1954 
    19551501    processedLog.append(log.substring(startFrom, log.length() - startFrom));
    19561502
     
    19911537
    19921538    makeContextCurrent();
    1993 
    1994     const auto& result = m_shaderSourceMap.find(shader);
    1995    
    1996     switch (pname) {
    1997     case DELETE_STATUS:
    1998     case SHADER_TYPE:
    1999         gl::GetShaderiv(shader, pname, value);
    2000         break;
    2001     case COMPILE_STATUS:
    2002         if (result == m_shaderSourceMap.end()) {
    2003             *value = static_cast<int>(false);
    2004             return;
    2005         }
    2006         *value = static_cast<int>(result->value.isValid);
    2007         break;
    2008     case INFO_LOG_LENGTH:
    2009         if (result == m_shaderSourceMap.end()) {
    2010             *value = 0;
    2011             return;
    2012         }
    2013         *value = getShaderInfoLog(shader).length();
    2014         break;
    2015     case SHADER_SOURCE_LENGTH:
    2016         *value = getShaderSource(shader).length();
    2017         break;
    2018     default:
    2019         synthesizeGLError(INVALID_ENUM);
    2020     }
     1539    gl::GetShaderiv(shader, pname, value);
    20211540}
    20221541
     
    20261545
    20271546    makeContextCurrent();
    2028 
    2029     const auto& result = m_shaderSourceMap.find(shader);
    2030     if (result == m_shaderSourceMap.end())
    2031         return String();
    2032 
    2033     const ShaderSourceEntry& entry = result->value;
    2034     if (!entry.isValid)
    2035         return entry.log;
    2036 
    20371547    GLint length = 0;
    20381548    gl::GetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
     
    20481558}
    20491559
    2050 String GraphicsContext3D::getShaderSource(Platform3DObject shader)
    2051 {
    2052     ASSERT(shader);
    2053 
    2054     makeContextCurrent();
    2055 
    2056     const auto& result = m_shaderSourceMap.find(shader);
    2057     if (result == m_shaderSourceMap.end())
    2058         return String();
    2059 
    2060     return result->value.source;
    2061 }
    2062 
    2063 
    20641560void GraphicsContext3D::getTexParameterfv(GC3Denum target, GC3Denum pname, GC3Dfloat* value)
    20651561{
     
    20911587
    20921588    makeContextCurrent();
    2093 
    2094     String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_UNIFORM, name);
    2095     LOG(WebGL, "::getUniformLocation is mapping %s to %s", name.utf8().data(), mappedName.utf8().data());
    2096     return gl::GetUniformLocation(program, mappedName.utf8().data());
     1589    return gl::GetUniformLocation(program, name.utf8().data());
    20971590}
    20981591
     
    21451638    makeContextCurrent();
    21461639    GLuint o = 0;
    2147     glGenBuffers(1, &o);
     1640    gl::GenBuffers(1, &o);
    21481641    return o;
    21491642}
     
    21531646    makeContextCurrent();
    21541647    GLuint o = 0;
    2155     glGenFramebuffers(1, &o);
     1648    gl::GenFramebuffers(1, &o);
    21561649    return o;
    21571650}
     
    21601653{
    21611654    makeContextCurrent();
    2162     return glCreateProgram();
     1655    return gl::CreateProgram();
    21631656}
    21641657
     
    21671660    makeContextCurrent();
    21681661    GLuint o = 0;
    2169     glGenRenderbuffers(1, &o);
     1662    gl::GenRenderbuffers(1, &o);
    21701663    return o;
    21711664}
     
    21741667{
    21751668    makeContextCurrent();
    2176     return glCreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER);
     1669    return gl::CreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER);
    21771670}
    21781671
     
    21811674    makeContextCurrent();
    21821675    GLuint o = 0;
    2183     glGenTextures(1, &o);
     1676    gl::GenTextures(1, &o);
    21841677    m_state.textureSeedCount.add(o);
    21851678    return o;
     
    21891682{
    21901683    makeContextCurrent();
    2191     glDeleteBuffers(1, &buffer);
     1684    gl::DeleteBuffers(1, &buffer);
    21921685}
    21931686
     
    22001693        bindFramebuffer(FRAMEBUFFER, 0);
    22011694    }
    2202     glDeleteFramebuffers(1, &framebuffer);
     1695    gl::DeleteFramebuffers(1, &framebuffer);
    22031696}
    22041697
     
    22061699{
    22071700    makeContextCurrent();
    2208     m_shaderProgramSymbolCountMap.remove(program);
    2209     glDeleteProgram(program);
     1701    gl::DeleteProgram(program);
    22101702}
    22111703
     
    22131705{
    22141706    makeContextCurrent();
    2215     glDeleteRenderbuffers(1, &renderbuffer);
     1707    gl::DeleteRenderbuffers(1, &renderbuffer);
    22161708}
    22171709
     
    22191711{
    22201712    makeContextCurrent();
    2221     glDeleteShader(shader);
     1713    gl::DeleteShader(shader);
    22221714}
    22231715
     
    22281720        return keyValue.value.first == texture;
    22291721    });
    2230     glDeleteTextures(1, &texture);
     1722    gl::DeleteTextures(1, &texture);
    22311723    m_state.textureSeedCount.removeAll(texture);
    22321724}
     
    22361728    // Need to move the current errors to the synthetic error list to
    22371729    // preserve the order of errors, so a caller to getError will get
    2238     // any errors from glError before the error we are synthesizing.
     1730    // any errors from gl::Error before the error we are synthesizing.
    22391731    moveErrorsToSyntheticErrorList();
    22401732    m_syntheticErrors.add(error);
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

    r246554 r247315  
    6161#import <OpenGL/gl.h>
    6262#elif USE(ANGLE)
     63#define EGL_EGL_PROTOTYPES 0
     64// Skip the inclusion of ANGLE's explicit context entry points for now.
     65#define GL_ANGLE_explicit_context
     66#define GL_ANGLE_explicit_context_gles1
     67typedef void* GLeglContext;
     68#include <ANGLE/egl.h>
     69#include <ANGLE/eglext.h>
     70#include <ANGLE/eglext_angle.h>
     71#include <ANGLE/entry_points_egl.h>
    6372#include <ANGLE/entry_points_gles_2_0_autogen.h>
     73#include <ANGLE/entry_points_gles_ext_autogen.h>
     74#include <ANGLE/gl2ext.h>
     75#include <ANGLE/gl2ext_angle.h>
    6476#endif
    6577
     
    255267{
    256268#if USE(ANGLE)
    257     if (m_attrs.isWebGL2)
    258         m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT, SH_WEBGL2_SPEC);
    259     else
    260         m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT);
     269    // In the ANGLE backend, the only shader compiler instantiated is
     270    // the one ANGLE uses internally.
    261271#else
    262272#if PLATFORM(IOS_FAMILY)
     
    369379
    370380#elif USE(ANGLE)
    371 
    372     // FIXME: implement context setup via ANGLE.
    373381    UNUSED_PARAM(hostWindow);
    374382    UNUSED_PARAM(sharedContext);
    375383
    376 #endif
    377    
     384    m_displayObj = EGL_GetDisplay(EGL_DEFAULT_DISPLAY);
     385    if (m_displayObj == EGL_NO_DISPLAY)
     386        return;
     387    EGLint majorVersion, minorVersion;
     388    if (EGL_Initialize(m_displayObj, &majorVersion, &minorVersion) == EGL_FALSE) {
     389        LOG(WebGL, "EGLDisplay Initialization failed.");
     390        return;
     391    }
     392    LOG(WebGL, "ANGLE initialised Major: %d Minor: %d", majorVersion, minorVersion);
     393    const char *displayExtensions = EGL_QueryString(m_displayObj, EGL_EXTENSIONS);
     394    LOG(WebGL, "Extensions: %s", displayExtensions);
     395
     396    EGLConfig config;
     397    EGLint configAttributes[] = {
     398        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
     399        EGL_RED_SIZE, 8,
     400        EGL_GREEN_SIZE, 8,
     401        EGL_BLUE_SIZE, 8,
     402        EGL_ALPHA_SIZE, 8,
     403        EGL_NONE
     404    };
     405    EGLint numberConfigsReturned = 0;
     406    EGL_ChooseConfig(m_displayObj, configAttributes, &config, 1, &numberConfigsReturned);
     407    if (numberConfigsReturned != 1) {
     408        LOG(WebGL, "EGLConfig Initialization failed.");
     409        return;
     410    }
     411    LOG(WebGL, "Got EGLConfig");
     412
     413    EGL_BindAPI(EGL_OPENGL_ES_API);
     414    if (EGL_GetError() != EGL_SUCCESS) {
     415        LOG(WebGL, "Unable to bind to OPENGL_ES_API");
     416        return;
     417    }
     418
     419    std::vector<EGLint> contextAttributes;
     420    contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
     421    contextAttributes.push_back(2);
     422    contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
     423    contextAttributes.push_back(EGL_TRUE);
     424    contextAttributes.push_back(EGL_EXTENSIONS_ENABLED_ANGLE);
     425    contextAttributes.push_back(EGL_TRUE);
     426    if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) {
     427        contextAttributes.push_back(EGL_POWER_PREFERENCE_ANGLE);
     428        // EGL_LOW_POWER_ANGLE is the default. Change to
     429        // EGL_HIGH_POWER_ANGLE if desired.
     430        contextAttributes.push_back(EGL_LOW_POWER_ANGLE);
     431    }
     432    contextAttributes.push_back(EGL_NONE);
     433
     434    m_contextObj = EGL_CreateContext(m_displayObj, config, EGL_NO_CONTEXT, contextAttributes.data());
     435    if (m_contextObj == EGL_NO_CONTEXT) {
     436        LOG(WebGL, "EGLContext Initialization failed.");
     437        return;
     438    }
     439    LOG(WebGL, "Got EGLContext");
     440
     441    EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj);
     442
     443#endif // #elif USE(ANGLE)
     444
    378445    validateAttributes();
    379446
     
    383450#ifndef NDEBUG
    384451        [m_webGLLayer setName:@"WebGL Layer"];
     452#endif
     453#if USE(ANGLE)
     454        [m_webGLLayer setEGLDisplay:m_displayObj andConfig:config];
    385455#endif
    386456    END_BLOCK_OBJC_EXCEPTIONS
     
    405475    ::glBindTexture(GL_TEXTURE_RECTANGLE_EXT, 0);
    406476#elif USE(ANGLE)
    407     // FIXME: implement back buffer setup via ANGLE.
     477    gl::GenTextures(1, &m_texture);
     478    gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, m_texture);
     479    gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     480    gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     481    gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     482    gl::TexParameteri(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     483    gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, 0);
    408484#else
    409485#error Unsupported configuration
     
    428504            ::glGenRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer);
    429505    }
    430 #endif // USE(ANGLE) || USE(OPENGL_ES)
    431 
    432     // ANGLE initialization.
     506#elif USE(ANGLE)
     507    gl::GenFramebuffers(1, &m_fbo);
     508    gl::BindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     509    m_state.boundFBO = m_fbo;
     510
     511    if (!m_attrs.antialias && (m_attrs.stencil || m_attrs.depth))
     512        gl::GenRenderbuffers(1, &m_depthStencilBuffer);
     513
     514    // If necessary, create another framebuffer for the multisample results.
     515    if (m_attrs.antialias) {
     516        gl::GenFramebuffers(1, &m_multisampleFBO);
     517        gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
     518        m_state.boundFBO = m_multisampleFBO;
     519        gl::GenRenderbuffers(1, &m_multisampleColorBuffer);
     520        if (m_attrs.stencil || m_attrs.depth)
     521            gl::GenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     522    }
     523
     524#endif // USE(ANGLE)
     525
     526#if !USE(ANGLE)
     527    // ANGLE shader compiler initialization.
    433528
    434529    ShBuiltInResources ANGLEResources;
     
    451546
    452547    m_compiler.setResources(ANGLEResources);
     548#endif // !USE(ANGLE)
    453549   
    454550#if USE(OPENGL)
     
    460556#if USE(OPENGL) || USE(OPENGL_ES)
    461557    ::glClearColor(0, 0, 0, 0);
     558#elif USE(ANGLE)
     559    gl::ClearColor(0, 0, 0, 0);
    462560#endif
    463561
     
    478576        ::glDeleteTextures(1, &m_texture);
    479577#elif USE(ANGLE)
    480         // FIXME: make context current via ANGLE.
     578        EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj);
     579        gl::DeleteTextures(1, &m_texture);
    481580#endif
    482581
     
    492591        }
    493592        ::glDeleteFramebuffersEXT(1, &m_fbo);
     593#elif USE(ANGLE)
     594        if (m_attrs.antialias) {
     595            gl::DeleteRenderbuffers(1, &m_multisampleColorBuffer);
     596            if (m_attrs.stencil || m_attrs.depth)
     597                gl::DeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
     598            gl::DeleteFramebuffers(1, &m_multisampleFBO);
     599        } else {
     600            if (m_attrs.stencil || m_attrs.depth)
     601                gl::DeleteRenderbuffers(1, &m_depthStencilBuffer);
     602        }
     603        gl::DeleteFramebuffers(1, &m_fbo);
    494604#endif
    495605
     
    501611        CGLDestroyContext(m_contextObj);
    502612#elif USE(ANGLE)
    503         // FIXME: implement context teardown via ANGLE.
     613        EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
     614        EGL_DestroyContext(m_displayObj, m_contextObj);
    504615#endif
    505616        [m_webGLLayer setContext:nullptr];
     
    538649        return CGLSetCurrentContext(m_contextObj) == kCGLNoError;
    539650#elif USE(ANGLE)
    540     // FIXME: implement making context current via ANGLE.
     651    if (EGL_GetCurrentContext() != m_contextObj)
     652        return EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, m_contextObj);
    541653#endif
    542654    return true;
     
    554666        [EAGLContext setCurrentContext:0];
    555667#elif USE(ANGLE)
    556         // FIXME: implement forced context loss via ANGLE.
     668        EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    557669#endif
    558670        return;
     
    658770    }
    659771}
    660 #endif
     772#endif // USE(OPENGL)
     773
     774#if USE(ANGLE)
     775void GraphicsContext3D::allocateIOSurfaceBackingStore(IntSize size)
     776{
     777    LOG(WebGL, "GraphicsContext3D::allocateIOSurfaceBackingStore at %d x %d. (%p)", size.width(), size.height(), this);
     778    [m_webGLLayer allocateIOSurfaceBackingStoreWithSize:size usingAlpha:m_attrs.alpha];
     779}
     780
     781void GraphicsContext3D::updateFramebufferTextureBackingStoreFromLayer()
     782{
     783    LOG(WebGL, "GraphicsContext3D::updateFramebufferTextureBackingStoreFromLayer(). (%p)", this);
     784    [m_webGLLayer bindFramebufferToNextAvailableSurface];
     785}
     786#endif // USE(ANGLE)
    661787
    662788bool GraphicsContext3D::isGLES2Compliant() const
  • trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h

    r246554 r247315  
    5151    WebCore::GraphicsContext3D* _context;
    5252    float _devicePixelRatio;
    53 #if USE(OPENGL)
     53#if USE(OPENGL) || (USE(ANGLE) && PLATFORM(MAC))
    5454    std::unique_ptr<WebCore::IOSurface> _contentsBuffer;
    5555    std::unique_ptr<WebCore::IOSurface> _drawingBuffer;
     
    5757    WebCore::IntSize _bufferSize;
    5858    BOOL _usingAlpha;
     59#endif
     60#if USE(ANGLE) && PLATFORM(MAC)
     61    void* _eglDisplay;
     62    void* _eglConfig;
     63    void* _contentsPbuffer;
     64    void* _drawingPbuffer;
     65    void* _sparePbuffer;
     66    void* _latchedPbuffer;
    5967#endif
    6068}
     
    6674- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace;
    6775
    68 #if USE(OPENGL)
     76#if USE(OPENGL) || (USE(ANGLE) && PLATFORM(MAC))
    6977- (void)allocateIOSurfaceBackingStoreWithSize:(WebCore::IntSize)size usingAlpha:(BOOL)usingAlpha;
    7078- (void)bindFramebufferToNextAvailableSurface;
     79#endif
     80
     81#if (USE(ANGLE) && PLATFORM(MAC))
     82- (void)setEGLDisplay:(void*)eglDisplay andConfig:(void*)eglConfig;
     83- (void)dealloc;
    7184#endif
    7285
  • trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm

    r246554 r247315  
    4444#endif
    4545
     46#if USE(ANGLE)
     47#define EGL_EGL_PROTOTYPES 0
     48#include <ANGLE/egl.h>
     49#include <ANGLE/eglext.h>
     50#include <ANGLE/eglext_angle.h>
     51#include <ANGLE/entry_points_egl.h>
     52#include <ANGLE/entry_points_gles_2_0_autogen.h>
     53// Skip the inclusion of ANGLE's explicit context entry points for now.
     54#define GL_ANGLE_explicit_context
     55#include <ANGLE/gl2ext.h>
     56#include <ANGLE/gl2ext_angle.h>
     57#endif
     58
    4659@implementation WebGLLayer
    4760
     
    5366    self = [super init];
    5467    _devicePixelRatio = context->getContextAttributes().devicePixelRatio;
    55 #if USE(OPENGL)
     68#if USE(OPENGL) || USE(ANGLE) && PLATFORM(MAC)
    5669    self.contentsOpaque = !context->getContextAttributes().alpha;
    5770    self.transform = CATransform3DIdentity;
     
    6376}
    6477
    65 #if USE(OPENGL)
     78#if USE(OPENGL) || (USE(ANGLE) && PLATFORM(MAC))
    6679// When using an IOSurface as layer contents, we need to flip the
    6780// layer to take into account that the IOSurface provides content
     
    7992    [super setAnchorPoint:CGPointMake(p.x, 1.0 - p.y)];
    8093}
    81 
     94#endif // USE(OPENGL) || (USE(ANGLE) && PLATFORM(MAC))
     95
     96#if USE(OPENGL)
    8297static void freeData(void *, const void *data, size_t /* size */)
    8398{
    8499    fastFree(const_cast<void *>(data));
    85100}
    86 #endif
     101#endif // USE(OPENGL)
    87102
    88103- (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace
     
    119134    return image;
    120135#else
     136    // FIXME: implement.
    121137    UNUSED_PARAM(colorSpace);
    122138    return nullptr;
     
    140156    _context->presentRenderbuffer();
    141157#elif USE(ANGLE)
    142     // FIXME: display rendering results via ANGLE.
     158    _context->prepareTexture();
     159    if (_drawingBuffer) {
     160        if (_latchedPbuffer) {
     161            GC3Denum texture = _context->platformTexture();
     162            gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, texture);
     163            if (!EGL_ReleaseTexImage(_eglDisplay, _latchedPbuffer, EGL_BACK_BUFFER)) {
     164                // FIXME: report error.
     165                notImplemented();
     166            }
     167            _latchedPbuffer = nullptr;
     168        }
     169        std::swap(_contentsBuffer, _drawingBuffer);
     170        std::swap(_contentsPbuffer, _drawingPbuffer);
     171        self.contents = _contentsBuffer->asLayerContents();
     172        [self reloadValueForKeyPath:@"contents"];
     173        [self bindFramebufferToNextAvailableSurface];
     174    }
    143175#endif
    144176
     
    149181}
    150182
    151 #if USE(OPENGL)
     183#if (USE(ANGLE) && PLATFORM(MAC))
     184- (void)setEGLDisplay:(void*)display andConfig:(void*)config
     185{
     186    _eglDisplay = display;
     187    _eglConfig = config;
     188}
     189
     190- (void)dealloc
     191{
     192    EGL_DestroySurface(_eglDisplay, _contentsPbuffer);
     193    EGL_DestroySurface(_eglDisplay, _drawingPbuffer);
     194    EGL_DestroySurface(_eglDisplay, _sparePbuffer);
     195    [super dealloc];
     196}
     197#endif
     198
     199#if USE(OPENGL) || (USE(ANGLE) && PLATFORM(MAC))
    152200- (void)allocateIOSurfaceBackingStoreWithSize:(WebCore::IntSize)size usingAlpha:(BOOL)usingAlpha
    153201{
     
    165213    _drawingBuffer->migrateColorSpaceToProperties();
    166214    _spareBuffer->migrateColorSpaceToProperties();
     215
     216#if USE(ANGLE) && PLATFORM(MAC)
     217    const EGLint surfaceAttributes[] = {
     218        EGL_WIDTH, size.width(),
     219        EGL_HEIGHT, size.height(),
     220        EGL_IOSURFACE_PLANE_ANGLE, 0,
     221        EGL_TEXTURE_TARGET, EGL_TEXTURE_RECTANGLE_ANGLE,
     222        EGL_TEXTURE_INTERNAL_FORMAT_ANGLE, GL_BGRA_EXT,
     223        EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
     224        EGL_TEXTURE_TYPE_ANGLE, GL_UNSIGNED_BYTE,
     225        EGL_NONE, EGL_NONE
     226    };
     227
     228    _contentsPbuffer = EGL_CreatePbufferFromClientBuffer(_eglDisplay, EGL_IOSURFACE_ANGLE, _contentsBuffer->surface(), _eglConfig, surfaceAttributes);
     229    _drawingPbuffer = EGL_CreatePbufferFromClientBuffer(_eglDisplay, EGL_IOSURFACE_ANGLE, _drawingBuffer->surface(), _eglConfig, surfaceAttributes);
     230    _sparePbuffer = EGL_CreatePbufferFromClientBuffer(_eglDisplay, EGL_IOSURFACE_ANGLE, _spareBuffer->surface(), _eglConfig, surfaceAttributes);
     231#endif
    167232}
    168233
    169234- (void)bindFramebufferToNextAvailableSurface
    170235{
     236#if USE(OPENGL)
    171237    GC3Denum texture = _context->platformTexture();
    172238    glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texture);
     
    181247    CGLError error = CGLTexImageIOSurface2D(_context->platformGraphicsContext3D(), GL_TEXTURE_RECTANGLE_ARB, internalFormat, _bufferSize.width(), _bufferSize.height(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, ioSurface, 0);
    182248    ASSERT_UNUSED(error, error == kCGLNoError);
    183 }
    184 #endif
     249#elif USE(ANGLE)
     250    GC3Denum texture = _context->platformTexture();
     251    gl::BindTexture(GL_TEXTURE_RECTANGLE_ANGLE, texture);
     252
     253    if (_latchedPbuffer) {
     254        if (!EGL_ReleaseTexImage(_eglDisplay, _latchedPbuffer, EGL_BACK_BUFFER)) {
     255            // FIXME: report error.
     256            notImplemented();
     257        }
     258        _latchedPbuffer = nullptr;
     259    }
     260
     261    if (_drawingBuffer && _drawingBuffer->isInUse()) {
     262        std::swap(_drawingBuffer, _spareBuffer);
     263        std::swap(_drawingPbuffer, _sparePbuffer);
     264    }
     265
     266    // Link the IOSurface to the texture via the previously-created pbuffer.
     267    if (!EGL_BindTexImage(_eglDisplay, _drawingPbuffer, EGL_BACK_BUFFER)) {
     268        // FIXME: report error.
     269        notImplemented();
     270    }
     271    _latchedPbuffer = _drawingPbuffer;
     272#endif
     273}
     274#endif // USE(OPENGL) || (USE(ANGLE) && PLATFORM(MAC))
    185275
    186276@end
Note: See TracChangeset for help on using the changeset viewer.