[webkit-changes] [WebKit/WebKit] 2c1db2: Bringup red triangle

mwyrzykowski noreply at github.com
Mon Nov 7 09:59:03 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2c1db243aa9045fbf805474425d1e7e8d9906e8d
      https://github.com/WebKit/WebKit/commit/2c1db243aa9045fbf805474425d1e7e8d9906e8d
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2022-11-07 (Mon, 07 Nov 2022)

  Changed paths:
    M Source/WTF/Scripts/Preferences/WebPreferences.yaml
    M Source/WTF/wtf/PlatformEnable.h
    M Source/WTF/wtf/PlatformEnableCocoa.h
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Headers.cmake
    R Source/WebCore/Modules/WebGPU/GPUCanvasContext.cpp
    R Source/WebCore/Modules/WebGPU/GPUCanvasContext.h
    R Source/WebCore/Modules/WebGPU/GPUCanvasContext.idl
    M Source/WebCore/Modules/applepay/PaymentCoordinator.cpp
    M Source/WebCore/Modules/mediastream/RTCIceCandidateFields.cpp
    M Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransformBackend.h
    M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUBufferImpl.cpp
    M Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUDevice.h
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/Document.h
    M Source/WebCore/dom/Document.idl
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/HTMLCanvasElement.h
    M Source/WebCore/html/HTMLCanvasElement.idl
    M Source/WebCore/html/canvas/CanvasRenderingContext.h
    A Source/WebCore/html/canvas/GPUCanvasContext.cpp
    A Source/WebCore/html/canvas/GPUCanvasContext.h
    A Source/WebCore/html/canvas/GPUCanvasContext.idl
    M Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h
    M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm
    M Source/WebCore/platform/graphics/cocoa/IOSurface.mm
    M Source/WebCore/platform/graphics/cocoa/WebProcessGraphicsContextGLCocoa.mm
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebGPU/WebGPU/Adapter.mm
    M Source/WebGPU/WebGPU/Buffer.mm
    M Source/WebGPU/WebGPU/CommandEncoder.h
    M Source/WebGPU/WebGPU/CommandEncoder.mm
    M Source/WebGPU/WebGPU/Device.h
    M Source/WebGPU/WebGPU/Instance.mm
    M Source/WebGPU/WebGPU/RenderPassEncoder.h
    M Source/WebGPU/WebGPU/RenderPassEncoder.mm
    M Source/WebGPU/WebGPU/RenderPipeline.h
    M Source/WebGPU/WebGPU/RenderPipeline.mm
    M Source/WebGPU/WebGPU/ShaderModule.h
    M Source/WebGPU/WebGPU/ShaderModule.mm
    M Source/WebGPU/WebGPU/Texture.h
    M Source/WebGPU/WebGPU/Texture.mm
    M Source/WebGPU/WebGPU/WebGPU.h
    M Source/WebKit/Shared/WebGPU/WebGPURenderPassColorAttachment.cpp
    M Source/WebKit/Shared/WebGPU/WebGPURenderPassColorAttachment.h
    M Source/WebKit/Shared/WebGPU/WebGPURenderPassColorAttachment.serialization.in
    M Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.cpp
    M Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.h
    M Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteQueueProxy.h
    M Websites/webkit.org/demos/webgpu/scripts/hello-triangle.js

  Log Message:
  -----------
  Bringup red triangle
https://bugs.webkit.org/show_bug.cgi?id=247017
<radar://101514401>

Implement necessary interfaces to show a red triangle when WebGPU is enabled.

Reviewed by Myles C. Maxfield.

* Source/WTF/Scripts/Preferences/WebPreferences.yaml:
Place WebGPU enablement behind a local define.

* Source/WebCore/Modules/WebGPU/GPUCanvasContext.cpp:
(WebCore::getCanvasSizeAsIntSize):
(WebCore::platformSupportsWebGPUSurface):
(WebCore::GPUCanvasContext::create):
(WebCore::GPUCanvasContext::GPUCanvasContext):
(WebCore::GPUCanvasContext::reshape):
(WebCore::GPUCanvasContext::canvas):
(WebCore::GPUCanvasContext::configure):
(WebCore::GPUCanvasContext::getCurrentTexture):
(WebCore::GPUCanvasContext::pixelFormat const):
(WebCore::GPUCanvasContext::unconfigure):
(WebCore::GPUCanvasContext::colorSpace const):
(WebCore::GPUCanvasContext::layerContentsDisplayDelegate):
(WebCore::GPUCanvasContext::prepareForDisplay):
(WebCore::GPUCanvasContext::markContextChangedAndNotifyCanvasObservers):
Stub out implementation of GPUCanvasContext.

* Source/WebCore/Modules/WebGPU/GPUCanvasContext.h:
(WebCore::GPUCanvasContext::create): Deleted.
Renamed.

* Source/WebCore/Modules/WebGPU/GPUCanvasContext.idl:
Add ActiveDOMObject.

* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUBufferImpl.cpp:
(PAL::WebGPU::BufferImpl::getMappedRange):
Use the size of the buffer and not WGPU_WHOLE_MAP_SIZE, otherwise the
returned buffer size does not match what the client expects.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::getCSSCanvasContext):
Return gpu canvas if needed.

* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Document.idl:
Add support for GPUCanvas.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):
(WebCore::HTMLCanvasElement::isWebGPUType):
(WebCore::HTMLCanvasElement::createContextWebGPU):
(WebCore::HTMLCanvasElement::getContextWebGPU):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/HTMLCanvasElement.idl:
* Source/WebCore/html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::isWebGPU const):
Add support for gpu canvas.

* Source/WebCore/platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::createFromSurface):
Return nullptr if surface is 0.

* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::shouldSetContentsDisplayDelegate const):
(WebCore::RenderLayerBacking::updateConfiguration):
* Source/WebCore/rendering/RenderLayerBacking.h:
Add support for gpu canvas.

* Source/WebGPU/WebGPU/Buffer.mm:
(wgpuBufferGetSize):
Comes from the WebGPU repo.

* Source/WebGPU/WebGPU/CommandEncoder.h:
* Source/WebGPU/WebGPU/CommandEncoder.mm:
(WebGPU::loadAction):
(WebGPU::storeAction):
(WebGPU::CommandEncoder::validateRenderPassDescriptor const):
(WebGPU::CommandEncoder::beginRenderPass):
* Source/WebGPU/WebGPU/Device.h:
Add some basic validation for beginning the render pass.

* Source/WebGPU/WebGPU/RenderPassEncoder.h:
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::~RenderPassEncoder):
(WebGPU::RenderPassEncoder::draw):
(WebGPU::RenderPassEncoder::endPass):
(WebGPU::RenderPassEncoder::setPipeline):
Setup the pipeline and make the call to draw a number of
primitives.

* Source/WebGPU/WebGPU/RenderPipeline.h:
(WebGPU::RenderPipeline::create):
(WebGPU::RenderPipeline::primitiveType const):
(WebGPU::RenderPipeline::maybeIndexType const):
(WebGPU::RenderPipeline::frontFace const):
(WebGPU::RenderPipeline::cullMode const):
* Source/WebGPU/WebGPU/RenderPipeline.mm:
(WebGPU::blendOperation):
(WebGPU::blendFactor):
(WebGPU::colorWriteMask):
(WebGPU::frontFace):
(WebGPU::cullMode):
(WebGPU::primitiveType):
(WebGPU::indexType):
(WebGPU::Device::validateRenderPipeline):
(WebGPU::Device::createRenderPipeline):
(WebGPU::RenderPipeline::RenderPipeline):
Add some basic pipeline support and validation.

* Source/WebGPU/WebGPU/ShaderModule.h:
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::earlyCompileShaderModule):
Fallback to the MSL string if the shader length is 0.

(WebGPU::ShaderModule::getNamedFunction const):
Lookup the function from the metal library.

* Source/WebGPU/WebGPU/Texture.h:
* Source/WebGPU/WebGPU/Texture.mm:
(WebGPU::Texture::pixelFormat):
(WebGPU::Texture::depthOnlyAspectMetalFormat):
(WebGPU::Texture::stencilOnlyAspectMetalFormat):
(WebGPU::Device::createTexture):
(WebGPU::Texture::resolveTextureViewDescriptorDefaults const):
(WebGPU::Texture::resolveTextureFormat):
(WebGPU::Texture::validateCreateView const):
(WebGPU::Texture::createView):
(WebGPU::pixelFormat): Deleted.
(WebGPU::depthOnlyAspectMetalFormat): Deleted.
(WebGPU::stencilOnlyAspectMetalFormat): Deleted.
Add support for some additional texture formats.

* Source/WebGPU/WebGPU/WebGPU.h:
wgpuBufferGetSize is in the public header.

* Source/WebGPU/WebGPU/WebGPUExt.h:
IOSurface support.

* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp:
(WebKit::RemoteAdapter::RemoteAdapter):

* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.cpp:
(WebKit::RemoteBuffer::mapAsync):
Mapping the buffer for writing was not providing a buffer of the correct length.

(WebKit::RemoteDevice::createIOSurfaceBackedTexture):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.messages.in:
Create IOSurface backed texture.

* Source/WebKit/Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::trySendSyncStream):
WebGPU sends a SetStreamDestinationID message which would previously
trigger an assertion here.

* Source/WebKit/Shared/WebGPU/WebGPURenderPassColorAttachment.cpp:
(WebKit::WebGPU::ConvertToBackingContext::convertToBacking):
(WebKit::WebGPU::ConvertFromBackingContext::convertFromBacking):
* Source/WebKit/Shared/WebGPU/WebGPURenderPassColorAttachment.h:
* Source/WebKit/Shared/WebGPU/WebGPURenderPassColorAttachment.serialization.in:
* Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.cpp:
(WebKit::WebGPU::ConvertToBackingContext::convertToBacking):
(WebKit::WebGPU::ConvertFromBackingContext::convertFromBacking):
* Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.h:
* Source/WebKit/Shared/WebGPU/WebGPURenderPassDescriptor.serialization.in:
Use optional values for resolveTargets and occlusionQuerySets as they
do not need to be specified.

* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteQueueProxy.h:
adoptRef was not getting called on m_parent leading to crashes, but
its not appearent why it was a Ref<> in the first place.

* Websites/webkit.org/demos/webgpu/scripts/hello-triangle.js:
(async helloTriangle):
Update javascript to new syntax.

* Source/WebCore/html/canvas/GPUCanvasContext.cpp:
* Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp:
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
* Source/WebCore/platform/graphics/cocoa/WebProcessGraphicsContextGLCocoa.mm:
Add missing includes and forward declarations.

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




More information about the webkit-changes mailing list