diff --git a/examples/glfw/main.dart b/examples/glfw/main.dart index 557d020a1d6f6..ceb5eda137751 100644 --- a/examples/glfw/main.dart +++ b/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/examples/glfw/run.sh b/examples/glfw/run.sh index 6d32ae0f5d44e..a756aa595733b 100755 --- a/examples/glfw/run.sh +++ b/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/shell/platform/embedder/embedder_exports.lst b/shell/platform/embedder/embedder_exports.lst index ccaf84b2ea5d8..d5755ed5c5724 100644 --- a/shell/platform/embedder/embedder_exports.lst +++ b/shell/platform/embedder/embedder_exports.lst @@ -13,6 +13,8 @@ kDartIsolateSnapshotInstructions; kDartVmSnapshotData; kDartVmSnapshotInstructions; + InternalFlutterGpu*; + kInternalFlutterGpu*; local: *; };