Skip to content

Commit

Permalink
Fix Apple runtime crashes on Macs with non-Apple-Silicon GPUs
Browse files Browse the repository at this point in the history
This removes some legacy code that prevented the correct factory from being initialized when used on Macs with non-Apple-Silicon GPUs. Additionally, it removes explicitly setting the storage mode, which was causing Metal API validation to fail on non-Apple-Silicon GPU Macs.

## Storage Mode

Explicitly setting the storage mode to shared has been removed. This has no impact on iOS. For macOS, this defaults to managed, which should be appropriately handled by the C++ runtime, per Chris.

Per the docs for `MTLTextureDescriptor.storageMode`:

> In iOS and tvOS, the default value is MTLStorageMode.shared. In macOS, the default value is MTLStorageMode.managed.

## Testing

These changes were tested on an i9 Intel Mac against a file that was reproducibly causing crashes. Post-changes, the file no longer crashes.

Diffs=
56d95d200 Fix Apple runtime crashes on Macs with non-Apple-Silicon GPUs (#8301)

Co-authored-by: David Skuza <david@rive.app>
dskuza and dskuza committed Oct 8, 2024
1 parent 4666d8e commit 4dce6fd
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ab13be54df9e69b44581d0e3fd8c6069e34d7528
56d95d2006868350ebb0c080447d07647d1a5855
1 change: 0 additions & 1 deletion renderer/src/metal/render_context_metal_impl.mm
Original file line number Diff line number Diff line change
@@ -538,7 +538,6 @@ void onUnmap() override {}
desc.height = height;
desc.mipmapLevelCount = mipLevelCount;
desc.usage = MTLTextureUsageShaderRead;
desc.storageMode = MTLStorageModeShared;
desc.textureType = MTLTextureType2D;
m_texture = [gpu newTextureWithDescriptor:desc];

0 comments on commit 4dce6fd

Please sign in to comment.