diff --git a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm index af73983665..3e41eedf91 100644 --- a/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm +++ b/engine/src/flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm @@ -25,14 +25,8 @@ static std::shared_ptr CreateImpellerContext( std::make_shared(impeller_framebuffer_blend_shaders_data, impeller_framebuffer_blend_shaders_length), }; - auto context = impeller::ContextMTL::Create(shader_mappings, is_gpu_disabled_sync_switch, - "Impeller Library"); - if (!context) { - FML_LOG(ERROR) << "Could not create Metal Impeller Context."; - return nullptr; - } - - return context; + return impeller::ContextMTL::Create(shader_mappings, is_gpu_disabled_sync_switch, + "Impeller Library"); } @implementation FlutterDarwinContextMetalImpeller @@ -41,11 +35,9 @@ static std::shared_ptr CreateImpellerContext( self = [super init]; if (self != nil) { _context = CreateImpellerContext(is_gpu_disabled_sync_switch); + FML_CHECK(_context) << "Could not create Metal Impeller Context."; id device = _context->GetMTLDevice(); - if (!device) { - FML_DLOG(ERROR) << "Could not acquire Metal device."; - return nil; - } + FML_CHECK(device) << "Could not acquire Metal device."; CVMetalTextureCacheRef textureCache; CVReturn cvReturn = CVMetalTextureCacheCreate(kCFAllocatorDefault, // allocator @@ -55,10 +47,7 @@ static std::shared_ptr CreateImpellerContext( &textureCache // [out] cache ); - if (cvReturn != kCVReturnSuccess) { - FML_DLOG(ERROR) << "Could not create Metal texture cache."; - return nil; - } + FML_CHECK(cvReturn == kCVReturnSuccess) << "Could not acquire Metal device."; _textureCache.Reset(textureCache); } return self;