winemac.drv: Fix crash when building against Metal-capable SDK but running on older OS X.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50790
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit d52c4eb00c)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Brendan Shanks 2021-03-10 15:25:20 -08:00 committed by Michael Stefaniuc
parent aa83195f1a
commit cb9b17fa85
1 changed files with 5 additions and 0 deletions

View File

@ -343,10 +343,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;
}