From 1961f2c5cc4eae78f31e4017c1d4d8036a7ffaf6 Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Thu, 22 Aug 2024 00:37:31 -0400 Subject: [PATCH] Export GPU symbols for embedder (flutter/engine#54662) This PR exports GPU symbols for the embedder library. *List which issues are fixed by this PR. You must list at least one issue.* https://github.com/flutter/flutter/issues/153196 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- engine/src/flutter/examples/glfw/main.dart | 11 +++++++++++ engine/src/flutter/examples/glfw/run.sh | 1 + .../shell/platform/embedder/embedder_exports.lst | 2 ++ 3 files changed, 14 insertions(+) diff --git a/engine/src/flutter/examples/glfw/main.dart b/engine/src/flutter/examples/glfw/main.dart index 557d020a1d..ceb5eda137 100644 --- a/engine/src/flutter/examples/glfw/main.dart +++ b/engine/src/flutter/examples/glfw/main.dart @@ -2,11 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter_gpu/gpu.dart' as gpu; import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart' show debugDefaultTargetPlatformOverride; void main() { + // Ensure Flutter GPU symbols are available by forcing the GPU context to instantiate. + try { + // ignore: unnecessary_statements + gpu.gpuContext; // Force the context to instantiate. + } catch (e) { + // If impeller is not enabled, make sure the exception isn't about symbols missing. + assert(e.toString().contains( + 'Flutter GPU requires the Impeller rendering backend to be enabled.')); + } + // This is a hack to make Flutter think you are running on Google Fuchsia, // otherwise you will get an error about running from an unsupported platform. debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; diff --git a/engine/src/flutter/examples/glfw/run.sh b/engine/src/flutter/examples/glfw/run.sh index 6d32ae0f5d..a756aa5957 100755 --- a/engine/src/flutter/examples/glfw/run.sh +++ b/engine/src/flutter/examples/glfw/run.sh @@ -25,6 +25,7 @@ if [ ! -d myapp ]; then fi cd myapp +flutter pub add flutter_gpu --sdk=flutter cp ../../main.dart lib/main.dart flutter build bundle \ --local-engine-src-path ../../../../../ \ diff --git a/engine/src/flutter/shell/platform/embedder/embedder_exports.lst b/engine/src/flutter/shell/platform/embedder/embedder_exports.lst index ccaf84b2ea..d5755ed5c5 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_exports.lst +++ b/engine/src/flutter/shell/platform/embedder/embedder_exports.lst @@ -13,6 +13,8 @@ kDartIsolateSnapshotInstructions; kDartVmSnapshotData; kDartVmSnapshotInstructions; + InternalFlutterGpu*; + kInternalFlutterGpu*; local: *; };