Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 13a0a058dc59ba56b2cf5e98dad61ca86350fe8d
      
https://github.com/WebKit/WebKit/commit/13a0a058dc59ba56b2cf5e98dad61ca86350fe8d
  Author: David Kilzer <[email protected]>
  Date:   2026-07-26 (Sun, 26 Jul 2026)

  Changed paths:
    M Source/WebGPU/WebGPU/Buffer.h
    M Source/WebGPU/WebGPU/CommandBuffer.h
    M Source/WebGPU/WebGPU/CommandEncoder.h
    M Source/WebGPU/WebGPU/ComputePassEncoder.h
    M Source/WebGPU/WebGPU/Device.h
    M Source/WebGPU/WebGPU/QuerySet.h
    M Source/WebGPU/WebGPU/Queue.h
    M Source/WebGPU/WebGPU/RenderPassEncoder.h
    M Source/WebGPU/WebGPU/Texture.h
    M Source/WebGPU/WebGPU/TextureView.h

  Log Message:
  -----------
  [WebGPU] Swift build fails with "cannot infer ownership of foreign reference 
value" errors
<https://bugs.webkit.org/show_bug.cgi?id=320306>
<rdar://183239080>

Reviewed by Adrian Taylor.

The WebGPU implementation types are foreign reference types
(`SWIFT_SHARED_REFERENCE`), but none of them declares how Swift should
treat the ownership of a returned value.  A stricter Swift toolchain
rejects this: any function returning one of these types -- such as
`WTF::Ref<T>::ptr()` or the `WebGPU::fromAPI()` overloads -- fails to
import because the compiler cannot infer whether the result is passed
retained (+1) or unretained (+0).

Mark each WebGPU foreign reference type
`SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`.  Like all normal WebKit
ref-counted types, they are returned +0, so a caller does not take
ownership of the returned reference.  This mirrors the annotation
already applied to other WebKit types in bug 310101 (309469@main),
which the WebGPU types were missing.

No new tests since this change is not directly testable.

* Source/WebGPU/WebGPU/Buffer.h:
(WebGPU::Buffer):
* Source/WebGPU/WebGPU/CommandBuffer.h:
(WebGPU::CommandBuffer):
* Source/WebGPU/WebGPU/CommandEncoder.h:
(WebGPU::CommandEncoder):
* Source/WebGPU/WebGPU/ComputePassEncoder.h:
(WebGPU::ComputePassEncoder):
* Source/WebGPU/WebGPU/Device.h:
(WebGPU::Device):
* Source/WebGPU/WebGPU/QuerySet.h:
(WebGPU::QuerySet):
* Source/WebGPU/WebGPU/Queue.h:
(WebGPU::Queue):
* Source/WebGPU/WebGPU/RenderPassEncoder.h:
(WebGPU::RenderPassEncoder):
* Source/WebGPU/WebGPU/Texture.h:
(WebGPU::Texture):
* Source/WebGPU/WebGPU/TextureView.h:
(WebGPU::TextureView):

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



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

Reply via email to