[webkit-changes] [WebKit/WebKit] a5b1dd: [WebGPU] Unify Surface and SwapChain into a single...
Myles C. Maxfield
noreply at github.com
Tue Jan 17 08:43:02 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a5b1ddef1f3bfcf16d61b7c89f474ab1bc787395
https://github.com/WebKit/WebKit/commit/a5b1ddef1f3bfcf16d61b7c89f474ab1bc787395
Author: Myles C. Maxfield <mmaxfield at apple.com>
Date: 2023-01-17 (Tue, 17 Jan 2023)
Changed paths:
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Source/WebGPU/WebGPU/APIConversions.h
M Source/WebGPU/WebGPU/Device.h
M Source/WebGPU/WebGPU/Device.mm
M Source/WebGPU/WebGPU/Instance.h
M Source/WebGPU/WebGPU/Instance.mm
A Source/WebGPU/WebGPU/PresentationContext.h
A Source/WebGPU/WebGPU/PresentationContext.mm
R Source/WebGPU/WebGPU/Surface.h
R Source/WebGPU/WebGPU/Surface.mm
R Source/WebGPU/WebGPU/SwapChain.h
R Source/WebGPU/WebGPU/SwapChain.mm
Log Message:
-----------
[WebGPU] Unify Surface and SwapChain into a single class
https://bugs.webkit.org/show_bug.cgi?id=250694
rdar://104312969
Reviewed by Kimmo Kinnunen.
In ancient history, the WebGPU spec had a GPUCanvasContext as distinct from a GPUSwapChain.
However, since then, those two objects in the spec have been unified. This is a good thing;
you can't have multiple swap chains alive for the same canvas context, and the canvas context
itself didn't actually have any methods other than one to let you create a swap chain.
For those same reasons, and because splitting the context across 2 classes is difficult to
understand, we can follow the same model, and unify Surface and SwapChain into the same class.
The name of the new unified class is PresentationContext. When a client wants to create a swap
chain, all we do is bump the reference count of the PresentationContext.
No test because there is no behavior change.
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/APIConversions.h:
(WebGPU::fromAPI):
* Source/WebGPU/WebGPU/Device.h:
* Source/WebGPU/WebGPU/Device.mm:
(wgpuDeviceCreateSwapChain):
* Source/WebGPU/WebGPU/Instance.h:
* Source/WebGPU/WebGPU/Instance.mm:
(WebGPU::Instance::createSurface):
(wgpuInstanceCreateSurface):
* Source/WebGPU/WebGPU/PresentationContext.h: Renamed from Source/WebGPU/WebGPU/Surface.h.
(WebGPU::PresentationContext::create):
(WebGPU::PresentationContext::displayBuffer const):
(WebGPU::PresentationContext::drawingBuffer const):
* Source/WebGPU/WebGPU/PresentationContext.mm: Renamed from Source/WebGPU/WebGPU/Surface.mm.
(WebGPU::optionsFor32BitSurface):
(WebGPU::createIOSurface):
(WebGPU::createSurfaceFromDescriptor):
(WebGPU::Device::createSurface):
(WebGPU::Device::createSwapChain):
(WebGPU::PresentationContext::PresentationContext):
(WebGPU::PresentationContext::getPreferredFormat):
(WebGPU::PresentationContext::configure):
(WebGPU::PresentationContext::present):
(WebGPU::PresentationContext::getCurrentTextureView):
(WebGPU::PresentationContext::nextDrawable):
(wgpuSurfaceRelease):
(wgpuSwapChainRelease):
(wgpuSurfaceGetPreferredFormat):
(wgpuSurfaceCocoaCustomSurfaceGetDisplayBuffer):
(wgpuSurfaceCocoaCustomSurfaceGetDrawingBuffer):
(wgpuSwapChainGetCurrentTextureView):
(wgpuSwapChainPresent):
* Source/WebGPU/WebGPU/SwapChain.h: Removed.
* Source/WebGPU/WebGPU/SwapChain.mm: Removed.
Canonical link: https://commits.webkit.org/258984@main
More information about the webkit-changes
mailing list