Fix #104012: Selection crash with AMD on Metal

Crash when selecting objects on AMD platforms running
Metal. This was caused by shader compilation warnings
being treated as errors in macOS 10.15. Wrapping
compilation failure with success check resolves error.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105739
This commit is contained in:
2023-03-16 08:03:15 +01:00
committed by Jeroen Bakker
parent b96f8ac9fe
commit ac6a70e5f8

View File

@@ -342,9 +342,13 @@ id<MTLComputePipelineState> gpu::MTLTexture::mtl_texture_update_impl(
options:options
error:&error] autorelease];
if (error) {
NSLog(@"Compile Error - Metal Shader Library error %@ ", error);
BLI_assert(false);
return nullptr;
/* Only exit out if genuine error and not warning. */
if ([[error localizedDescription] rangeOfString:@"Compilation succeeded"].location ==
NSNotFound) {
NSLog(@"Compile Error - Metal Shader Library error %@ ", error);
BLI_assert(false);
return nil;
}
}
/* Fetch compute function. */
@@ -658,9 +662,13 @@ id<MTLComputePipelineState> gpu::MTLTexture::mtl_texture_read_impl(
options:options
error:&error] autorelease];
if (error) {
NSLog(@"Compile Error - Metal Shader Library error %@ ", error);
BLI_assert(false);
return nil;
/* Only exit out if genuine error and not warning. */
if ([[error localizedDescription] rangeOfString:@"Compilation succeeded"].location ==
NSNotFound) {
NSLog(@"Compile Error - Metal Shader Library error %@ ", error);
BLI_assert(false);
return nil;
}
}
/* Fetch compute function. */