[webkit-changes] [WebKit/WebKit] 6c91a8: [WebGPU] Virtualize PresentationContext
Myles C. Maxfield
noreply at github.com
Wed Jan 18 03:01:49 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6c91a810e7ee70363e0f9e9a888ed7f29837a841
https://github.com/WebKit/WebKit/commit/6c91a810e7ee70363e0f9e9a888ed7f29837a841
Author: Myles C. Maxfield <mmaxfield at apple.com>
Date: 2023-01-18 (Wed, 18 Jan 2023)
Changed paths:
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Source/WebGPU/WebGPU/Device.h
M Source/WebGPU/WebGPU/PresentationContext.h
M Source/WebGPU/WebGPU/PresentationContext.mm
A Source/WebGPU/WebGPU/PresentationContextCoreAnimation.h
A Source/WebGPU/WebGPU/PresentationContextCoreAnimation.mm
A Source/WebGPU/WebGPU/PresentationContextIOSurface.h
A Source/WebGPU/WebGPU/PresentationContextIOSurface.mm
Log Message:
-----------
[WebGPU] Virtualize PresentationContext
https://bugs.webkit.org/show_bug.cgi?id=250632
rdar://104270153
Reviewed by Tadeu Zagallo.
PresentationContext is how we composite results into a window. Its implementation
in https://bugs.webkit.org/show_bug.cgi?id=247587 is set up only for WebKit's compositing
using IOSurfaces. However, it's convenient if we could have another implementation of them
that could use CAMetalLayer directly, so that we could develop WebGPU without having to build
all of WebCore.
This patch turns PresentationContext into a base class with virtual methods, and provides
two implementations of them: One for IOSurfaces, that WebKit will use, and one for CAMetalLayer.
The IOSurface implementation isn't modified at all; it's simply moved from the existing
implementation.
This patch doesn't actually implement the CAMetalLayer implementation; this patch is already
quite large without it, and I want to keep my patches small to aid reviewing. I will implement
getCurrentTextureView() and present() in my next patch.
No test because there is no behavior change.
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/Device.h:
* Source/WebGPU/WebGPU/PresentationContext.h:
(WebGPU::PresentationContext::createInvalid):
(WebGPU::PresentationContext::isPresentationContextIOSurface const):
(WebGPU::PresentationContext::isPresentationContextCoreAnimation const):
(WebGPU::PresentationContext::create): Deleted.
(WebGPU::PresentationContext::displayBuffer const): Deleted.
(WebGPU::PresentationContext::drawingBuffer const): Deleted.
* Source/WebGPU/WebGPU/PresentationContext.mm:
(WebGPU::PresentationContext::create):
(WebGPU::PresentationContext::getPreferredFormat):
(WebGPU::PresentationContext::present):
(WebGPU::optionsFor32BitSurface): Deleted.
(WebGPU::createIOSurface): Deleted.
(WebGPU::createSurfaceFromDescriptor): Deleted.
(WebGPU::Device::createSurface): Deleted.
(WebGPU::PresentationContext::PresentationContext): Deleted.
(WebGPU::PresentationContext::nextDrawable): Deleted.
(wgpuSurfaceCocoaCustomSurfaceGetDisplayBuffer): Deleted.
(wgpuSurfaceCocoaCustomSurfaceGetDrawingBuffer): Deleted.
* Source/WebGPU/WebGPU/PresentationContextCoreAnimation.h: Copied from Source/WebGPU/WebGPU/PresentationContext.h.
(WebGPU::PresentationContextCoreAnimation::create):
* Source/WebGPU/WebGPU/PresentationContextCoreAnimation.mm: Copied from Source/WebGPU/WebGPU/PresentationContext.h.
(WebGPU::PresentationContextCoreAnimation::PresentationContextCoreAnimation):
(WebGPU::PresentationContextCoreAnimation::configure):
(WebGPU::PresentationContextCoreAnimation::present):
(WebGPU::PresentationContextCoreAnimation::getCurrentTextureView):
* Source/WebGPU/WebGPU/PresentationContextIOSurface.h: Copied from Source/WebGPU/WebGPU/PresentationContext.h.
(WebGPU::PresentationContextIOSurface::create):
(WebGPU::PresentationContextIOSurface::displayBuffer const):
(WebGPU::PresentationContextIOSurface::drawingBuffer const):
* Source/WebGPU/WebGPU/PresentationContextIOSurface.mm: Copied from Source/WebGPU/WebGPU/PresentationContext.mm.
(WebGPU::optionsFor32BitSurface):
(WebGPU::createIOSurface):
(WebGPU::createSurfaceFromDescriptor):
(WebGPU::PresentationContextIOSurface::PresentationContextIOSurface):
(WebGPU::PresentationContextIOSurface::configure):
(WebGPU::PresentationContextIOSurface::present):
(WebGPU::PresentationContextIOSurface::getCurrentTextureView):
(WebGPU::PresentationContextIOSurface::nextDrawable):
(wgpuSurfaceCocoaCustomSurfaceGetDisplayBuffer):
(wgpuSurfaceCocoaCustomSurfaceGetDrawingBuffer):
Canonical link: https://commits.webkit.org/259022@main
More information about the webkit-changes
mailing list