Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ffc98ceb72ee397bd83b6d7d711fcb760b712c34
      
https://github.com/WebKit/WebKit/commit/ffc98ceb72ee397bd83b6d7d711fcb760b712c34
  Author: Myles C. Maxfield <mmaxfi...@apple.com>
  Date:   2023-01-24 (Tue, 24 Jan 2023)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/GPUSurfaceDescriptor.h
    M Source/WebCore/Modules/WebGPU/GPUSwapChainDescriptor.h
    M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp
    M Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUSurfaceDescriptor.h
    M Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUSwapChainDescriptor.h
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.cpp
    M Source/WebGPU/WebGPU/PresentationContextIOSurface.mm
    M Source/WebGPU/WebGPU/WebGPUExt.h
    M Source/WebKit/Shared/WebGPU/WebGPUSurfaceDescriptor.cpp
    M Source/WebKit/Shared/WebGPU/WebGPUSurfaceDescriptor.h
    M Source/WebKit/Shared/WebGPU/WebGPUSurfaceDescriptor.serialization.in
    M Source/WebKit/Shared/WebGPU/WebGPUSwapChainDescriptor.cpp
    M Source/WebKit/Shared/WebGPU/WebGPUSwapChainDescriptor.h
    M Source/WebKit/Shared/WebGPU/WebGPUSwapChainDescriptor.serialization.in

  Log Message:
  -----------
  [WebGPU] Align SurfaceDescriptor and SwapChainDescriptor with the spec and 
WebGPU.h
https://bugs.webkit.org/show_bug.cgi?id=250994
rdar://104539553

Reviewed by Dean Jackson.

Conceptually, a Surface corresponds to a GPUCanvasContext, and a SwapChain 
corresponds to a call
to GPUCanvasContext.configure(). Both the spec and WebGPU.h agree that the 
Surface should be
constructable with almost nothing - you don't even need a device or any WebGPU 
objects to create
a GPUCanvasContext object from a canvas. Creating a swap chain (via 
GPUCanvasContext.configure())
is where the guts are - that's where all the properties of the textures are 
specified, so that's
where we can finally create IOSurfaces.

Right now, we treat Surfaces and SwapChains as siblings - they have the same 
lifetime inside
GPUCanvasContext.cpp, so this patch is purely mechanical right now. However, 
there will be 2
follow-up patches in the future:

1. Connecting CompositorIntegration (from 
https://github.com/WebKit/WebKit/pull/8933) to Surface.
       This will provide a natural owner for the IOSurface renderbuffers, as 
well as a message
       receiver so these IOSurfaces can be communicated to the compositor. 
Mechanically, this
       change will add a CompositorIntegration inside SurfaceDescriptor.
2. We can move the lifetime of Surface to be created a bit earlier than 
SwapChain, because there's
       no reason to delay creating it; it can be created with almost no 
information.

A special note about width and height: The WebGPU spec used to include these as 
arguments to
GPUCanvasContext.configure(), but we changed the spec to have that information 
come from the
canvas itself rather than being supplied by the site author. So, conceptually, 
these fields
still belong in the SwapChainDescriptor, and they are present there in this 
patch. This also
matches what WebGPU.h says - those fields are present in the 
SwapChainDescriptor.

* Source/WebCore/Modules/WebGPU/GPUSurfaceDescriptor.h:
(WebCore::GPUSurfaceDescriptor::convertToBacking const):
(): Deleted.
* Source/WebCore/Modules/WebGPU/GPUSwapChainDescriptor.h:
(WebCore::GPUSwapChainDescriptor::convertToBacking const):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp:
(PAL::WebGPU::DeviceImpl::createSurface):
(PAL::WebGPU::DeviceImpl::createSwapChain):
(PAL::WebGPU::convertToWidthHeight): Deleted.
* Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUSurfaceDescriptor.h:
(): Deleted.
* Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUSwapChainDescriptor.h:
* Source/WebCore/html/canvas/GPUCanvasContext.cpp:
(WebCore::GPUCanvasContext::createSwapChainIfNeeded):
* Source/WebGPU/WebGPU/PresentationContextIOSurface.mm:
(WebGPU::createIOSurface):
(WebGPU::createSurfaceFromDescriptor):
(WebGPU::PresentationContextIOSurface::PresentationContextIOSurface):
(WebGPU::PresentationContextIOSurface::configure):
* Source/WebGPU/WebGPU/WebGPUExt.h:
* Source/WebKit/Shared/WebGPU/WebGPUSurfaceDescriptor.cpp:
(WebKit::WebGPU::ConvertToBackingContext::convertToBacking):
(WebKit::WebGPU::ConvertFromBackingContext::convertFromBacking):
* Source/WebKit/Shared/WebGPU/WebGPUSurfaceDescriptor.h:
(): Deleted.
* Source/WebKit/Shared/WebGPU/WebGPUSurfaceDescriptor.serialization.in:
* Source/WebKit/Shared/WebGPU/WebGPUSwapChainDescriptor.cpp:
(WebKit::WebGPU::ConvertToBackingContext::convertToBacking):
(WebKit::WebGPU::ConvertFromBackingContext::convertFromBacking):
* Source/WebKit/Shared/WebGPU/WebGPUSwapChainDescriptor.h:
* Source/WebKit/Shared/WebGPU/WebGPUSwapChainDescriptor.serialization.in:

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to