From 2ee7083020800226c998b7d8bd9d388b7f5b2fe0 Mon Sep 17 00:00:00 2001 From: Michael Parkin-White Date: Mon, 13 Mar 2023 14:08:05 +0000 Subject: [PATCH] Fix #104012: Selection crash with AMD on Metal. Crash when selecting objets 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 Ref #96261 --- source/blender/gpu/metal/mtl_texture_util.mm | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/blender/gpu/metal/mtl_texture_util.mm b/source/blender/gpu/metal/mtl_texture_util.mm index 09fb23b61fa..2d66ea28776 100644 --- a/source/blender/gpu/metal/mtl_texture_util.mm +++ b/source/blender/gpu/metal/mtl_texture_util.mm @@ -342,9 +342,13 @@ id 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 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. */ -- 2.30.2