[webkit-changes] [WebKit/WebKit] 9ced63: [WebGPU] Implement GPUQuerySet

mwyrzykowski noreply at github.com
Wed Dec 21 23:39:12 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ced63bbda6ac9231451b1ca549a16f397e28c78
      https://github.com/WebKit/WebKit/commit/9ced63bbda6ac9231451b1ca549a16f397e28c78
  Author: Mike Wyrzykowski <mwyrzykowski at apple.com>
  Date:   2022-12-21 (Wed, 21 Dec 2022)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/GPUBuffer.h
    M Source/WebGPU/WebGPU/Buffer.mm
    M Source/WebGPU/WebGPU/CommandEncoder.h
    M Source/WebGPU/WebGPU/CommandEncoder.mm
    M Source/WebGPU/WebGPU/QuerySet.h
    M Source/WebGPU/WebGPU/QuerySet.mm
    M Source/WebGPU/WebGPU/RenderPassEncoder.h
    M Source/WebGPU/WebGPU/RenderPassEncoder.mm
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.messages.in
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandEncoder.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteBufferProxy.cpp
    A Websites/webkit.org/demos/webgpu/query-sets.html
    A Websites/webkit.org/demos/webgpu/scripts/query-sets.js

  Log Message:
  -----------
  [WebGPU] Implement GPUQuerySet
https://bugs.webkit.org/show_bug.cgi?id=249356
<radar://103379862>

Reviewed by Dean Jackson.

Implement visibility and timestamp queries.

* Source/WebCore/Modules/WebGPU/GPUBuffer.h:
(WebCore::GPUBuffer::~GPUBuffer):
Call the backing's destroy function so buffer
instances don't accumulate.

* Source/WebGPU/WebGPU/Buffer.mm:
(WebGPU::Buffer::unmap):
Reset the mapped state on unmap.

* Source/WebGPU/WebGPU/CommandEncoder.h:
* Source/WebGPU/WebGPU/CommandEncoder.mm:
(WebGPU::CommandEncoder::validateRenderPassDescriptor const):
(WebGPU::CommandEncoder::beginRenderPass):
(WebGPU::CommandEncoder::resolveQuerySet):
Resolve visibility and occlusion queries as needed.

(WebGPU::CommandEncoder::writeTimestamp):
writeTimestamp is not practical to implement on TBDR, the
best we can get is granularity of the render pass.

* Source/WebGPU/WebGPU/QuerySet.h:
(WebGPU::QuerySet::create):
(WebGPU::QuerySet::isValid const):
(WebGPU::QuerySet::queryCount const):
(WebGPU::QuerySet::visibilityBuffer const):
(WebGPU::QuerySet::counterSampleBuffer const):
* Source/WebGPU/WebGPU/QuerySet.mm:
(WebGPU::getCounterSet):
(WebGPU::Device::createQuerySet):
(WebGPU::QuerySet::QuerySet):
(WebGPU::QuerySet::destroy):
(WebGPU::QuerySet::setLabel):
(WebGPU::QuerySet::resolveTimestamps const):
Implement timestamp and visibility queries.

* Source/WebGPU/WebGPU/RenderPassEncoder.h:
(WebGPU::RenderPassEncoder::create):
Use timestamps queries if they are present in the descriptor.

* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(WebGPU::RenderPassEncoder::RenderPassEncoder):
(WebGPU::RenderPassEncoder::beginOcclusionQuery):
(WebGPU::RenderPassEncoder::endOcclusionQuery):
Metal calls for visibility queries.

* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.messages.in:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandEncoder.cpp:
(WebKit::RemoteCommandEncoder::copyBufferToBuffer):
Fix typo where source was being used as the source and destination.

* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQueue.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteBufferProxy.cpp:
(WebKit::WebGPU::RemoteBufferProxy::getMappedRange):
Return early if the buffer was already mapped by mapAsync.

* Websites/webkit.org/demos/webgpu/query-sets.html: Added.
* Websites/webkit.org/demos/webgpu/scripts/query-sets.js: Added.
(async helloTriangle.async frameUpdate):
(async helloTriangle):
Add a demo test for this work.

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




More information about the webkit-changes mailing list