[webkit-changes] [WebKit/WebKit] 9aa7a3: [WebGPUSwift] Replace copyBufferToTexture with a S...

nmahendru noreply at github.com
Tue Dec 3 17:57:23 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9aa7a3270fbb68cbecf8e05ea841447848cc3885
      https://github.com/WebKit/WebKit/commit/9aa7a3270fbb68cbecf8e05ea841447848cc3885
  Author: Nitin Mahendru <nitinmahendru at apple.com>
  Date:   2024-12-03 (Tue, 03 Dec 2024)

  Changed paths:
    M Source/WTF/wtf/RefCounted.h
    M Source/WTF/wtf/RetainReleaseSwift.h
    M Source/WTF/wtf/ThreadSafeRefCounted.h
    M Source/WTF/wtf/ThreadSafeWeakPtr.h
    M Source/WebGPU/Configurations/WebGPU.xcconfig
    M Source/WebGPU/WebGPU/Buffer.h
    M Source/WebGPU/WebGPU/CommandEncoder.h
    M Source/WebGPU/WebGPU/CommandEncoder.mm
    M Source/WebGPU/WebGPU/CommandEncoder.swift
    M Source/WebGPU/WebGPU/Device.h
    M Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h
    M Source/WebGPU/WebGPU/QuerySet.h
    M Source/WebGPU/WebGPU/Queue.h
    M Source/WebGPU/WebGPU/Queue.swift
    M Source/WebGPU/WebGPU/Texture.h
    M Source/WebGPU/WebGPU/WebGPUExt.h
    M Source/bmalloc/libpas/src/libpas/pas_darwin_spi.h
    M Source/bmalloc/libpas/src/libpas/pas_lock.h
    M Source/bmalloc/libpas/src/libpas/pas_malloc_stack_logging.h

  Log Message:
  -----------
  [WebGPUSwift] Replace copyBufferToTexture with a Swift implementation
https://bugs.webkit.org/show_bug.cgi?id=281757
rdar://138188859

Reviewed by Mike Wyrzykowski.

The replacement is 1-for-1. Disabled by default.
One thing which is not the best is that we had to do a lot of Integer
conversions which are always explicit in Swift but implicit in C++.
NSUInteger has been mapped to UInt.

The return values of APIConversions.h::fromAPI are usable in Swift and Swift should
do its counting to hold a strong reference until it needs that value. So there is no
need for Ref<Buffer>(apiBuffer) and Ref<Texture>(destinationTexture) as used in the C++ Implementation.

Fly by changes in this PR:
1. Swift 6 mode is now enabled.
2. The duplicate definitions of retain/release helpers for the C++ refcounted classes have been cleaned up.

Some workarounds:
1. <pthread/private.h> has been imported without extern "C" to facilitate usage with Swift Clang Importer.
2. <os/lock_private.h> needs OS_UNFAIR_LOCK_INLINE=1 but as it's being imported as a module for the swift build
   the define needs to be passed in as a command line flag as modules are precompiled and they don't consider
   what's including them and what's defined above them.
   (The assumption is that WebGPUSwift build will always use the internal SDK)

Testing:
Manually ran the test:
./LayoutTests/http/tests/webgpu/webgpu/api/operation/command_buffer/image_copy.html

* Source/WTF/wtf/RefCounted.h:
(WTF::ref):
(WTF::deref):
(WTF::retainRefCounted): Deleted.
(WTF::releaseRefCounted): Deleted.
* Source/WTF/wtf/RetainReleaseSwift.h:
* Source/WTF/wtf/ThreadSafeRefCounted.h:
(WTF::retainThreadSafeRefCounted): Deleted.
(WTF::releaseThreadSafeRefCounted): Deleted.
* Source/WTF/wtf/ThreadSafeWeakPtr.h:
(WTF::retainThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr): Deleted.
(WTF::releaseThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr): Deleted.
* Source/WebGPU/Configurations/WebGPU.xcconfig:
* Source/WebGPU/WebGPU/Buffer.h:
(refBuffer):
(derefBuffer):
(retainBuffer): Deleted.
(releaseBuffer): Deleted.
* Source/WebGPU/WebGPU/CommandEncoder.h:
(refCommandEncoder):
(derefCommandEncoder):
(retainCommandEncoder): Deleted.
(releaseCommandEncoder): Deleted.
* Source/WebGPU/WebGPU/CommandEncoder.mm:
* Source/WebGPU/WebGPU/CommandEncoder.swift:
(CommandEncoder_copyBufferToTexture_thunk(_:source:destination:copySize:)):
(WebGPU.copyBufferToTexture(_:destination:copySize:)):
* Source/WebGPU/WebGPU/Device.h:
(WebGPU::Device::limitsCopy const):
(refDevice):
(derefDevice):
(retainDevice): Deleted.
(releaseDevice): Deleted.
* Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h:
* Source/WebGPU/WebGPU/QuerySet.h:
(refQuerySet):
(derefQuerySet):
(retainQuerySet): Deleted.
(releaseQuerySet): Deleted.
* Source/WebGPU/WebGPU/Queue.h:
(refQueue):
(derefQueue):
(retainQueue): Deleted.
(releaseQueue): Deleted.
* Source/WebGPU/WebGPU/Queue.swift:
(WebGPU.writeBuffer(_:bufferOffset:data:)):
* Source/WebGPU/WebGPU/Texture.h:
(refTexture):
(derefTexture):
* Source/WebGPU/WebGPU/WebGPUExt.h:
* Source/bmalloc/libpas/src/libpas/pas_darwin_spi.h:
* Source/bmalloc/libpas/src/libpas/pas_lock.h:
* Source/bmalloc/libpas/src/libpas/pas_malloc_stack_logging.h:
(pas_msl_malloc_logging):
(pas_msl_free_logging):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list