Flutter Engine
The Flutter Engine
gpu_surface_metal_skia.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_GPU_GPU_SURFACE_METAL_SKIA_H_
6#define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_
7
8#if !SLIMPELLER
9
10#include "flutter/flow/surface.h"
11#include "flutter/fml/macros.h"
12#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
14
15namespace flutter {
16
17class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalSkia : public Surface {
18 public:
21 bool render_to_surface = true);
22
23 // |Surface|
25
26 // |Surface|
27 bool IsValid() override;
28
29 private:
31 const MTLRenderTargetType render_target_type_;
33 GrDirectContext* precompiled_sksl_context_ = nullptr;
34 // TODO(38466): Refactor GPU surface APIs take into account the fact that an
35 // external view embedder may want to render to the root surface. This is a
36 // hack to make avoid allocating resources for the root surface when an
37 // external view embedder is present.
38 bool render_to_surface_ = true;
39 bool disable_partial_repaint_ = false;
40
41 // Accumulated damage for each framebuffer; Key is address of underlying
42 // MTLTexture for each drawable
43 std::map<uintptr_t, SkIRect> damage_;
44
45 // |Surface|
46 std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
47
48 // |Surface|
49 SkMatrix GetRootTransformation() const override;
50
51 // |Surface|
52 GrDirectContext* GetContext() override;
53
54 // |Surface|
55 std::unique_ptr<GLContextResult> MakeRenderContextCurrent() override;
56
57 // |Surface|
58 bool AllowsDrawingWhenGpuDisabled() const override;
59
60 std::unique_ptr<SurfaceFrame> AcquireFrameFromCAMetalLayer(
61 const SkISize& frame_info);
62
63 std::unique_ptr<SurfaceFrame> AcquireFrameFromMTLTexture(
64 const SkISize& frame_info);
65
66 void PrecompileKnownSkSLsIfNecessary();
67
69};
70
71} // namespace flutter
72
73#endif // !SLIMPELLER
74
75#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_
Interface implemented by all platform surfaces that can present a metal backing store to the "screen"...
Abstract Base Class that represents where we will be rendering content.
Definition: surface.h:24
MockDelegate delegate_
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
SK_API GrDirectContext * GetContext(const SkImage *src)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: SkSize.h:16