Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c3f6cc3af29cfe85fd955830d1a2b59da4cc670e
https://github.com/WebKit/WebKit/commit/c3f6cc3af29cfe85fd955830d1a2b59da4cc670e
Author: Richard Robinson <[email protected]>
Date: 2025-12-16 (Tue, 16 Dec 2025)
Changed paths:
M Source/WTF/Configurations/WTF.xcconfig
M Source/WebGPU/Configurations/WebGPU.xcconfig
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Source/WebGPU/WebGPU/Buffer.h
M Source/WebGPU/WebGPU/Buffer.mm
M Source/WebGPU/WebGPU/Buffer.swift
M Source/WebGPU/WebGPU/CommandBuffer.h
M Source/WebGPU/WebGPU/CommandEncoder.h
M Source/WebGPU/WebGPU/CommandEncoder.mm
M Source/WebGPU/WebGPU/CommandEncoder.swift
M Source/WebGPU/WebGPU/ComputePassEncoder.h
M Source/WebGPU/WebGPU/CxxBridging.h
A Source/WebGPU/WebGPU/CxxBridgingPublic.h
M Source/WebGPU/WebGPU/DDMesh.mm
M Source/WebGPU/WebGPU/Device.h
M Source/WebGPU/WebGPU/Device.mm
M Source/WebGPU/WebGPU/HardwareCapabilities.h
M Source/WebGPU/WebGPU/Instance.mm
R Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h
M Source/WebGPU/WebGPU/Internal/module.modulemap
M Source/WebGPU/WebGPU/QuerySet.h
M Source/WebGPU/WebGPU/Queue.mm
M Source/WebGPU/WebGPU/Queue.swift
M Source/WebGPU/WebGPU/StdLibExtras.swift
M Source/WebGPU/WebGPU/Texture.h
M Source/WebGPU/WebGPU/TextureView.h
M Source/WebGPU/WebGPU/USDModel.swift
A Source/WebGPU/WebGPU/WGPUBufferImpl.h
A Source/WebGPU/WebGPU/WGPUQuerySetImpl.h
A Source/WebGPU/WebGPU/WGPUTextureImpl.h
A Source/WebGPU/WebGPU/WGPUTextureViewImpl.h
M Source/WebGPU/WebGPU/WebGPU.h
M Source/WebGPU/WebGPU/WebGPU.modulemap
A Source/WebGPU/WebGPU/WebGPU_Private.modulemap
Log Message:
-----------
[Swift in WebKit] Fix the modularization of WebGPU
https://bugs.webkit.org/show_bug.cgi?id=304043
rdar://166342376
Reviewed by Mike Wyrzykowski.
Make some changes to correct all modularization issues in WebGPU.
Build configuration stuff:
- Enable the module verifier in Objective C++ mode for WebGPU.
- Set SWIFT_LIBRARY_LEVEL to its proper value.
- The enablement of `ENABLE_WEBGPU_SWIFT` for macOS was conditionalized on the
architecture.
However, in some parts of the build, this value is `undefined`. This leads to
incredibly
confusing and surprising results. To address this, and to allow module
verification to
actually be conditionalized on `ENABLE_WEBGPU_SWIFT`, just enable
`ENABLE_WEBGPU_SWIFT` at
build time on all architectures on macOS.
- Set the `-emit-clang-header-min-access` flag to `internal` so that Swift
declarations need
not be `public`; not only is this just reasonably better, it's also necessary
for reasons
described below.
Access level / exposed interface stuff:
- Previously, there were public Swift functions that depended on project-level
C++ types.
This is an access level violation and modules violation and probably some other
violations,
and was leading to a variety of build issues. By making all the Swift symbols
internal
instead of public, this fixes that.
- Add more explicit access level specifiers to the import statements for
clarity.
- Some functions and types were declared in the public module, and then
implemented in the
internal project module. This is a modules violation and was causing issues
with Cxx
interoperability being able to find the necessary functions and types. Fix this
by just
moving the implementation to the public module.
Modules stuff:
- Add missing header includes and module imports
- Add a private module map, `WebGPU_Private.modulemap` for the private headers
in WebGPU
- Fix the existing public module map
- Fix the existing internal module map; turns out, it's invalid and not
supported for a
framework project internal module to have an umbrella header, since those are
meant to
comprise everything in a single directory, which isn't the case for the
structure of project
internal headers; it essentially was only "working" by happenstance.
Consequently, fix this
by explicitly creating all the sub-modules, and make them explicit for clarity
and to also
avoid any confusing implicit imports.
Misc. stuff:
- Fix compile time errors now that x86_64 compiles the Swift code
- Device.h needs to out-of-line the implementation of
`vertexBufferIndexForBindGroup` since
WebGPU cannot have a header file dependent on WGSL because WGSL is not a
well-formed library/
module.
* Source/WTF/Configurations/WTF.xcconfig:
* Source/WebGPU/Configurations/WebGPU.xcconfig:
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/Buffer.h:
* Source/WebGPU/WebGPU/Buffer.mm:
* Source/WebGPU/WebGPU/Buffer.swift:
(Buffer_copyFrom_thunk(_:from:offset:)):
(Buffer_getMappedRange_thunk(_:offset:size:)):
* Source/WebGPU/WebGPU/CommandBuffer.h:
* Source/WebGPU/WebGPU/CommandEncoder.h:
* Source/WebGPU/WebGPU/CommandEncoder.mm:
* Source/WebGPU/WebGPU/CommandEncoder.swift:
(WebGPU.finish(_:)):
(WebGPU.clearTextureIfNeeded(_:slice:)):
(resolveQuerySet(_:querySet:firstQuery:queryCount:destination:destinationOffset:)):
Deleted.
(CommandEncoder_copyBufferToBuffer_thunk(_:source:sourceOffset:destination:destinationOffset:size:)):
Deleted.
(WebGPU.clearTextureIfNeeded(_:slice:device:blitCommandEncoder:)): Deleted.
* Source/WebGPU/WebGPU/ComputePassEncoder.h:
* Source/WebGPU/WebGPU/DDMesh.mm:
* Source/WebGPU/WebGPU/Device.h:
(WebGPU::Device::vertexBufferIndexForBindGroup const): Deleted.
* Source/WebGPU/WebGPU/Device.mm:
* Source/WebGPU/WebGPU/HardwareCapabilities.h:
* Source/WebGPU/WebGPU/Instance.mm:
* Source/WebGPU/WebGPU/Internal/module.modulemap:
* Source/WebGPU/WebGPU/QuerySet.h:
* Source/WebGPU/WebGPU/Queue.mm:
* Source/WebGPU/WebGPU/Queue.swift:
(Queue_writeBuffer_thunk(_:buffer:bufferOffset:data:)):
(WebGPU.writeBuffer(_:bufferOffset:data:)):
* Source/WebGPU/WebGPU/StdLibExtras.swift:
* Source/WebGPU/WebGPU/Texture.h:
* Source/WebGPU/WebGPU/TextureView.h:
* Source/WebGPU/WebGPU/USDModel.swift:
* Source/WebGPU/WebGPU/WGPUBufferImpl.h: Copied from
Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h.
* Source/WebGPU/WebGPU/WGPUQuerySetImpl.h: Copied from
Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h.
* Source/WebGPU/WebGPU/WGPUTextureImpl.h: Copied from
Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h.
* Source/WebGPU/WebGPU/WGPUTextureViewImpl.h: Renamed from
Source/WebGPU/WebGPU/Internal/WebGPUSwiftInternal.h.
* Source/WebGPU/WebGPU/WebGPU.h:
* Source/WebGPU/WebGPU/WebGPU.modulemap:
* Source/WebGPU/WebGPU/WebGPU_Private.modulemap: Added.
Canonical link: https://commits.webkit.org/304524@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications