Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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#include "flutter/common/graphics/msaa_sample_count.h"
9#include "flutter/flow/surface.h"
10#include "flutter/fml/macros.h"
11#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
13
14namespace flutter {
15
16class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalSkia : public Surface {
17 public:
20 MsaaSampleCount msaa_samples,
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;
35 // TODO(38466): Refactor GPU surface APIs take into account the fact that an
36 // external view embedder may want to render to the root surface. This is a
37 // hack to make avoid allocating resources for the root surface when an
38 // external view embedder is present.
39 bool render_to_surface_ = true;
40 bool disable_partial_repaint_ = false;
41
42 // Accumulated damage for each framebuffer; Key is address of underlying
43 // MTLTexture for each drawable
44 std::map<uintptr_t, SkIRect> damage_;
45
46 // |Surface|
47 std::unique_ptr<SurfaceFrame> AcquireFrame(const SkISize& size) override;
48
49 // |Surface|
50 SkMatrix GetRootTransformation() const override;
51
52 // |Surface|
53 GrDirectContext* GetContext() override;
54
55 // |Surface|
56 std::unique_ptr<GLContextResult> MakeRenderContextCurrent() override;
57
58 // |Surface|
59 bool AllowsDrawingWhenGpuDisabled() const override;
60
61 std::unique_ptr<SurfaceFrame> AcquireFrameFromCAMetalLayer(
62 const SkISize& frame_info);
63
64 std::unique_ptr<SurfaceFrame> AcquireFrameFromMTLTexture(
65 const SkISize& frame_info);
66
67 void PrecompileKnownSkSLsIfNecessary();
68
70};
71
72} // namespace flutter
73
74#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
MsaaSampleCount