Skip to content

Fix Metal crash on Intel Mac AMD GPU (missing setArgumentBuffer)#94

Open
wendlinga wants to merge 1 commit intorenderbag:mainfrom
wendlinga:fix/apple-clang
Open

Fix Metal crash on Intel Mac AMD GPU (missing setArgumentBuffer)#94
wendlinga wants to merge 1 commit intorenderbag:mainfrom
wendlinga:fix/apple-clang

Conversation

@wendlinga
Copy link
Copy Markdown

@wendlinga wendlinga commented Apr 15, 2026

Problem

On macOS 11+, all GPUs are reported as Metal Argument Buffers Tier 2.
The MetalDescriptorSet constructor therefore skips calling
setArgumentBuffer() on the argument encoder when
useArgumentBuffersTier2 = true. However, when setDescriptor() later
calls argumentEncoder->setBuffer(...) for a DataTypePointer binding,
the AMD driver crashes because the encoder has no backing buffer:

-[BronzeMtlIndirectArgumentBufferEncoder setBuffer:offset:atIndex:] + 44
plume::MetalDescriptorSet::setDescriptor(...)

Crash observed on: Intel MacBook Pro, AMD Radeon 555X (AMDMTLBronzeDriver),
macOS 15.7.4.

Fix

In the DataTypePointer case of setDescriptor, call setArgumentBuffer()
before setBuffer() when useDirectBufferAddresses is false (i.e. not on
Metal3 hardware). This gives the encoder a valid backing buffer before any
encode operations:

argumentBuffer.argumentEncoder->setArgumentBuffer(argumentBuffer.mtl,
                                                  argumentBuffer.offset);
argumentBuffer.argumentEncoder->setBuffer(nativeBuffer,
                                          bufferDescriptor->offset,
                                          argumentIndex);

Impact

  • Intel Mac AMD (useArgumentBuffersTier2 = true, useDirectBufferAddresses = false): crash eliminated.
  • Apple Silicon / Metal3 (useDirectBufferAddresses = true): takes the direct GPU-address path as before — no change.
  • Tier1 devices (useArgumentBuffersTier2 = false): setArgumentBuffer is already called in the constructor; this path is unchanged.

On macOS 11+, all GPUs are reported as Tier 2 for argument buffers. Intel Mac
AMD GPUs (AMDMTLBronzeDriver) do not support Metal3 direct buffer addresses.
The constructor skips setArgumentBuffer() when useArgumentBuffersTier2=true,
leaving the encoder without a backing buffer. Calling setBuffer() on it then
causes a SIGSEGV inside AMDMTLBronzeDriver.

Fix: call setArgumentBuffer() before setBuffer() in the non-direct-address path.
@wendlinga wendlinga changed the title Fix Metal crash on Intel Mac AMD GPU (missing setArgumentBuffer) Fix Metal crash and black screen on Intel Mac AMD GPU Apr 23, 2026
@wendlinga wendlinga changed the title Fix Metal crash and black screen on Intel Mac AMD GPU Fix Metal crash on Intel Mac AMD GPU (missing setArgumentBuffer) Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant