37 std::optional<std::string>& out_error) {
39 if (override_context) {
40 return override_context;
44 if (!dart_state->IsImpellerEnabled()) {
46 "Flutter GPU requires the Impeller rendering backend, but Impeller is "
47 "not enabled. For more details about where Impeller is available and "
48 "how to enable it, see: https://docs.flutter.dev/perf/impeller";
51 if (!dart_state->IsFlutterGPUEnabled()) {
53 "Flutter GPU must be enabled via the Flutter GPU manifest "
54 "setting. This can be done either via command line argument "
55 "--enable-flutter-gpu or "
56 "by adding the FLTEnableFlutterGPU key set to true in the Info.plist "
57 "on iOS/macOS, or the io.flutter.embedding.android.EnableFlutterGPU "
58 "metadata key to true in the AndroidManifest.xml on Android.";
62 std::promise<std::shared_ptr<impeller::Context>> context_promise;
63 auto impeller_context_future = context_promise.get_future();
65 dart_state->GetTaskRunners().GetIOTaskRunner(),
67 io_manager = dart_state->GetIOManager()]()
mutable {
68 promise.set_value(io_manager ? io_manager->GetImpellerContext()
71 auto context = impeller_context_future.get();
74 out_error =
"Unable to retrieve the Impeller context.";
static std::shared_ptr< impeller::Context > GetOverrideContext()
static void SetOverrideContext(std::shared_ptr< impeller::Context > context)
std::shared_ptr< impeller::Context > & GetContextShared()
impeller::Context & GetContext()
Context(std::shared_ptr< impeller::Context > context)
static std::shared_ptr< impeller::Context > GetDefaultContext(std::optional< std::string > &out_error)
To do anything rendering related with Impeller, you need a context.
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
int InternalFlutterGpu_Context_GetMinimumUniformByteAlignment(flutter::gpu::Context *wrapper)
int InternalFlutterGpu_Context_GetDefaultDepthStencilFormat(flutter::gpu::Context *wrapper)
Dart_Handle InternalFlutterGpu_Context_InitializeDefault(Dart_Handle wrapper)
int InternalFlutterGpu_Context_GetDefaultColorFormat(flutter::gpu::Context *wrapper)
bool InternalFlutterGpu_Context_GetSupportsOffscreenMSAA(flutter::gpu::Context *wrapper)
int InternalFlutterGpu_Context_GetDefaultStencilFormat(flutter::gpu::Context *wrapper)