[PATCH] winemac.drv: Fix crash when building against Metal-capable SDK but running on older OS X.
Brendan Shanks
bshanks at codeweavers.com
Wed Mar 10 17:25:20 CST 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50790
Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
dlls/winemac.drv/cocoa_display.m | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m
index 7cc6f981fee..05f1c75d53b 100644
--- a/dlls/winemac.drv/cocoa_display.m
+++ b/dlls/winemac.drv/cocoa_display.m
@@ -348,10 +348,15 @@ static int macdrv_get_gpu_info_from_display_id_using_metal(struct macdrv_gpu* gp
int ret = -1;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ /* Test if Metal is available */
+ if (&CGDirectDisplayCopyCurrentMetalDevice == NULL)
+ goto done;
+
device = [CGDirectDisplayCopyCurrentMetalDevice(display_id) autorelease];
if (device && [device respondsToSelector:@selector(registryID)])
ret = macdrv_get_gpu_info_from_registry_id(gpu, device.registryID);
+done:
[pool release];
return ret;
}
--
2.26.2
More information about the wine-devel
mailing list