[webkit-changes] [WebKit/WebKit] 7d4878: [WebGPU] Flesh out PresentationContext's API

Myles C. Maxfield noreply at github.com
Mon Jan 30 13:12:36 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7d48787400be8e0bc45e3bf0c0817d510341347f
      https://github.com/WebKit/WebKit/commit/7d48787400be8e0bc45e3bf0c0817d510341347f
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-01-30 (Mon, 30 Jan 2023)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/GPUPresentationContext.cpp
    M Source/WebCore/Modules/WebGPU/GPUPresentationContext.h
    M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUPresentationContextImpl.cpp
    M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUPresentationContextImpl.h
    M Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUPresentationContext.h
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.cpp
    M Source/WebGPU/WebGPU/PresentationContext.h
    M Source/WebGPU/WebGPU/PresentationContext.mm
    M Source/WebGPU/WebGPU/PresentationContextCoreAnimation.h
    M Source/WebGPU/WebGPU/PresentationContextCoreAnimation.mm
    M Source/WebGPU/WebGPU/PresentationContextIOSurface.h
    M Source/WebGPU/WebGPU/PresentationContextIOSurface.mm
    M Source/WebGPU/WebGPU/WebGPUExt.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.messages.in
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemotePresentationContextProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemotePresentationContextProxy.h
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteTextureProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteTextureProxy.h

  Log Message:
  -----------
  [WebGPU] Flesh out PresentationContext's API
https://bugs.webkit.org/show_bug.cgi?id=250990
rdar://104537242

Reviewed by Tadeu Zagallo.

This patch does 3 things:
1. Migrates getCurrentTextureView() to getCurrentTexture(). GPUCanvasContext uses
       getCurrentTexture(), but WebGPU.h exposes getCurrentTextureView(). GPUCanvasContext
       represents the source of truth; WebGPU.h is outdated, so we should use
       getCurrentTexture(). webgpu-native/webgpu-headers#89 is
       about updating WebGPU.h.
2. Implements getCurrentTexture(). These are a little tricky because they're supposed to be
       +0 getters. However, that's only relevant for calling directly into WebGPU.framework;
       everywhere else in WebKit we use owning Refs, so in WebKit, a +0 object is really just
       an object whose creator has a ref to it. The tricky parts about dealing with
       WebGPU.framework will be fixed in https://bugs.webkit.org/show_bug.cgi?id=250958; this
       patch hooks just those parts up intentionally incorrectly and adds a FIXME with a link
       to that bug. These functions aren't called yet (that's for
       https://bugs.webkit.org/show_bug.cgi?id=250995) so it's okay that this part doesn't
       actually work yet. WebGPU.framework continues to implement getCurrentTextureView()
       just for completeness.
3. Adds present(), and hooks it up to wgpuSwapChainPresent(). This part is super
       straightforward.

* Source/WebCore/Modules/WebGPU/GPUPresentationContext.cpp:
(WebCore::GPUPresentationContext::getCurrentTexture):
(WebCore::GPUPresentationContext::present):
* Source/WebCore/Modules/WebGPU/GPUPresentationContext.h:
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUPresentationContextImpl.cpp:
(PAL::WebGPU::PresentationContextImpl::configure):
(PAL::WebGPU::PresentationContextImpl::getCurrentTexture):
(PAL::WebGPU::PresentationContextImpl::present):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUPresentationContextImpl.h:
* Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUPresentationContext.h:
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.cpp:
(WebCore::GPUCanvasContextCocoa::getCurrentTexture):
* Source/WebGPU/WebGPU/PresentationContext.h:
* Source/WebGPU/WebGPU/PresentationContext.mm:
(WebGPU::PresentationContext::getCurrentTexture):
(wgpuSwapChainGetCurrentTexture):
* Source/WebGPU/WebGPU/PresentationContextCoreAnimation.h:
(WebGPU::PresentationContextCoreAnimation::Configuration::Configuration):
* Source/WebGPU/WebGPU/PresentationContextCoreAnimation.mm:
(WebGPU::PresentationContextCoreAnimation::configure):
(WebGPU::PresentationContextCoreAnimation::Configuration::generateCurrentFrameState):
(WebGPU::PresentationContextCoreAnimation::getCurrentTexture):
* Source/WebGPU/WebGPU/PresentationContextIOSurface.h:
* Source/WebGPU/WebGPU/PresentationContextIOSurface.mm:
(WebGPU::PresentationContextIOSurface::getCurrentTexture):
* Source/WebGPU/WebGPU/WebGPUExt.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.cpp:
(WebKit::RemotePresentationContext::getCurrentTexture):
(WebKit::RemotePresentationContext::present):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp:
(WebKit::WebGPU::RemoteDeviceProxy::createTexture):
(WebKit::WebGPU::RemoteDeviceProxy::createSurfaceTexture):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemotePresentationContextProxy.cpp:
(WebKit::WebGPU::RemotePresentationContextProxy::getCurrentTexture):
(WebKit::WebGPU::RemotePresentationContextProxy::present):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemotePresentationContextProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteTextureProxy.cpp:
(WebKit::WebGPU::RemoteTextureProxy::RemoteTextureProxy):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteTextureProxy.h:

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




More information about the webkit-changes mailing list