Skip to content

[iOS] Panic on CaptureMTLDevice when requesting adapter with Xcode GPU Frame Capture enabled (v29.0.0) #9282

@jinleili

Description

@jinleili

Description
After upgrading wgpu from v28 to v29, running my iOS app natively on a device with Xcode's GPU Frame Capture enabled immediately crashes.

Repro steps
The initial crash occurs when wgpu_hal::metal::AdapterShared::expose attempts to call supports32BitFloatFiltering on the device, resulting in an unrecognized selector error. If this is patched dynamically via Objective-C runtime, it immediately crashes again on hasUnifiedMemory.

These selectors seem to be unimplemented by Apple's private CaptureMTLDevice proxy object used during Metal frame capture. wgpu v28 handled this gracefully (or did not query these capabilities directly through objc2-metal).

Extra materials
Stack traces:

thread '<unnamed>' panicked at /.../objc2-metal-0.3.2/src/generated/MTLDevice.rs:
invalid message send to -[CaptureMTLDevice supports32BitFloatFiltering]: method not found
...
  15: objc2_metal::generated::__MTLDevice::MTLDevice::supports32BitFloatFiltering
  16: wgpu_hal::metal::adapter::<impl wgpu_hal::metal::CapabilitiesQuery>::new
  17: wgpu_hal::metal::AdapterShared::expose

And after swizzling supports32BitFloatFiltering, the crash moves to hasUnifiedMemory:

thread '<unnamed>' panicked at /.../objc2-metal-0.3.2/src/generated/MTLDevice.rs:
invalid message send to -[CaptureMTLDevice hasUnifiedMemory]: method not found
...
  15: objc2_metal::generated::__MTLDevice::MTLDevice::hasUnifiedMemory
  16: wgpu_hal::metal::adapter::<impl wgpu_hal::metal::CapabilitiesQuery>::new
  17: wgpu_hal::metal::AdapterShared::expose

Platform
macOS v26.3, Xcode v26.3, iOS v26.3, wgpu v29, .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions