[webkit-changes] [WebKit/WebKit] 1bce7e: WebGL has unfinished context sharing feature

Kimmo Kinnunen noreply at github.com
Tue Aug 15 07:44:59 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1bce7e57fc29e682b95cfa4b27114ed6b1f4be94
      https://github.com/WebKit/WebKit/commit/1bce7e57fc29e682b95cfa4b27114ed6b1f4be94
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-08-15 (Tue, 15 Aug 2023)

  Changed paths:
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.order
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/html/canvas/EXTDisjointTimerQuery.cpp
    M Source/WebCore/html/canvas/OESVertexArrayObject.cpp
    M Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
    M Source/WebCore/html/canvas/WebGLBuffer.cpp
    M Source/WebCore/html/canvas/WebGLBuffer.h
    R Source/WebCore/html/canvas/WebGLContextGroup.cpp
    R Source/WebCore/html/canvas/WebGLContextGroup.h
    R Source/WebCore/html/canvas/WebGLContextObject.cpp
    R Source/WebCore/html/canvas/WebGLContextObject.h
    M Source/WebCore/html/canvas/WebGLFramebuffer.cpp
    M Source/WebCore/html/canvas/WebGLFramebuffer.h
    M Source/WebCore/html/canvas/WebGLObject.cpp
    M Source/WebCore/html/canvas/WebGLObject.h
    M Source/WebCore/html/canvas/WebGLProgram.cpp
    M Source/WebCore/html/canvas/WebGLProgram.h
    M Source/WebCore/html/canvas/WebGLQuery.cpp
    M Source/WebCore/html/canvas/WebGLQuery.h
    M Source/WebCore/html/canvas/WebGLRenderbuffer.cpp
    M Source/WebCore/html/canvas/WebGLRenderbuffer.h
    M Source/WebCore/html/canvas/WebGLRenderingContext.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/html/canvas/WebGLSampler.cpp
    M Source/WebCore/html/canvas/WebGLSampler.h
    M Source/WebCore/html/canvas/WebGLShader.cpp
    M Source/WebCore/html/canvas/WebGLShader.h
    R Source/WebCore/html/canvas/WebGLSharedObject.cpp
    R Source/WebCore/html/canvas/WebGLSharedObject.h
    M Source/WebCore/html/canvas/WebGLSync.cpp
    M Source/WebCore/html/canvas/WebGLSync.h
    M Source/WebCore/html/canvas/WebGLTexture.cpp
    M Source/WebCore/html/canvas/WebGLTexture.h
    M Source/WebCore/html/canvas/WebGLTimerQueryEXT.cpp
    M Source/WebCore/html/canvas/WebGLTimerQueryEXT.h
    M Source/WebCore/html/canvas/WebGLTransformFeedback.cpp
    M Source/WebCore/html/canvas/WebGLTransformFeedback.h
    M Source/WebCore/html/canvas/WebGLVertexArrayObject.cpp
    M Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp
    M Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h
    M Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in

  Log Message:
  -----------
  WebGL has unfinished context sharing feature
https://bugs.webkit.org/show_bug.cgi?id=260062
rdar://113735088

Reviewed by Dan Glastonbury.

WebGL rendering context code was organized as if multiple contexts could
share the same objects via the context group. This was feature never
fully specified due to technical difficulties and never implemented.
The objects always belong to a single context.

The partial support makes the code overly complex. This commit removes
the feature.

Remove WebGLContextObject, WebGLSharedObject subclasses. Just have one
WebGLObject base class for the rendering context subobjects.

The rendering context held the subobjects in two lists:
 - Context object list in WebGLRenderingContextBase
 - Shared object list in WebGLContextGroup

The purpose of these lists were:
 1. Destroy the underlying GL objects when the rendering context
    is destroyed.
 2. Mark the subobjects as detached when the owning rendering context is
    lost.

Maintaining these lists is more a bit complex than current code leads
to believe. Upon failure to allocate the underlying GL object, the
subobject creation should fail and then the list append skipped.
The creation failure is not handled correctly. To simplify the upcoming
fix, just remove the lists altogether.

Instead of lists, just represent the subobject <-> rendering context
link via WeakPtr. Instead of traversing the lists upon destruction
and context loss, invalidate the weak pointers by revoking. This
changes the behavior of case 1., where before the underlying GL objects
were destroyed and now just abandoned. This is as intended, since
the GL context is being destroyed and this takes care of all the
underlying GL objects directly.

* Source/WebCore/CMakeLists.txt:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.order:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/html/canvas/EXTDisjointTimerQuery.cpp:
(WebCore::EXTDisjointTimerQuery::createQueryEXT):
(WebCore::EXTDisjointTimerQuery::deleteQueryEXT):
(WebCore::EXTDisjointTimerQuery::isQueryEXT):
* Source/WebCore/html/canvas/OESVertexArrayObject.cpp:
(WebCore::OESVertexArrayObject::createVertexArrayOES):
(WebCore::OESVertexArrayObject::deleteVertexArrayOES):
(WebCore::OESVertexArrayObject::isVertexArrayOES):
* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
(WebCore::WebGL2RenderingContext::createQuery):
(WebCore::WebGL2RenderingContext::isQuery):
(WebCore::WebGL2RenderingContext::createSampler):
(WebCore::WebGL2RenderingContext::isSampler):
(WebCore::WebGL2RenderingContext::fenceSync):
(WebCore::WebGL2RenderingContext::isSync):
(WebCore::WebGL2RenderingContext::createTransformFeedback):
(WebCore::WebGL2RenderingContext::deleteTransformFeedback):
(WebCore::WebGL2RenderingContext::isTransformFeedback):
(WebCore::WebGL2RenderingContext::createVertexArray):
(WebCore::WebGL2RenderingContext::deleteVertexArray):
(WebCore::WebGL2RenderingContext::isVertexArray):
(WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
* Source/WebCore/html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::WebGLBuffer):
(WebCore::WebGLBuffer::~WebGLBuffer):
* Source/WebCore/html/canvas/WebGLBuffer.h:
* Source/WebCore/html/canvas/WebGLContextGroup.cpp: Removed.
* Source/WebCore/html/canvas/WebGLContextGroup.h: Removed.
* Source/WebCore/html/canvas/WebGLContextObject.cpp: Removed.
* Source/WebCore/html/canvas/WebGLContextObject.h: Removed.
* Source/WebCore/html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::WebGLFramebuffer):
(WebCore::WebGLFramebuffer::getAttachmentObject const):
(WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer):
* Source/WebCore/html/canvas/WebGLFramebuffer.h:
* Source/WebCore/html/canvas/WebGLObject.cpp:
(WebCore::WebGLObject::WebGLObject):
(WebCore::WebGLObject::objectGraphLockForContext):
(WebCore::WebGLObject::graphicsContextGL const):
(WebCore::WebGLObject::deleteObject):
* Source/WebCore/html/canvas/WebGLObject.h:
(WebCore::WebGLObject::context const):
(WebCore::WebGLObject::validate const):
(WebCore::WebGLObject::isRenderbuffer const):
(WebCore::WebGLObject::isTexture const):
* Source/WebCore/html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::WebGLProgram):
(WebCore::WebGLProgram::~WebGLProgram):
(WebCore::WebGLProgram::cacheInfoIfNeeded):
* Source/WebCore/html/canvas/WebGLProgram.h:
* Source/WebCore/html/canvas/WebGLQuery.cpp:
(WebCore::WebGLQuery::~WebGLQuery):
(WebCore::WebGLQuery::WebGLQuery):
* Source/WebCore/html/canvas/WebGLQuery.h:
* Source/WebCore/html/canvas/WebGLRenderbuffer.cpp:
(WebCore::WebGLRenderbuffer::~WebGLRenderbuffer):
(WebCore::WebGLRenderbuffer::WebGLRenderbuffer):
* Source/WebCore/html/canvas/WebGLRenderbuffer.h:
* Source/WebCore/html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::initializeVertexArrayObjects):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
(WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
(WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
(WebCore::WebGLRenderingContextBase::createBuffer):
(WebCore::WebGLRenderingContextBase::createFramebuffer):
(WebCore::WebGLRenderingContextBase::createTexture):
(WebCore::WebGLRenderingContextBase::createProgram):
(WebCore::WebGLRenderingContextBase::createRenderbuffer):
(WebCore::WebGLRenderingContextBase::createShader):
(WebCore::WebGLRenderingContextBase::deleteObject):
(WebCore::WebGLRenderingContextBase::validateWebGLObject):
(WebCore::WebGLRenderingContextBase::validateWebGLProgramOrShader):
(WebCore::WebGLRenderingContextBase::isBuffer):
(WebCore::WebGLRenderingContextBase::isFramebuffer):
(WebCore::WebGLRenderingContextBase::isProgram):
(WebCore::WebGLRenderingContextBase::isRenderbuffer):
(WebCore::WebGLRenderingContextBase::isShader):
(WebCore::WebGLRenderingContextBase::isTexture):
(WebCore::WebGLRenderingContextBase::forceLostContext):
(WebCore::WebGLRenderingContextBase::createRefForContextObject):
(WebCore::WebGLRenderingContextBase::detachAndRemoveAllObjects):
(WebCore::WebGLRenderingContextBase::loseContextImpl): Deleted.
(WebCore::WebGLRenderingContextBase::removeSharedObject): Deleted.
(WebCore::WebGLRenderingContextBase::addSharedObject): Deleted.
(WebCore::WebGLRenderingContextBase::removeContextObject): Deleted.
(WebCore::WebGLRenderingContextBase::addContextObject): Deleted.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::graphicsContextGL const):
(WebCore::WebGLRenderingContextBase::contextGroup const): Deleted.
* Source/WebCore/html/canvas/WebGLSampler.cpp:
(WebCore::WebGLSampler::~WebGLSampler):
(WebCore::WebGLSampler::WebGLSampler):
* Source/WebCore/html/canvas/WebGLSampler.h:
* Source/WebCore/html/canvas/WebGLShader.cpp:
(WebCore::WebGLShader::WebGLShader):
(WebCore::WebGLShader::~WebGLShader):
* Source/WebCore/html/canvas/WebGLShader.h:
* Source/WebCore/html/canvas/WebGLSharedObject.cpp: Removed.
* Source/WebCore/html/canvas/WebGLSharedObject.h: Removed.
* Source/WebCore/html/canvas/WebGLSync.cpp:
(WebCore::WebGLSync::~WebGLSync):
(WebCore::WebGLSync::WebGLSync):
* Source/WebCore/html/canvas/WebGLSync.h:
* Source/WebCore/html/canvas/WebGLTexture.cpp:
(WebCore::WebGLTexture::WebGLTexture):
(WebCore::WebGLTexture::~WebGLTexture):
* Source/WebCore/html/canvas/WebGLTexture.h:
* Source/WebCore/html/canvas/WebGLTimerQueryEXT.cpp:
(WebCore::WebGLTimerQueryEXT::WebGLTimerQueryEXT):
* Source/WebCore/html/canvas/WebGLTimerQueryEXT.h:
* Source/WebCore/html/canvas/WebGLTransformFeedback.cpp:
(WebCore::WebGLTransformFeedback::~WebGLTransformFeedback):
(WebCore::WebGLTransformFeedback::WebGLTransformFeedback):
* Source/WebCore/html/canvas/WebGLTransformFeedback.h:
* Source/WebCore/html/canvas/WebGLVertexArrayObject.cpp:
* Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.cpp:
(WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase):
* Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGLAttributes.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

Canonical link: https://commits.webkit.org/266910@main




More information about the webkit-changes mailing list