Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@
std::make_shared<fml::NonOwnedMapping>(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
Expand All @@ -41,11 +35,9 @@ - (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disab
self = [super init];
if (self != nil) {
_context = CreateImpellerContext(is_gpu_disabled_sync_switch);
FML_CHECK(_context) << "Could not create Metal Impeller Context.";
id<MTLDevice> 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
Expand All @@ -55,10 +47,7 @@ - (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disab
&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;
Expand Down
Loading