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
This commit is contained in:
Joel Winarske
2024-08-22 00:37:31 -04:00
committed by GitHub
parent d6079c8165
commit 1961f2c5cc
3 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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 ../../../../../ \

View File

@@ -13,6 +13,8 @@
kDartIsolateSnapshotInstructions;
kDartVmSnapshotData;
kDartVmSnapshotInstructions;
InternalFlutterGpu*;
kInternalFlutterGpu*;
local:
*;
};