Cocoa Port: If default.metallib is missing or corrupted in the app bundle, then fail running Metal video output and fall back to using OpenGL instead.

This commit is contained in:
rogerman 2022-05-18 12:44:00 -07:00
parent 183dd57136
commit c904706a6b
1 changed files with 9 additions and 3 deletions

View File

@ -61,9 +61,17 @@
}
device = MTLCreateSystemDefaultDevice();
if (device == nil)
{
NSLog(@"Metal: A Metal device could not be found.");
[self release];
return nil;
}
defaultLibrary = [device newDefaultLibrary];
if (defaultLibrary == nil)
{
NSLog(@"Metal: The default.metallib could not be loaded!");
[self release];
return nil;
}
@ -103,8 +111,6 @@
_fetchCommandQueue = [device newCommandQueue];
[_fetchCommandQueue setLabel:@"CQ_DeSmuME_FramebufferFetch"];
defaultLibrary = [device newDefaultLibrary];
MTLComputePipelineDescriptor *computePipelineDesc = [[MTLComputePipelineDescriptor alloc] init];
[computePipelineDesc setThreadGroupSizeIsMultipleOfThreadExecutionWidth:YES];