Flutter Engine
The Flutter Engine
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:
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|
52 GPUCAMetalLayerHandle GetCAMetalLayer(
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
67 FML_DISALLOW_COPY_AND_ASSIGN(EmbedderSurfaceMetalImpeller);
68};
69
70} // namespace flutter
71
72#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_IMPELLER_H_
const void * GrMTLHandle
Definition: GrMtlTypes.h:20
EmbedderSurfaceMetalImpeller(GPUMTLDeviceHandle device, GPUMTLCommandQueueHandle command_queue, MetalDispatchTable dispatch_table, std::shared_ptr< EmbedderExternalViewEmbedder > external_view_embedder)
Interface implemented by all platform surfaces that can present a metal backing store to the "screen"...
VkDevice device
Definition: main.cc:53
Dart_NativeFunction function
Definition: fuchsia.cc:51
FlTexture * texture
void * GPUMTLCommandQueueHandle
Definition: SkSize.h:16
std::function< GPUMTLTextureInfo(const SkISize &frame_size)> get_texture