Cocoa Port: Fix a potential crash on startup if Metal is not available. (Regression from commit 6833e315.)

- Also change one of Apple's Metal enums to an older version to fix a compiling issue with Xcode 8.
This commit is contained in:
rogerman 2022-04-07 16:28:50 -07:00
parent 6833e3159d
commit 4df869c309
1 changed files with 7 additions and 3 deletions

View File

@ -89,7 +89,7 @@
{ {
tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v2 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v2"; tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v2 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v2";
} }
else if ([device supportsFeatureSet:MTLFeatureSet_macOS_GPUFamily1_v1]) else if ([device supportsFeatureSet:MTLFeatureSet_OSX_GPUFamily1_v1])
{ {
tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v1 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v1"; tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v1 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v1";
} }
@ -2456,8 +2456,12 @@ MacMetalFetchObject::MacMetalFetchObject()
} }
_clientData = [[MetalDisplayViewSharedData alloc] init]; _clientData = [[MetalDisplayViewSharedData alloc] init];
if (_clientData != nil)
{
strlcpy(_name, [[(MetalDisplayViewSharedData *)_clientData name] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_name) - 1); strlcpy(_name, [[(MetalDisplayViewSharedData *)_clientData name] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_name) - 1);
strlcpy(_description, [[(MetalDisplayViewSharedData *)_clientData description] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_description) - 1); strlcpy(_description, [[(MetalDisplayViewSharedData *)_clientData description] cStringUsingEncoding:NSUTF8StringEncoding], sizeof(_description) - 1);
}
} }
MacMetalFetchObject::~MacMetalFetchObject() MacMetalFetchObject::~MacMetalFetchObject()