[webkit-changes] [WebKit/WebKit] d2a1f8: [WebGPU] Vertex buffer support

mwyrzykowski noreply at github.com
Wed Nov 30 11:03:37 PST 2022


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

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebCore/Modules/WebGPU/GPUBuffer.cpp
    M Source/WebCore/Modules/WebGPU/GPUBuffer.h
    M Source/WebGPU/WebGPU/BindGroup.mm
    M Source/WebGPU/WebGPU/RenderPassEncoder.mm
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.messages.in
    M Source/WebKit/Shared/WebGPU/WebGPUBindGroupEntry.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteBufferProxy.cpp
    M Websites/webkit.org/demos/webgpu/hello-cube.html
    A Websites/webkit.org/demos/webgpu/scripts/hello-cube.js

  Log Message:
  -----------
  [WebGPU] Vertex buffer support
https://bugs.webkit.org/show_bug.cgi?id=248071
<radar://101564178>

Reviewed by Dean Jackson.

Implement basic vertex buffer support which supports the rotating cube test case.

Very preliminary bind group support is implemented, which only
supports 1 buffer of arbitrary size.

* Source/WebCore/Modules/WebGPU/GPUBuffer.cpp:
(WebCore::GPUBuffer::GPUBuffer):
(WebCore::GPUBuffer::getMappedRange):
(WebCore::GPUBuffer::unmap):
If the buffer is mappedAtCreation then the API allows for
writing to the mapped range even if the write flag is not set.

We need to store the JSC::ArrayBuffer too so we
can copy it back to the MTLBuffer when the client
calls GPUBuffer.unmap

* Source/WebCore/Modules/WebGPU/GPUBuffer.h:
* Source/WebGPU/WebGPU/BindGroup.mm:
(WebGPU::Device::createBindGroup):
Preliminary support for bind groups via tier2 argument
buffers which are substantially easier to implement as
the tier1 path was not functioning in my testing.

* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::setBindGroup):
(WebGPU::RenderPassEncoder::setVertexBuffer):
(WebGPU::RenderPassEncoder::setViewport):
Implement setting vertex buffer and bind groups.

* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.cpp:
(WebKit::RemoteBuffer::getMappedRange):
(WebKit::RemoteBuffer::unmap):
If the buffer is mappedAtCreation then the API  allows for
writing to the mapped range even if the write flag is not set.

* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.messages.in:
* Source/WebKit/Shared/WebGPU/WebGPUBindGroupEntry.cpp:
(WebKit::WebGPU::ConvertToBackingContext::convertToBacking):
Need to pass along a valid identifier unless the auto-generated
serializer asserts.

* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteBufferProxy.cpp:
(WebKit::WebGPU::RemoteBufferProxy::getMappedRange):
Support getMappedRange API.

* Websites/webkit.org/demos/webgpu/hello-cube.html:
* Websites/webkit.org/demos/webgpu/scripts/hello-cube.js: Added.
(async helloCube.frameUpdate):
(async helloCube):
Use requestAnimationFrame to spin the cube.

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




More information about the webkit-changes mailing list