-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Expand file tree
/
Copy pathgpu_surface_noop.mm
More file actions
97 lines (77 loc) · 2.66 KB
/
gpu_surface_noop.mm
File metadata and controls
97 lines (77 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/gpu/gpu_surface_noop.h"
#import <Metal/Metal.h>
#import <QuartzCore/QuartzCore.h>
#include "flow/surface.h"
#include "flow/surface_frame.h"
#include "flutter/common/settings.h"
#include "flutter/fml/mapping.h"
#include "flutter/fml/trace_event.h"
static_assert(__has_feature(objc_arc), "ARC must be enabled.");
namespace flutter {
GPUSurfaceNoop::GPUSurfaceNoop() = default;
GPUSurfaceNoop::~GPUSurfaceNoop() = default;
// |Surface|
bool GPUSurfaceNoop::IsValid() {
return true;
}
Surface::SurfaceData GPUSurfaceNoop::GetSurfaceData() const {
return Surface::SurfaceData{};
}
// |Surface|
std::unique_ptr<SurfaceFrame> GPUSurfaceNoop::AcquireFrame(const DlISize& frame_size) {
auto callback = [](const SurfaceFrame&, DlCanvas*) { return true; };
auto submit_callback = [](const SurfaceFrame&) { return true; };
SurfaceFrame::FramebufferInfo framebuffer_info;
return std::make_unique<SurfaceFrame>(
/*surface=*/nullptr,
/*framebuffer_info=*/framebuffer_info,
/*encode_callback=*/callback,
/*submit_callback=*/submit_callback,
/*frame_size=*/frame_size,
/*context_result=*/nullptr,
/*display_list_fallback=*/true);
}
std::unique_ptr<SurfaceFrame> GPUSurfaceNoop::AcquireFrameFromMTLTexture(
const DlISize& frame_size) {
auto callback = [](const SurfaceFrame&, DlCanvas*) { return true; };
auto submit_callback = [](const SurfaceFrame&) { return true; };
SurfaceFrame::FramebufferInfo framebuffer_info;
return std::make_unique<SurfaceFrame>(
/*surface=*/nullptr,
/*framebuffer_info=*/framebuffer_info,
/*encode_callback=*/callback,
/*submit_callback=*/submit_callback,
/*frame_size=*/frame_size,
/*context_result=*/nullptr,
/*display_list_fallback=*/true);
}
// |Surface|
DlMatrix GPUSurfaceNoop::GetRootTransformation() const {
// This backend does not currently support root surface transformations. Just
// return identity.
return {};
}
// |Surface|
GrDirectContext* GPUSurfaceNoop::GetContext() {
return nullptr;
}
// |Surface|
std::unique_ptr<GLContextResult> GPUSurfaceNoop::MakeRenderContextCurrent() {
// This backend has no such concept.
return std::make_unique<GLContextDefaultResult>(true);
}
bool GPUSurfaceNoop::AllowsDrawingWhenGpuDisabled() const {
return true;
}
// |Surface|
bool GPUSurfaceNoop::EnableRasterCache() const {
return false;
}
// |Surface|
std::shared_ptr<impeller::AiksContext> GPUSurfaceNoop::GetAiksContext() const {
return nullptr;
}
} // namespace flutter