Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 85d4be0

Browse files
authored
Export GPU symbols for embedder (#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.* flutter/flutter#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
1 parent 4097b56 commit 85d4be0

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

examples/glfw/main.dart

+11
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'package:flutter_gpu/gpu.dart' as gpu;
56
import 'package:flutter/material.dart';
67
import 'package:flutter/foundation.dart'
78
show debugDefaultTargetPlatformOverride;
89

910
void main() {
11+
// Ensure Flutter GPU symbols are available by forcing the GPU context to instantiate.
12+
try {
13+
// ignore: unnecessary_statements
14+
gpu.gpuContext; // Force the context to instantiate.
15+
} catch (e) {
16+
// If impeller is not enabled, make sure the exception isn't about symbols missing.
17+
assert(e.toString().contains(
18+
'Flutter GPU requires the Impeller rendering backend to be enabled.'));
19+
}
20+
1021
// This is a hack to make Flutter think you are running on Google Fuchsia,
1122
// otherwise you will get an error about running from an unsupported platform.
1223
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;

examples/glfw/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ ! -d myapp ]; then
2525
fi
2626

2727
cd myapp
28+
flutter pub add flutter_gpu --sdk=flutter
2829
cp ../../main.dart lib/main.dart
2930
flutter build bundle \
3031
--local-engine-src-path ../../../../../ \

shell/platform/embedder/embedder_exports.lst

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
kDartIsolateSnapshotInstructions;
1414
kDartVmSnapshotData;
1515
kDartVmSnapshotInstructions;
16+
InternalFlutterGpu*;
17+
kInternalFlutterGpu*;
1618
local:
1719
*;
1820
};

0 commit comments

Comments
 (0)