[webkit-changes] [WebKit/WebKit] 817f9d: [WebGPU] Minor cleanup in QuerySet

Myles C. Maxfield noreply at github.com
Tue Feb 7 01:16:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 817f9dbade8cdcb1fecc679eda0d0632a2c1f481
      https://github.com/WebKit/WebKit/commit/817f9dbade8cdcb1fecc679eda0d0632a2c1f481
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-02-07 (Tue, 07 Feb 2023)

  Changed paths:
    M Source/WebGPU/WebGPU/CommandEncoder.mm
    M Source/WebGPU/WebGPU/QuerySet.h
    M Source/WebGPU/WebGPU/QuerySet.mm
    M Tools/Scripts/webkitpy/style/checkers/cpp.py

  Log Message:
  -----------
  [WebGPU] Minor cleanup in QuerySet
https://bugs.webkit.org/show_bug.cgi?id=251767
rdar://105062705

Reviewed by Tadeu Zagallo.

This doesn't actually change any behavior; I'm just moving stuff around for stylistic reasons.

A few varied cleanups:
1. We have 3 types of queries, so CommandEncoder::resolveQuerySet() should use a switch instead
       of an if statement
2. Instead of the constructor reverse-engineering the number of queries and their type, we can
       just pass them directly as arguments, and remember them
3. isValid() needs to return false after destroy() is called
4. We can set the label of the MTLCounterSampleBuffers / MTLBuffer
5. HardwareCapabilities already found the MTLCommonCounterTimestamp if it exists, so we can just
       use the one that we already have

* Source/WebGPU/WebGPU/CommandEncoder.mm:
(WebGPU::CommandEncoder::resolveQuerySet):
* Source/WebGPU/WebGPU/QuerySet.h:
(WebGPU::QuerySet::create):
(WebGPU::QuerySet::isValid const):
(WebGPU::QuerySet::count const):
(WebGPU::QuerySet::type const):
(WebGPU::QuerySet::queryCount const): Deleted.
* Source/WebGPU/WebGPU/QuerySet.mm:
(WebGPU::Device::createQuerySet):
(WebGPU::QuerySet::QuerySet):
(WebGPU::QuerySet::setLabel):
(WebGPU::QuerySet::resolveTimestamps const):
(wgpuQuerySetGetCount):
(wgpuQuerySetGetType):
(WebGPU::QuerySet::queryType const): Deleted.

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




More information about the webkit-changes mailing list