Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_surface_metal_impeller.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_IMPELLER_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_IMPELLER_H_
7
8#include <memory>
9#include "flutter/fml/macros.h"
10#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
11#include "flutter/shell/gpu/gpu_surface_metal_skia.h"
12#include "flutter/shell/platform/embedder/embedder_external_view_embedder.h"
13#include "flutter/shell/platform/embedder/embedder_surface.h"
15
16namespace impeller {
17class Context;
18}
19
20namespace flutter {
21
24 public:
26 std::function<bool(GPUMTLTextureInfo texture)> present; // required
27 std::function<GPUMTLTextureInfo(const SkISize& frame_size)>
28 get_texture; // required
29 };
30
33 GPUMTLCommandQueueHandle command_queue,
34 MetalDispatchTable dispatch_table,
35 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder);
36
38
39 private:
40 bool valid_ = false;
41 MetalDispatchTable metal_dispatch_table_;
42 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder_;
43 std::shared_ptr<impeller::Context> context_;
44
45 // |EmbedderSurface|
46 bool IsValid() const override;
47
48 // |EmbedderSurface|
49 std::unique_ptr<Surface> CreateGPUSurface() override;
50
51 // |GPUSurfaceMetalDelegate|
53 const SkISize& frame_size) const override;
54
55 // |GPUSurfaceMetalDelegate|
56 bool PresentDrawable(GrMTLHandle drawable) const override;
57
58 // |GPUSurfaceMetalDelegate|
59 GPUMTLTextureInfo GetMTLTexture(const SkISize& frame_size) const override;
60
61 // |GPUSurfaceMetalDelegate|
62 bool PresentTexture(GPUMTLTextureInfo texture) const override;
63
64 // |EmbedderSurface|
65 std::shared_ptr<impeller::Context> CreateImpellerContext() const override;
66
68};
69
70} // namespace flutter
71
72#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_IMPELLER_H_
const void * GrMTLHandle
Definition GrMtlTypes.h:20
GPUMTLTextureInfo GetMTLTexture(const SkISize &frame_size) const override
Returns the handle to the MTLTexture to render to. This is only called when the specified render targ...
GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize &frame_size) const override
Returns the handle to the CAMetalLayer to render to. This is only called when the specified render ta...
bool PresentTexture(GPUMTLTextureInfo texture) const override
Presents the texture with texture_id to the "screen". texture_id corresponds to a texture that has be...
std::unique_ptr< Surface > CreateGPUSurface() override
bool PresentDrawable(GrMTLHandle drawable) const override
Presents the drawable to the "screen". The drawable is obtained from the CAMetalLayer that given by G...
std::shared_ptr< impeller::Context > CreateImpellerContext() const override
Interface implemented by all platform surfaces that can present a metal backing store to the "screen"...
VkDevice device
Definition main.cc:53
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
FlTexture * texture
std::function< GPUMTLTextureInfo(const SkISize &frame_size)> get_texture