Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_surface_metal.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_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_H_
7
8#include "flutter/fml/macros.h"
9#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
10#include "flutter/shell/gpu/gpu_surface_metal_skia.h"
11#include "flutter/shell/platform/embedder/embedder_external_view_embedder.h"
12#include "flutter/shell/platform/embedder/embedder_surface.h"
13
15
16namespace flutter {
17
20 public:
22 std::function<bool(GPUMTLTextureInfo texture)> present; // required
23 std::function<GPUMTLTextureInfo(const SkISize& frame_size)>
24 get_texture; // required
25 };
26
29 GPUMTLCommandQueueHandle command_queue,
30 MetalDispatchTable dispatch_table,
31 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder);
32
34
35 private:
36 bool valid_ = false;
37 MetalDispatchTable metal_dispatch_table_;
38 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder_;
39 sk_sp<SkSurface> surface_;
40 sk_sp<GrDirectContext> main_context_;
41 sk_sp<GrDirectContext> resource_context_;
42
43 // |EmbedderSurface|
44 bool IsValid() const override;
45
46 // |EmbedderSurface|
47 std::unique_ptr<Surface> CreateGPUSurface() override;
48
49 // |EmbedderSurface|
51
52 // |GPUSurfaceMetalDelegate|
54 const SkISize& frame_size) const override;
55
56 // |GPUSurfaceMetalDelegate|
57 bool PresentDrawable(GrMTLHandle drawable) const override;
58
59 // |GPUSurfaceMetalDelegate|
60 GPUMTLTextureInfo GetMTLTexture(const SkISize& frame_size) const override;
61
62 // |GPUSurfaceMetalDelegate|
63 bool PresentTexture(GPUMTLTextureInfo texture) const override;
64
66};
67
68} // namespace flutter
69
70#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_METAL_H_
const void * GrMTLHandle
Definition GrMtlTypes.h:20
std::unique_ptr< Surface > CreateGPUSurface() override
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...
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...
sk_sp< GrDirectContext > CreateResourceContext() const override
bool PresentTexture(GPUMTLTextureInfo texture) const override
Presents the texture with texture_id to the "screen". texture_id corresponds to a texture that has be...
bool PresentDrawable(GrMTLHandle drawable) const override
Presents the drawable to the "screen". The drawable is obtained from the CAMetalLayer that given by G...
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
std::function< bool(GPUMTLTextureInfo texture)> present