5#import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h"
7#include "flutter/common/graphics/persistent_cache.h"
8#include "flutter/fml/logging.h"
9#include "flutter/impeller/renderer/backend/metal/context_mtl.h"
10#include "flutter/shell/common/context_options.h"
11#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
12#include "impeller/entity/mtl/entity_shaders.h"
13#include "impeller/entity/mtl/framebuffer_blend_shaders.h"
14#include "impeller/entity/mtl/modern_shaders.h"
17#include "impeller/scene/shaders/mtl/scene_shaders.h"
23 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
24 std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
25 std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
26 impeller_entity_shaders_length),
28 std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
29 impeller_scene_shaders_length),
31 std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
32 impeller_modern_shaders_length),
33 std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
34 impeller_framebuffer_blend_shaders_length),
39 FML_LOG(
ERROR) <<
"Could not create Metal Impeller Context.";
48- (instancetype)
init:(const
std::shared_ptr<const
fml::SyncSwitch>&)is_gpu_disabled_sync_switch {
52 id<MTLDevice>
device = _context->GetMTLDevice();
59 CVReturn cvReturn = CVMetalTextureCacheCreate(kCFAllocatorDefault,
66 if (cvReturn != kCVReturnSuccess) {
76 createExternalTextureWithIdentifier:(int64_t)textureID
static FLUTTER_ASSERT_ARC std::shared_ptr< impeller::ContextMTL > CreateImpellerContext(const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
static std::shared_ptr< ContextMTL > Create(const std::vector< std::string > &shader_library_paths, std::shared_ptr< const fml::SyncSwitch > is_gpu_disabled_sync_switch)
#define FML_DLOG(severity)
#define FML_LOG(severity)
fml::CFRef< CVMetalTextureCacheRef > textureCache