[webkit-changes] [WebKit/WebKit] d95821: Add plumbing to import WebGPU::Queue and WebGPU::B...
Commit Queue
noreply at github.com
Tue Oct 1 14:49:10 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d95821ede59f3e9ec15f2a11437f6b748cc9bcf7
https://github.com/WebKit/WebKit/commit/d95821ede59f3e9ec15f2a11437f6b748cc9bcf7
Author: Nitin Mahendru <nitinmahendru at apple.com>
Date: 2024-10-01 (Tue, 01 Oct 2024)
Changed paths:
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WTF/wtf/RefCounted.h
A Source/WTF/wtf/RetainReleaseSwift.h
M Source/WTF/wtf/ThreadSafeRefCounted.h
M Source/WebGPU/Configurations/WebGPU.xcconfig
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Source/WebGPU/WebGPU/Buffer.h
M Source/WebGPU/WebGPU/Instance.h
M Source/WebGPU/WebGPU/Queue.h
M Source/WebGPU/WebGPU/Queue.mm
A Source/WebGPU/WebGPU/Queue.swift
M Source/WebGPU/WebGPU/WebGPUExt.h
M Source/bmalloc/libpas/src/libpas/pas_utils.h
Log Message:
-----------
Add plumbing to import WebGPU::Queue and WebGPU::Buffer into Swift as reference types
https://bugs.webkit.org/show_bug.cgi?id=280409
rdar://136698682
Reviewed by Mike Wyrzykowski.
This change can be considered as a template to importing WebKit Reference types into Swift.
Using SWIFT_SHARED_REFERENCE with a type ensures that:
1. Swift holds a strong reference to the type passed in guaranteeing lifetime.
2. Swift will manage releasing the reference once it's done with that object.
Before this Change, it was impossible to import any RefCounted types as Swift by default will only
import Copy types and move types in certain cases. But for WebGPU work, this is really useful.
There are some extern C related changes done to keep header includes outside of extern C which is
needed for Swift Cpp Interop.
Other Changes:
1. Now Queue.h and Buffer.h are Project headers.
2. A new preprocessor define __WEBGPU__ has been added to guard these headers so they are only visible in
WebGPU.framework. The headers needed to be marked Project to keep Swift tapi generation happy.
3. This all is still disabled by default.
Test:
Build: make release BUILD_WEBKIT_OPTIONS="--webGPUSwift"
and then run all the tests under http/tests/webgpu/webgpu/api/operation/queue http/tests/webgpu/webgpu/api/validation/queue.
* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/RefCounted.h:
(retainRefCounted):
(releaseRefCounted):
* Source/WTF/wtf/RetainReleaseSwift.h: Added.
* Source/WTF/wtf/ThreadSafeRefCounted.h:
(retainThreadSafeRefCounted):
(releaseThreadSafeRefCounted):
* Source/WebGPU/Configurations/WebGPU.xcconfig:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/Buffer.h:
(retainBuffer):
(releaseBuffer):
* Source/WebGPU/WebGPU/Instance.h:
* Source/WebGPU/WebGPU/Queue.h:
(retainQueue):
(releaseQueue):
* Source/WebGPU/WebGPU/Queue.mm:
(WebGPU::Queue::writeBuffer):
* Source/WebGPU/WebGPU/Queue.swift: Added.
(writeBuffer(_:buffer:offset:data:)):
* Source/WebGPU/WebGPU/WebGPUExt.h:
* Source/bmalloc/libpas/src/libpas/pas_utils.h:
Canonical link: https://commits.webkit.org/284516@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