[webkit-changes] [WebKit/WebKit] 0dcc7a: WebGLFramebuffer uses renderbuffer and texture att...

Kimmo Kinnunen noreply at github.com
Thu Aug 31 17:50:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0dcc7a680e6c5e7bf96006e9c3bd17d185861520
      https://github.com/WebKit/WebKit/commit/0dcc7a680e6c5e7bf96006e9c3bd17d185861520
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
    M Source/WebCore/html/canvas/WebGLFramebuffer.cpp
    M Source/WebCore/html/canvas/WebGLFramebuffer.h
    M Source/WebCore/html/canvas/WebGLObject.h
    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/WebGLTexture.h

  Log Message:
  -----------
  WebGLFramebuffer uses renderbuffer and texture attachments via WebGLObject
https://bugs.webkit.org/show_bug.cgi?id=260955
rdar://114750589

Reviewed by Dan Glastonbury.

Framebuffer attachments can be 2d textures, 3d texture layers or
renderbuffers. Use std::variant to encode this instead of
a virtual base class. This removes a lot of unneeded complexity in
the code. This also enables future bugfixes related to non-typesafe
handling of these variants.

When obtaining a pointer to the attached object, use std::variant
instead of WebGLObject*. This way future commits may break the
dependency to a common base class. The objects do not have intrinsic
polymorphic operations, rather their types are always known at the
invocation site, from JS through WebGLRenderingContextBase.

* Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::framebufferTextureLayer):
(WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
* Source/WebCore/html/canvas/WebGLFramebuffer.cpp:
(WebCore::entryAddMembersToOpaqueRoots):
(WebCore::entryDetachAndClear):
(WebCore::entryAttach):
(WebCore::entryContextSetAttachment):
(WebCore::entryObject):
(WebCore::entryHasObject):
(WebCore::WebGLFramebuffer::setAttachmentForBoundFramebuffer):
(WebCore::WebGLFramebuffer::getAttachmentObject const):
(WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer):
(WebCore::WebGLFramebuffer::deleteObjectImpl):
(WebCore::WebGLFramebuffer::drawBuffersIfNecessary):
(WebCore::WebGLFramebuffer::addMembersToOpaqueRoots):
(WebCore::WebGLFramebuffer::setAttachmentInternal):
(WebCore::WebGLFramebuffer::TextureAttachment::operator== const):
(WebCore::WebGLFramebuffer::TextureLayerAttachment::operator== const):
(): Deleted.
(WebCore::WebGLFramebuffer::attach): Deleted.
(WebCore::WebGLFramebuffer::getAttachment const): Deleted.
(WebCore::WebGLFramebuffer::removeAttachmentInternal): Deleted.
* Source/WebCore/html/canvas/WebGLFramebuffer.h:
* Source/WebCore/html/canvas/WebGLObject.h:
(WebCore::WebGLObject::isRenderbuffer const): Deleted.
(WebCore::WebGLObject::isTexture const): Deleted.
* Source/WebCore/html/canvas/WebGLRenderbuffer.h:
* Source/WebCore/html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
(WebCore::WebGLRenderingContextBase::framebufferTexture2D):
* Source/WebCore/html/canvas/WebGLTexture.h:

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




More information about the webkit-changes mailing list