From aa147413c7edd35195b901153b0be0feff6c6af5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 23 Jan 2024 14:09:48 -0800 Subject: [PATCH] renderer/metal: only set shared texture mode on aarch64 This setting is only supported on aarch64. --- src/renderer/Metal.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 1450e1586..96d5b11d8 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -2162,7 +2162,16 @@ fn initAtlasTexture(device: objc.Object, atlas: *const font.Atlas) !objc.Object desc.setProperty("pixelFormat", @intFromEnum(pixel_format)); desc.setProperty("width", @as(c_ulong, @intCast(atlas.size))); desc.setProperty("height", @as(c_ulong, @intCast(atlas.size))); - desc.setProperty("storageMode", @as(c_ulong, mtl.MTLResourceStorageModeShared)); + + // Xcode tells us that this texture should be shared mode on + // aarch64. This configuration is not supported on x86_64 so + // we only set it on aarch64. + if (comptime builtin.target.cpu.arch == .aarch64) { + desc.setProperty( + "storageMode", + @as(c_ulong, mtl.MTLResourceStorageModeShared), + ); + } // Initialize const id = device.msgSend(