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

Export GPU symbols for embedder #54662

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/glfw/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions examples/glfw/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../../../../../ \
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/embedder/embedder_exports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
kDartIsolateSnapshotInstructions;
kDartVmSnapshotData;
kDartVmSnapshotInstructions;
InternalFlutterGpu*;
kInternalFlutterGpu*;
local:
*;
};