18 metal_context_ = std::make_unique<TestMetalContext>();
23 .present_command_queue =
25 .get_next_drawable_callback =
49 return present_count_;
53 return metal_context_.get();
57 return metal_surface_.get();
61 present_callback_ = std::move(present_callback);
66 [&]() {
return metal_surface_->GetRasterSurfaceSnapshot(); });
68 if (present_callback_ !=
nullptr) {
76 external_texture_frame_callback_ = std::move(external_texture_frame_callback);
83 if (external_texture_frame_callback_ !=
nullptr) {
84 return external_texture_frame_callback_(
texture_id, w,
h, output);
92 next_drawable_callback_ = std::move(next_drawable_callback);
96 if (next_drawable_callback_ !=
nullptr) {
97 return next_drawable_callback_(frame_info);
100 auto texture_info = metal_surface_->GetTextureInfo();
103 texture.texture_id = texture_info.texture_id;
108void EmbedderTestContextMetal::SetSurface(
DlISize surface_size) {
110 surface_size_ = surface_size;
114void EmbedderTestContextMetal::SetupCompositor() {
116 FML_CHECK(metal_surface_) <<
"Set up the Metal surface before setting up a compositor.";
118 std::make_unique<EmbedderTestCompositorMetal>(surface_size_, metal_surface_->GetGrContext());
FlutterRendererConfig renderer_config_
std::unique_ptr< EmbedderTestCompositor > compositor_
void FireRootSurfacePresentCallbackIfPresent(const std::function< sk_sp< SkImage >(void)> &image_callback)
std::function< bool(int64_t texture_id, size_t w, size_t h, FlutterMetalExternalTexture *output)> TestExternalTextureCallback
std::function< FlutterMetalTexture(const FlutterFrameInfo *frame_info)> NextDrawableCallback
std::function< bool(int64_t texture_id)> PresentCallback
size_t GetSurfacePresentCount() const override
TestMetalSurface * GetTestMetalSurface()
void SetNextDrawableCallback(NextDrawableCallback next_drawable_callback)
EmbedderTestContextMetal(std::string assets_path="")
void SetPresentCallback(PresentCallback present_callback)
TestMetalContext * GetTestMetalContext()
void SetExternalTextureCallback(TestExternalTextureCallback external_texture_frame_callback)
bool Present(int64_t texture_id)
FlutterMetalTexture GetNextDrawable(const FlutterFrameInfo *frame_info)
EmbedderTestContextType GetContextType() const override
bool PopulateExternalTexture(int64_t texture_id, size_t w, size_t h, FlutterMetalExternalTexture *output)
~EmbedderTestContextMetal() override
const void * FlutterMetalDeviceHandle
Alias for id<MTLDevice>.
const void * FlutterMetalCommandQueueHandle
Alias for id<MTLCommandQueue>.
const void * FlutterMetalTextureHandle
Alias for id<MTLTexture>.
#define FML_CHECK(condition)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder h
size_t struct_size
The size of this struct. Must be sizeof(FlutterMetalTexture).
FlutterMetalRendererConfig metal
constexpr bool IsEmpty() const
Returns true if either of the width or height are 0, negative, or NaN.