Flutter Engine
 
Loading...
Searching...
No Matches
context.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_LIB_GPU_CONTEXT_H_
6#define FLUTTER_LIB_GPU_CONTEXT_H_
7
8#include "dart_api.h"
12
13namespace flutter {
14namespace gpu {
15
17
18class Context : public RefCountedDartWrappable<Context> {
19 DEFINE_WRAPPERTYPEINFO();
21
22 public:
23 static void SetOverrideContext(std::shared_ptr<impeller::Context> context);
24
25 static std::shared_ptr<impeller::Context> GetOverrideContext();
26
27 static std::shared_ptr<impeller::Context> GetDefaultContext(
28 std::optional<std::string>& out_error);
29
30 explicit Context(std::shared_ptr<impeller::Context> context);
31 ~Context() override;
32
34
35 std::shared_ptr<impeller::Context>& GetContextShared();
36
37 private:
38 /// An Impeller context that takes precedent over the IO state context when
39 /// set. This is used to inject the context when running with the Impeller
40 /// playground, which doesn't instantiate an Engine instance.
41 static std::shared_ptr<impeller::Context> default_context_;
42
43 std::shared_ptr<impeller::Context> context_;
44
46};
47
48} // namespace gpu
49} // namespace flutter
50
51//----------------------------------------------------------------------------
52/// Exports
53///
54
55extern "C" {
56
59 Dart_Handle wrapper);
60
63 flutter::gpu::Context* wrapper);
64
67 flutter::gpu::Context* wrapper);
68
71 flutter::gpu::Context* wrapper);
72
75 flutter::gpu::Context* wrapper);
76
79 flutter::gpu::Context* wrapper);
80
83 flutter::gpu::Context* wrapper);
84
85} // extern "C"
86
87#endif // FLUTTER_LIB_GPU_CONTEXT_H_
static std::shared_ptr< impeller::Context > GetOverrideContext()
Definition context.cc:32
static void SetOverrideContext(std::shared_ptr< impeller::Context > context)
Definition context.cc:28
std::shared_ptr< impeller::Context > & GetContextShared()
Definition context.cc:81
impeller::Context & GetContext()
Definition context.cc:77
static std::shared_ptr< impeller::Context > GetDefaultContext(std::optional< std::string > &out_error)
Definition context.cc:36
To do anything rendering related with Impeller, you need a context.
Definition context.h:65
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
#define FLUTTER_GPU_EXPORT
Definition export.h:13
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultDepthStencilFormat(flutter::gpu::Context *wrapper)
Definition context.cc:117
FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_Context_InitializeDefault(Dart_Handle wrapper)
Definition context.cc:92
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetBackendType(flutter::gpu::Context *wrapper)
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsOffscreenMSAA(flutter::gpu::Context *wrapper)
Definition context.cc:128
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetMinimumUniformByteAlignment(flutter::gpu::Context *wrapper)
Definition context.cc:123
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultStencilFormat(flutter::gpu::Context *wrapper)
Definition context.cc:111
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultColorFormat(flutter::gpu::Context *wrapper)
Definition context.cc:105
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
Definition context.cc:18
#define FML_FRIEND_MAKE_REF_COUNTED(T)